changeset 99:67631cb2ea48

Expand the last note on getting into the monad state
author IBBoard <dev@ibboard.co.uk>
date Sun, 30 Jun 2019 16:15:33 +0100
parents 58f9c6e20f02
children 830140560f70
files 7-Haskell/day3.hs
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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 <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