elm-lang / elm-repl

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

Can't define new operators in REPL #142

Open jasalo opened 7 years ago

jasalo commented 7 years ago

I'm trying to build a new simple dummy operator such as:

(**) x y = x ^ y

And I've tried with different symbols, but it's always giving me this error:

-- SYNTAX PROBLEM -------------------------------------------- repl-temp-000.elm

I ran into something unexpected when parsing your code!

4|   **
     ^
I am looking for one of the following things:

    an expression
    whitespace

I've also tried with the very example from the [Elm Syntax]() documentation page and it doesn't work:

(?) : Maybe a -> a -> a
(?) maybe default =
  Maybe.withDefault default maybe

Is there a reason why defining new operators on the REPL is currently not possible?

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.

jinjor commented 7 years ago

+1. I need this too, for explaining grammar.

Your link above is wrong. Fix => http://elm-lang.org/docs/syntax.