[Ur] Polymorphic variants and JSON

Edward Z. Yang ezyang at MIT.EDU
Sat Apr 14 18:23:06 EDT 2012


Excerpts from Edward Z. Yang's message of Sat Apr 14 18:18:15 -0400 2012:
> map2 is useful.  With it, I get here:
> 
>     {ToJson = fn r => let val jsts = @map2 [json] [fn _ => string] [fn x => json x * string]
>                                      (fn [t] (js : json t) (t : string) => (js, t)) fl jss names
>                       in @Variant.destrR [ident] [fn x => json x * string]
>                           (fn [p] (v : p) (js : json p, t : string) => "something") fl r jsts
>                       end
> 
> I can't get this to unify: [snip]

Nevermind, I figured it out:

    (fn [p :: Type] (v : p) (js : json p, t : string) => "something") fl r jsts

Did I get bit by the implicitness rules? Hmm!

Edward



More information about the Ur mailing list