Created
February 16, 2011 08:52
-
-
Save t0yv0/829054 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
| type Box<'T1,'T2> = { Value : obj } | |
| module List = | |
| let Box (list: list<'T>) : Box<list<obj>,'T> = { Value = list } | |
| let Unbox (x: Box<list<obj>,'T>) : list<'T> = x.Value :?> _ | |
| type IFunctor<'T> = | |
| abstract member Map : ('T1 -> 'T2) -> Box<'T,'T1> -> Box<'T,'T2> | |
| let ListFunctor = | |
| { | |
| new IFunctor<list<obj>> with | |
| member this.Map f x = | |
| List.Box << List.map f << List.Unbox <| x | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment