changeset 96:f548c8460d15

Add extra note about monadic-ness
author IBBoard <dev@ibboard.co.uk>
date Sun, 30 Jun 2019 15:50:33 +0100
parents 83b4f23b9df8
children 85a5e9a6ef5c
files 7-Haskell/day3.hs
diffstat 1 files changed, 1 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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 <val>", 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)