Guessing game: Haskell style

13 points by kqr


Sanity

What a nice Haskell tutorial :-)

I kind of like using do-notation for Maybe as well as IO, but I’m not sure whether it’s more newbie-friendly or less newbie-friendly to do things like

mkSmallInteger i = do
   guard (i>=1 && i<=100)
   pure (SmallInteger i)

readSmallInteger input = do
   i <- readMaybe input
   mkSmallInteger i

vs having to learn $> and >>=

I’m also trying to wean myself off <$> – it’s not that much harder to fmap (foo . bar) (get thing) but I think it may be less off-putting to outsiders.

lucabtz

Very interesting post. I’m trying to learn Haskell in my free time and this was very useful.

The purity of the language for me is the main perk. I think it makes it so interesting and fascinating