[Haskell-beginners] runState (liftM (+100) pop) [1, 2, 3, 4] (Example from LYH)
50295 at web.de
Tue Oct 24 09:17:46 UTC 2017
Apologies for the awkward question title -- its the best I can do ATM.
I'm still working my way through chapter 13 of LYH (title for a few
monads more) and I came across the following two beasts
ghci> runState (liftM (+100) pop) [1,2,3,4]
ghci> runState (fmap (+100) pop) [1,2,3,4]
Even though I'm still struggling to wrap my mind around monads, I sort
of understand what's going on here. The problem is that I can't explain
why the function (+100) is applied to _only_ the value 1 in (1,[2,3,4]).
More information about the Beginners