# HG changeset patch # User IBBoard # Date 1561907733 -3600 # Node ID 67631cb2ea48fdf56f8a83ec5a212aa035f42fdf # Parent 58f9c6e20f0240aee277134dc255b1bdafed8be4 Expand the last note on getting into the monad state diff -r 58f9c6e20f02 -r 67631cb2ea48 7-Haskell/day3.hs --- a/7-Haskell/day3.hs Sun Jun 30 16:13:52 2019 +0100 +++ b/7-Haskell/day3.hs Sun Jun 30 16:15:33 2019 +0100 @@ -24,7 +24,7 @@ -- Note: We've got to put the key first so that we can call it in-fix and supply the search key -- Note 2: The input value has to be a "Just x" otherwise we can "Couldn't match type 'Maybe' with []" - this appears to be to start the Maybe monad situation - -- because "ht_lookup "Phonetic" hashtable" works fine + -- because "ht_lookup "Phonetic" hashtable" works fine. If we didn't want to "Just" it then we can start with "ht_lookup "Phonetic" hashtable >>= …" -- Note 3: I can't get anything out of this other than "Just ", even if I include ">>= return" -- Example usage: Just hashtable >>= ht_lookup "Phonetic" >>= ht_lookup "Greek" >>= ht_lookup "alpha" -- This is monadic because "Just hashtable >>= ht_lookup "Phonetic" >>= ht_lookup "foo" >>= ht_lookup "alpha" >>= return" doesn't explode but returns Nothing