A REPL for Elm
Haskell
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

README.md

Elm REPL Build Status

This tool lets you interact with values and functions directly.

Install

Install Elm Platform to get elm-repl. Then make sure you have node.js installed because it is needed to evaluate the generated JS.

Use

You can type in expressions, definitions, union types, and module imports using normal Elm syntax.

> 1 + 1
2 : number

> "hello" ++ "world"
"helloworld" : String

The same can be done with definitions and union types:

> 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

> type Either a b = Left a | Right b

> case Left 32 of \
|   Left n -> 2 * n \
|   Right m -> m + 1
64 : 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

You can import your modules too, so if you create a module named MyThing in your project, you can say import MyThing in the REPL and get access to all the values it exposes.