Multiline Repl problem

Hello, I started learning Elm, but I am stuck at doing multiline in elm-repl .

Test example:

> functionExamp a1 a2 = a1 ++ a2
<function> : appendable -> appendable -> appendable
"Joe" |> functionExamp "Hello "
"Hello joe" : String

Totally works. But if I try to do it multiline, I get an (unhelpful) error:

> functionExamp a1 a2 = a1 ++ a2
<function> : appendable -> appendable -> appendable
"Joe" \ 
 |> functionExamp "Hello "
 |
-- SYNTAX PROBLEM --------------------------------------------------------- REPL

I got stuck here:

5|   "joe" \ 
           ^
Whatever I am running into is confusing me a lot! Normally I can give fairly
specific hints, but something is really tripping me up this time.

.

Also maybe it helps to know what changed in 0.19.1:

  • More intuitive multiline declarations in REPL

I Hope somebody can hint me in the right direction.

Making it a function without argument helps

  1. Type x = and press enter
  2. Type "Joe" and press enter
  3. Type |> functionExamp "Hello " and press enter
  4. Press enter

final output

> functionExamp a1 a2 = a1 ++ a2
<function> : appendable -> appendable -> appendable
> x = 
|   "Joe"
|   |> functionExamp "Hello "
|   
"Hello Joe" : String
> 
1 Like

Hi, thanks for your solution. Do you have a source for this info? I can’t find this in the documentation.

I noticed multiline worked like that repl for functions on https://guide.elm-lang.org/core_language.html I’m not sure it is documented

I would love to see an improvement in the multi-line repl usage in Elm.

When you have large chunks of code, you have to try copying and pasting it into the repl because the alternative is pressing the up-arrow ~1000 times.

If we could press the up-arrow and get the entire block of code that was just run, it’d be really awesome!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.