Hacker News new | ask | show | jobs
by gottlobflegel 1313 days ago
> This is realllly unidiomatic in real world Haskell.

Yet it is the actual behaviour in the stdlib Prelude.

3 comments

Yes. Because it's hard to remove things from the stdlib. More languages suffer from that.

What's nice is that the Haskell community offers several alternative Preludes; mostly fixing the problem you describe.

Hence I find the example a bit disingenuous.

Yep. I think it is needed to satisfy some category theory thing but I never got a good answer on that. I like to use nri-prelude since I went from Elm to Haskell and it has the same idioms, to wit `head : List a -> Maybe a`.
From GHC 9.6 there will be a warning against using head or tail. We don't actually want to remove them (yet) since that would break a lot of code.