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: Eric Cooper <ecc@c...>
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] }

-- 
Eric Cooper             e c c @ c m u . e d u