Skip to content

Instantly share code, notes, and snippets.

@bond15
Created November 13, 2020 21:11
Show Gist options
  • Save bond15/4fe90162bacf4c54817e207c0e45e67a to your computer and use it in GitHub Desktop.
Save bond15/4fe90162bacf4c54817e207c0e45e67a to your computer and use it in GitHub Desktop.
data Maybe a = None | Some a
class Monad f where
return :: a -> f a
bind :: f a -> (a -> f b) -> f b
instance Monad Maybe where
return x = Some x
bind None f = None
bind (Some x) f = f x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment