This tool lets you interact with values and functions directly.
Install node.js and then run:
cabal update
cabal install elm-repl
This package depends on the latest release of the Elm compiler, so it will install that automatically.
You can type in expressions, definitions, ADTs, and module imports using normal Elm syntax.
> 1 + 1
2 : number
> "hello" ++ "world"
"helloworld" : String
The same can be done with definitions and ADTs:
> fortyTwo = 42
42 : number
> f n = n + 1
<function> : number -> number
> f 41
42 : number
> factorial n = \
| if n < 1 then 1 \
| else n * factorial (n-1)
<function> : number -> number
> factorial 5
120 : number
> data Either a b = Left a | Right b
> case Left 32 of \
| Left n -> 2 * n \
| Right m -> m + 1
4 : number
You can import standard libraries and any library
reachable from the directory where elm-repl
is running:
> import String
> String.length "hello"
5 : Int
> String.reverse "flow"
"wolf" : String