on master help sign in
Remove some stuff about the REPL that isn't helpful really
commita1525aaf11126d1ebdb77a39f7de6a6184a3387e authorEvan Czaplicki <evancz@users.noreply.github.com> dateThu 16 Aug 2018, 16:11 (8 years ago) parent698d67d
1 file changed−66
docs/repl.md−66
docs/repl.mddeleted−66
@@ -1,66 +0,0 @@
1−# `elm repl`
2−
3−The REPL lets you interact with Elm values and functions in your terminal.
4−
5−<br>
6−
7−## Install
8−
9−You need [Elm][install] and [node.js][node] for the REPL. Elm generates JavaScript and we currently use node.js to evaluate it!
10−
11−[install]: https://guide.elm-lang.org/install.html
12−[node]: https://nodejs.org/en/download/
13−
14−<br>
15−
16−## Use
17−
18−You can type in expressions, definitions, union types, and module imports using normal Elm syntax.
19−
20−```elm
21−> 1 + 1
22−2 : number
23−
24−> "hello" ++ "world"
25−"helloworld" : String
26−```
27−
28−The same can be done with definitions and union types:
29−
30−```elm
31−> fortyTwo = 42
32−42 : number
33−
34−> increment n = n + 1
35−<function> : number -> number
36−
37−> increment 41
38−42 : number
39−
40−> factorial n = if n < 1 then 1 else n * factorial (n-1)
41−<function> : number -> number
42−
43−> factorial 5
44−120 : number
45−
46−> type Either a b = Left a | Right b
47−
48−> case Left 32 of \
49−| Left n -> 2 * n \
50−| Right m -> m + 1
51−64 : number
52−```
53−
54−When you run `elm repl` in a project with an `elm.json` file, you can import any module available in the project:
55−
56−```elm
57−> import String
58−
59−> String.length "hello"
60−5 : Int
61−
62−> String.reverse "flow"
63−"wolf" : String
64−```
65−
66−Core modules, package modules, your modules. Whatever is available! So if you create a module named `MyThing` in your project, you can say `import MyThing` in the REPL and mess with anything it exposes.