* ]Caml-list] Types
@ 2005-06-19 6:42 Jonathan Roewen
2005-06-19 7:09 ` [Caml-list] " Michael Wohlwend
2005-06-19 15:37 ` Eric Cooper
0 siblings, 2 replies; 4+ messages in thread
From: Jonathan Roewen @ 2005-06-19 6:42 UTC (permalink / raw)
To: caml-list
Hi,
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.
Jon
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Caml-list] ]Caml-list] Types
2005-06-19 6:42 ]Caml-list] Types Jonathan Roewen
@ 2005-06-19 7:09 ` Michael Wohlwend
2005-06-19 15:37 ` Eric Cooper
1 sibling, 0 replies; 4+ messages in thread
From: Michael Wohlwend @ 2005-06-19 7:09 UTC (permalink / raw)
To: caml-list
On Sunday 19 June 2005 08:42, Jonathan Roewen wrote:
> Hi,
>
> 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.
how about:
type 'a rect = { mutable x1:'a }
cheers
Michael
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Caml-list] ]Caml-list] Types
2005-06-19 6:42 ]Caml-list] Types Jonathan Roewen
2005-06-19 7:09 ` [Caml-list] " Michael Wohlwend
@ 2005-06-19 15:37 ` Eric Cooper
2005-06-19 18:09 ` padiolea
1 sibling, 1 reply; 4+ messages in thread
From: Eric Cooper @ 2005-06-19 15:37 UTC (permalink / raw)
To: caml-list
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] }
--
Eric Cooper e c c @ c m u . e d u
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Caml-list] ]Caml-list] Types
2005-06-19 15:37 ` Eric Cooper
@ 2005-06-19 18:09 ` padiolea
0 siblings, 0 replies; 4+ messages in thread
From: padiolea @ 2005-06-19 18:09 UTC (permalink / raw)
To: Eric Cooper; +Cc: caml-list
> 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
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-06-19 18:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-19 6:42 ]Caml-list] Types Jonathan Roewen
2005-06-19 7:09 ` [Caml-list] " Michael Wohlwend
2005-06-19 15:37 ` Eric Cooper
2005-06-19 18:09 ` padiolea
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox