4 ms·
> This is realllly unidiomatic in real world Haskell. Yet it is the actual behaviour in the stdlib Prelude.
by gottlobflegel 4y ago
> This is realllly unidiomatic in real world Haskell.
Yet it is the actual behaviour in the stdlib Prelude.
- 1-more 4y agoYep. 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`.
- cies 4y agoYes. 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.
- tome 4y agoFrom 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.