Skip to content

Instantly share code, notes, and snippets.

@t0yv0
Created February 16, 2011 08:52
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