Version française
Home     About     Download     Resources     Contact us    
Browse thread
]Caml-list] Types
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: padiolea@i...
Subject: Re: [Caml-list] ]Caml-list] Types
> On Sun, Jun 19, 2005 at 06:42:01PM +1200, Jonathan Roewen wrote:
>> Is it possible to create a record type that has a member which is a
>> polymorphic type?
>>
>> I tried: type rect = { mutable x1: 'a; ... } but that doesn't work.
>> Also, type a = A of 'a doesn't seem to work either.
>
> type t = { f : 'a . 'a -> 'a list }
>
> let x = { f = fun x -> [x] }
>
> let y = { f = fun x -> [x;x] }


why not simply
type 'a rect = { mutable x1 = 'a; .... }


>
> --
> Eric Cooper             e c c @ c m u . e d u
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>