changeset 98:58f9c6e20f02

Add a note about why we have to "Just" the input to our monad
author IBBoard <dev@ibboard.co.uk>
date Sun, 30 Jun 2019 16:13:52 +0100
parents 85a5e9a6ef5c
children 67631cb2ea48
files 7-Haskell/day3.hs
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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 <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