4 ms·
The "About" page that you linked has the code x = head xs //x is Some 1 which suggests 'head' is of type 'a -> Option a' and does not have the wart you ar
by tome 12y ago
The "About" page that you linked has the code
x = head xs //x is Some 1
which suggests 'head' is of type 'a -> Option a' and does not have the wart you are talking about.
- tel 12y agoThe example is a bit misleading there. To be more clear using types there's xs :: [Maybe Int] head xs :: Maybe Int
- tome 12y agoOh yeah, silly me!
- JadeNB 12y agoAs tel mentioned (https://news.ycombinator.com/item?id=9556393 https://news.ycombinator.com/item?id=9556393), this strange choice of list is why I said that combining `head` with an explicit (and, I think, misleading) use of the `Option` monad seemed like teasing.
- tome 12y agoYou're right. I wasn't looking as carefully as you were. Sorry!