Skip to content

Instantly share code, notes, and snippets.

@zaki50
Created November 17, 2012 05:55
Show Gist options
  • Save zaki50/4093664 to your computer and use it in GitHub Desktop.
Save zaki50/4093664 to your computer and use it in GitHub Desktop.
おれおれMaybe
data MyMaybe a = MyJust a | MyNothing
instance Monad MyMaybe where
-- (>>=) :: (MyMaybe a) -> (a -> MyMaybe b) -> MyMaybe b
-- return :: a -> MyMaybe a
(>>=) MyNothing _ = MyNothing
(>>=) (MyJust x) f = f x
return = MyJust
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment