Created
March 12, 2017 02:28
-
-
Save michelrandahl/5126b5d607aae1750bf5a3f2d2dc290b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
-- Attempting to implement my own Maybe monad using the Option type naming from F# | |
data Option x = None | |
| Some x | |
Functor Option where | |
map f None = None | |
map f (Some x) = Some (f x) | |
Applicative Option where | |
pure x = Some x | |
(<*>) f None = None | |
(<*>) None (Some x) = None | |
(<*>) (Some f) (Some x) = Some (f x) | |
Monad Option where | |
(>>=) = ?stuff |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment