Last active
December 6, 2023 19:27
-
-
Save benjaminweb/bcaccecbdde765e05360a452c3d5a074 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- (as mnemonics : `a :: a' and `amb :: a -> m b') | |
-- left identity | |
return a >>= amb = amb a | |
MkMaybeeState (\z -> (Just x, z)) >>= amb = MkMaybeeState $ \s0 -> case (\z -> (Just (a, z))) s0 of | |
(Just a, s1) -> let MkMaybeeState f' = amb a in f' s1 | |
(Nothing, s1) -> (Nothing, s1) | |
MkMaybeeState (\z -> (Just x, z)) >>= amb = MkMaybeeState $ \s0 -> case (return a) s0 of | |
(Just a, s1) -> let MkMaybeeState f' = amb a in f' s1 | |
(Nothing, s1) -> (Nothing, s1) | |
MkMaybeeState (\z -> (Just x, z)) >>= amb = MkMaybeeState $ \s0 -> case (return a) s0 of | |
(Just a, s1) -> let MkMaybeeState f' = MkMaybeeState (\z -> (Just x, z)) in f' s1 | |
(Nothing, s1) -> (Nothing, s1) | |
MkMaybeeState (\z -> (Just x, z)) >>= amb = MkMaybeeState $ \s0 -> case (return a) s0 of | |
(Just a, s1) -> (\z -> (Just x, z)) s1 | |
(Nothing, s1) -> (Nothing, s1) | |
MkMaybeeState (\z -> (Just x, z)) >>= amb = MkMaybeeState $ \s0 -> case (return a) s0 of | |
(Just a, s1) -> (Just x, s1) | |
(Nothing, s1) -> (Nothing, s1) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment