That error message is easy to understand.
Explaining why a language can't handle print 2 + 3 is priceless.
It seems like an interesting language to learn for the sake of learning but introducing this to a beginner is not fair.
Re:Haskell in Production
by mbrodersen on Friday October 18, 2019 @09:24AM
(#21291142)
> I have taught both Haskell and Java and there is no comparision in difficulty.
Interesting. How much real world experience did you have with both languages before teaching it?
What kind of error would you like to see here instead ?
Re:Haskell in Production
by ppseafield on Thursday October 17, 2019 @08:36PM
(#21287646)
Maybe just one extra line like this?
Prelude> print 2 + 3
<interactive>:3:1: error:
• No instance for (Num (IO ())) arising from a use of ‘+’
• The expression `print 2` :: IO ()
• In the expression: print 2 + 3
In an equation for ‘it’: it = print 2 + 3
Just adding the one line telling telling you what was `IO ()` is helpful. ghci obviously knows what it was here.This suggestion is a straightforward, easy to implement improvement. Many compilers have serious UX problems because their authors don't take UX seriously. Elm and Rust are two languages getting this right.
Re:Haskell in Production
by RussianCow on Thursday October 17, 2019 @07:19PM
(#21287257)
The Rust compiler does a great job of making suggestions for how you can fix your code, which is tremendously helpful for the majority of cases where your mistake was simple. There is no reason (in theory) that GHC can't offer the same level of guidance.
Haskell on the other hand creates crazy errors which confuse students, and often require extensive teaching to understand what is going on.
I'm happy to accept the possibility expert Haskell programs will be more productive in the longer term, but the learning is MUCH harder.
For example, here's one "simple" haskell error:
Prelude> print 2 + 3
<interactive>:9:1: error: • No instance for (Num (IO ())) arising from a use of ‘+’
Now, it's not too hard to figure out what's gone wrong, but when doing beginning learning, explaining what (Num (IO ()))) is isn't something I want to be doing. No Java error gets that complicated.