# HG changeset patch # User IBBoard # Date 1561906233 -3600 # Node ID f548c8460d154274ac256c096b277869e737fc6c # Parent 83b4f23b9df8342b9f4e01d9ce79d0225d802469 Add extra note about monadic-ness diff -r 83b4f23b9df8 -r f548c8460d15 7-Haskell/day3.hs --- a/7-Haskell/day3.hs Sun Jun 30 15:10:23 2019 +0100 +++ b/7-Haskell/day3.hs Sun Jun 30 15:50:33 2019 +0100 @@ -25,6 +25,7 @@ -- Note 2: The input value has to be a "Just x" otherwise we can "Couldn't match type 'Maybe' with []" -- 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 ht_lookup :: String -> [(String, a)] -> Maybe a ht_lookup _ [] = Nothing ht_lookup search_key ((key, value):tail)