# HG changeset patch # User IBBoard # Date 1561907632 -3600 # Node ID 58f9c6e20f0240aee277134dc255b1bdafed8be4 # Parent 85a5e9a6ef5c8583314ac486ea15bab417bd6e7e Add a note about why we have to "Just" the input to our monad diff -r 85a5e9a6ef5c -r 58f9c6e20f02 7-Haskell/day3.hs --- a/7-Haskell/day3.hs Sun Jun 30 16:09:44 2019 +0100 +++ b/7-Haskell/day3.hs Sun Jun 30 16:13:52 2019 +0100 @@ -23,7 +23,8 @@ ] -- 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 []" + -- 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 -- 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