2023-06-01
array.index
is now calledarray.get!
(#386)
- New builtin functions
eprintln : String -> IO ()
(#409)eprint : String -> IO ()
(#409)dprintln : Debug a => a -> IO ()
(#409)dprint : Debug a => a -> IO ()
(#409)array.get : Int -> Array a -> (| Some : a, None : () |)
(#386)array.first : Array a -> (| Some : a, None : () |)
(#376)array.last : Array a -> (| Some : a, None : () |)
(#376)array.swap : Int -> Int -> Array a -> Array a
(#325)array.filter : (a -> Bool) -> Array a -> Array a
(#321)array.filterMap : (a -> (| Some : b, None : ()|)) -> Array a -> Array b
(#321)array.find : (a -> Bool) -> Array a -> (| Some : Int, None : () |)
(#324)array.findMap : (a -> (| Some : b, None : () |)) -> Array a -> (| Some : b, None : () |)
(#324)int.min : Int -> Int -> Int
(#394)int.max : Int -> Int -> Int
(#394)int.parseBin : String -> (| Some : Int, None : () |)
(#393)int.parseOct : String -> (| Some : Int, None : () |)
(#393)int.parseDec : String -> (| Some : Int, None : () |)
(#393)int.parseHex : String -> (| Some : Int, None : () |)
(#393)string.toChars : String -> Array Char
(#318)string.fromChars : Array Char -> String
(#318)string.startsWith : String -> String -> Bool
(#319)string.stripPrefix : String -> String -> (| Some : String, None : () |)
(#319)
- Allow literal backslashes in string literals (#395)
2023-02-26
-
Calling
string.parts
with an empty delimiter results in a runtime error (#359)Before this change,
string.parts "" input
looped forever for non-empty values ofinput
. It returned""
wheninput
was empty. Now the function exits with a runtime error when it's called with an empty delimiter, regardless of theinput
:> string.parts "" "a" error: string.parts called with empty delimiter
-
Relax indentation in record and variant types (#365)
You can now use "Java-style indentation" for large record and variant types in type signatures. For example:
test : String -> { a : { b : (), c : (), d : () }, b : (| A : (), B : (), C : (), D : () |) } test = ...
Line joining rules still apply, so code like this:
test : { a : (), b : (), c : () } test = ...
is invalid.
-
Allow empty string patterns (#356)
Pattern matching on string literals was already allowed, but I forgot to support the empty string.
case x of "" -> "it's empty" "a" -> "it's a" "b" -> "it's b" _ -> "it's not empty, a, or b"
-
Improve type errors in function arguments (#377)
Type errors in function arguments are now more accurate in some situations. See the issue for an example.
- Fix a panic due to an undesugared pattern (#358)
- Fix lambda pattern elaboration (#357, #326)
- Fix scope management in interpreter (#362)
- Fix name resolution in submodules (#189)
2023-02-13
-
String
interpolation in commands with$
(#138)To simplify string interpolation in quoted command literal arguments,
$
now only substitutesString
values instead being overloaded byToArgs
.Use command argument splatting with
$..
to substitue an array of arguments. -
Removed
ToArgs
class (#348)Command argument interpolation uses
$
to substituteString
s (#138) and$..
(#346) to substituteArray String
s.ToArgs
is no longer needed to overload$
.
-
--check
flag (#312)ipso --check FILE
parses and type checks a file without running it. It either exits successfully (with exit status 0) or prints the relevant error messages and exits with a failure status. -
Arguments can be passed to script without
--
(#316)This allows arguments to be correctly forwarded to scripts that have shebang lines:
test.ipso
#! /usr/bin/env ipso main : IO () main = comp bind args <- env.args println <| debug args
$ ./test.ipso --help ["--help"]
-
Array pattern matching (#81)
You can pattern match on arrays in function definitions and
case
expressions:f [a, b, c] = a * b * c case x of [] -> "zero" [x] -> "one" _ -> "many"
Array patterns can only contain variables; nested patterns in arrays aren't supported yet. Progress is tracked in #354.
-
Command argument splatting (#346)
Use
$..
to substuteArray String
s into commands, where each item becomes a separate command argument:> :t \x -> `echo $..x` Array String -> Cmd > `echo $..{ ["a", "b", "c d"] } `echo a b "c d"`
-
String interpolation in quoted command literal arguments (#138)
Expressions like
`echo "hello: $name"`
are now allowed.
Previously they were rejected as sytnax errors, and you'd have to work around it by writing
let arg = "hello: $name" in `echo $arg`
instead.
-
!
and?
in identifiers (#286)!
and?
symbols are now allowed in identifiers:bangbang! : IO () bangbang! = println "my baby shot me down"
if empty? then "yes" else "no"
not : Bool -> Bool
(#322)env.getvar! : String -> IO String
(#285)cmd.try : Cmd -> IO (| Success : (), Failure : Int |)
(#327)string.trimp : (Char -> Bool) -> String -> String
(#256)string.trimc : Char -> String -> String
(#256)string.trim : String -> String
(#256)
-
Use escaped
$
symbol in command literals (#335)Expressions like
`echo \$`
were incorrectly rejected as syntax errors.
Here's what happens now:
> cmd.run `echo \$` $
- Add GitHub actions cache for
.cargo
directories (#294) - Share GitHub actions caches across branches (#338)
- Report errors for unused crate dependencies (#126)
2022-11-24
-
Command line argument access from scripts (#255)
You can pass arguments to an ipso script by adding
--
to the command:ipso script.ipso -- a b c
env.program
andenv.args
provide access to the script/program name and the command line arguments. See theenv
module documentation for usage examples. -
string.split
takes aString
delimiter (#277)We now have
string.split : String -> String -> Array String
so thatstring.join
is a better inverse. To split with aChar
as a delimiter, usestring.splitc
-
Fixed incorrect record evaluation (#300)
-
Nested patterns (#95)
You can now pattern match through multiple levels of a datatype in a single pattern:
case x of C (C (C a)) -> a
This desugars to
case x of C x1 -> case x1 of C x2 -> case x2 of C a -> a
which is what you'd have written by hand without this feature.
-
Unit patterns (#303)
Pattern match on the unit type:
case x of () -> ...
This works nicely with variants that have "nullary" constructors (constructors whose argument is
()
):orElse : (| Some : a, None : () |) -> a -> a orElse option default = case option of Some a -> a None () -> default
-
New builtins:
string.parts
andstring.partsc
(#280)Like
string.split
andstring.splitc
, but more convenient when you don't want to preserve delimiter locations.Documentation here.
-
Debug
instance forCmd
(#268) -
New builtin:
string.splitc
(#277)
- Fixed some pattern match error positions (#273)
2022-10-30
-
Duplicate top-level definitions are no longer allowed (#222)
-
The newline character (
U+000A
) is no longer allowed in string and command literals (#216)
-
Expression interpolation in command literals (#224)
Example:
> `echo ${ string.join "," ["a", "b", "c", "d"] }` `echo a,b,c,d`
-
array.each_
(#211)each_ : Array a -> (a -> IO ()) -> IO ()
-
cmd.eachline_
(#211)eachline_ : Cmd -> (String -> IO ()) -> IO ()
-
Better type errors (#218)
-
In command literals, adjacent expression and string parts are now considered part of the same argument (#215)
Example:
> let a = "one" in . let b = "two" in . `echo $a/$b` `echo one/two`
-
Recursive type class instances now work (#19)
-
Single-line comments can no longer cause parse errors (#188)
2022-08-06
Initial release 🎉