Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

head of empty list returns a #54

Open
sudarshanchoubey opened this issue Apr 28, 2018 · 3 comments
Open

head of empty list returns a #54

sudarshanchoubey opened this issue Apr 28, 2018 · 3 comments

Comments

@sudarshanchoubey
Copy link

head []
returns a

@Ingo60
Copy link
Member

Ingo60 commented Apr 28, 2018

No, it doesn't.

When the repl finds that it cannot show the result of the expression, it just prints the type instead of the expression.

For example:

frege> []
[a]

If, OTOH it knows how the result can be printed, it actually evaluates the expression:

frege> :t head ([] :: [Int])
Int

frege> head ([] :: [Int])
frege.runtime.Undefined: head []

frege> head [ i | i <- [1..10], i > 50 ]
frege.runtime.Undefined: head []

frege> 

I think this is better to see in the online repl, where there are colors.

@sudarshanchoubey
Copy link
Author

Does a here mean Any?

@Ingo60
Copy link
Member

Ingo60 commented May 2, 2018

Yes, sort of.

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

No branches or pull requests

2 participants