On Fri, Jul 31, 2015 at 3:18 PM, Ashish Agarwal <agarwal1975@gmail.com> wrote:
You essentially still have 2 constructors, so this isn't quite what I'm aiming for.On Fri, Jul 31, 2015 at 9:57 AM, Carl Eastlund <ceastlund@janestreet.com> wrote:Perhaps like this? (Caveat: I typed this straight into gmail, I haven't tried to compile or run this code at all.)type ('a, 'b, 'c) tag =| Tag1 : ('a, int, int) tag| Tag2 : ('a, string, 'a) tagtype 'a t =| Foo : ('a, 'b, 'c) tag * 'a * 'b -> 'c t--On Fri, Jul 31, 2015 at 9:48 AM, Ashish Agarwal <agarwal1975@gmail.com> wrote:I have:type _ t =| Foo1 : 'a * int -> int t| Foo2 : 'a * string -> 'a tbut I really want to merge these two cases. I want the return type to be based on the second arg when the second arg is int, and be based on the first arg otherwise. Any way to accomplish that?Carl Eastlund