Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

  do if condition
       then do putStrLn "bailing out early"
               return ()
       else putStrLn "carrying on"
     putStrLn "Launching missiles..."
This does not do what a C/Java/C# programmer would expect.

`return` in Haskell is a false cognate and it causes beginners difficulties. Some of them post to StackOverflow asking confused questions about it.

if-then-else in Haskell is also a false cognate (and there are formatting issues to trip up the unwary as well). It's actually the same as C's/Java's/etc ?: operator, so it's unfortunate the standard library doesn't contain something similar to that instead of adding if-then-else to the language.

Having said all that, I don't think being a false cognate should automatically be a disqualifying attribute. Haskell's new <> operator (a synonym for mappend) looks like Basic's/Pascal's not-equal-to operator. But I think few Haskellers come from that immediate background.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: