elm-lang / elm-repl

A REPL for Elm
BSD 3-Clause "New" or "Revised" License
170 stars 34 forks source link

Can't paste multi-line code into REPL #141

Open ghost opened 7 years ago

ghost commented 7 years ago

I'd like to copy and paste this code into the REPL:

narrowDown input output functions =
  let
    tester input output function =
      -- (function input) == output
      function input == output
  in
    List.filter (tester input output) functions

But when I do each line is executed individually so there are lots of syntax errors.

process-bot commented 7 years ago

Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.

kkruups commented 7 years ago

Hi Will,

You need to add backslash, \ , at the end of each line, except the last line, then hit enter, in order to be able to add multi-lines all at once.

Is that what your doing?

You should be able to copy and paste the code as is below and then just hit enter to allow multi-lines in elm-repl. Let me know if this works for you.

narrowDown input output functions =\
  let\
    tester input output function =\
      -- (function input) == output\
      function input == output\
  in\
    List.filter (tester input output) functions
ghost commented 7 years ago

Sorry, I should have said I know about the backslashes! At least without a tool, it's a chore to have to do that.

pzp1997 commented 6 years ago

For reference, the main Haskell REPL, ghci, handles multiline input like so

  1. Begin a new line with :{
  2. Type in your code. Press enter when you need a new line.
  3. Type :} to end the multi-line input.

Source: https://en.wikibooks.org/wiki/Haskell/Using_GHCi_effectively#Multi-line_Input

setrar commented 6 years ago

For reference, the main Scala REPL, handles multiline input like so


   1. Begin a new line with :paste
   2. Type in your code (or paste). Press enter when you need a new line.
   3. Type ^D to end the multi-line input.

Source: https://www.scala-lang.org/old/node/10571.html