Skip to content
This repository has been archived by the owner on Aug 23, 2018. It is now read-only.

Function signature #86

Open
flip111 opened this issue Oct 31, 2015 · 10 comments
Open

Function signature #86

flip111 opened this issue Oct 31, 2015 · 10 comments

Comments

@flip111
Copy link

flip111 commented Oct 31, 2015

I'm pretty much forwarding this ... but i get asked frequently if the repl supports function signatures. I think it might be useful when starting out with elm and quickly trying stuff with types.

@igrep
Copy link

igrep commented Nov 2, 2015

(Sorry if this question should be answered in elm-discuss.)

You mean you want to know the signature from elm-repl?

$ elm-repl
Elm REPL 0.4.2 (Elm Platform 0.15.1)
  See usage examples at <https://github.com/elm-lang/elm-repl>
  Type :help for help, :exit to exit
> identity
<function> : a -> a
> (<|)
<function> : (a -> b) -> a -> b
> (+)
<function> : number -> number -> number

Just typing the name of function works.

@flip111
Copy link
Author

flip111 commented Nov 2, 2015

no i mean to define a new function and giving a type signature along with it

@sjfloat
Copy link

sjfloat commented Mar 17, 2016

+1 I keep forgetting I can't do that.

@wjdhamilton
Copy link

👍 This would be helpful since you can't follow the tutorials in the repl without this functionality

@RyanCCollins
Copy link

RyanCCollins commented Nov 13, 2016

I also ran into this and was a bit thrown off when following the online tutorials. Just thought I would mention it. Many thanks!

@FernandoBasso
Copy link

FernandoBasso commented Jul 25, 2017

It says here:

In the Core Language section of this book, we ran a bunch of code in the REPL. Well, we are going to do it again, but now with an emphasis on the types that are getting spit out. So type elm repl in your terminal again.

Okay, it doesn't say you can write type annotations in the repl, but it is still a bit misleading. I, for one, thought I would use the repl for the entire code on that page (or would expect different instructions on how to run code from a file, or a link to those instructions).

Edit: Just found this faq entry.

@craigmaloney
Copy link

It seems like the error message is almost there (it detects that you're doing a type annotation) but it doesn't tell you why it's an error (You're attempting to do type annotations in the REPL, which are unsupported).

I'm just learning the language as well, and it seems like type annotations should be something that can be played with in the REPL. Even Try Elm has some support for them (but alas, it's not as nice as the REPL for on-the-go toy code).

@hsribei
Copy link

hsribei commented Oct 6, 2017

Is there a plan to support type annotations in the repl? I got here from #113. I was searching for the error described there after trying to send some code from an emacs buffer to the repl via elm-mode by selecting it and typing C-c C-p. Allowing type annotations would make this interaction between editing files and interactive testing in the repl a lot smoother.

@shamansir
Copy link

shamansir commented Nov 17, 2017

If you are still searching for type annotations in REPL, now there's an alternative for you: https://github.com/shamansir/ielm supports getting types and values for any kind of expression (except just a few, where it falls back to string representation, which is also not so bad).

screen shot 2017-11-17 at 11 09 13

The complete video with all the current features is here: https://vimeo.com/242822314

P.S. It is usable, but still in early development, so please don't expect anything to work, but as long as there is an issue exists for a found bug, it will very soon be fixed.

@zulrang
Copy link

zulrang commented Mar 16, 2018

I'm also a noob that ran into this problem. If you follow the guide.elm-lang.org word-for-word, you will run into this because you can't actually follow the instructions.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants