Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Type annotations in Elm REPL

I am both an Elm and a functional programming newbie, and never worked with Java seriously. I'm working my way through Elm docs, and playing with the REPL, trying to understand type annotations.

They seem pretty useful things:

type alias Point = { x:Float, y:Float }

origin : Point
origin =
  { x = 0, y = 0 }

and now all your Points are specifically formatted floats! Magic. Love it. Would love to play around with it in the REPL, but the REPL doesn't seem to understand type definitions:

> type alias Point = { x:Float, y:Float }
> origin : Point
-- SYNTAX PROBLEM -------------------------------------------- repl-temp-000.elm

I ran into something unexpected when parsing your code!

7│   origin : Point
            ^
I am looking for one of the following things:

    end of input
    whitespace

Is this a bug in the REPL, or a feature?

like image 563
Dmitri Avatar asked Dec 19 '15 21:12

Dmitri


1 Answers

The elm repl does not currently support type annotations. There's a lot of people asking for this so I'm holding out hope for it soon.

like image 160
Chad Gilbert Avatar answered Oct 20 '22 15:10

Chad Gilbert