"Applicative Monad" exercise
So, Learn You a Haskell makes this comment, in the chapter on Monads ("A Fistful of Monads"),
shortly before introducing the banana
function:
We couldn't have achieved this by just using Maybe as an applicative. If you try it, you'll get stuck, because applicative functors don't allow for the applicative values to interact with each other very much.
But I did it. See my GitHub repository at:
- https://github.com/JohnL4/LearnHaskell/blob/main/ApplicativeMonad.hs
- https://github.com/JohnL4/LearnHaskell/blob/main/ApplicativeMonadSpec.hs
(As of the date of this web page, see below.)
The first file is definitions; the second, application/use/test of said definitions.
I didn't actually even use MMaybe
as an applicative, I don't think. Hmmm.