Last active
July 24, 2016 23:04
-
-
Save ClaireNeveu/f10439c97a2a7c537db6d65f4bdcc2da to your computer and use it in GitHub Desktop.
Defining Categories with Structural Types
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
type 'a monad = { bind : 'b. ('a -> 'b monad) -> 'b monad } | |
type 'a option = { getOrElse : 'a -> 'a } | |
let none = { getOrElse = (fun b -> b); bind = fun f -> none};; | |
let some a = { getOrElse = (fun b -> a); bind = fun f -> f a};; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think I'll need to build a language with Equirecursive types in order to try this out.