Version française
Home     About     Download     Resources     Contact us    
Browse thread
Empty polymorphic variant type
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Till Varoquaux <till.varoquaux@g...>
Subject: Re: [Caml-list] Re: Empty polymorphic variant type
It looks a little nicer but breaks the subtyping: [`None] is not a
subtype of [>`Some [>`Readable]] so you now have to write the
type readonly as: [< `None | `Some of [`Read] ] t if you want it to
unify with [`None].

I'm not sure this is a huge benefit

Till


On Feb 6, 2008 12:33 PM, Bünzli Daniel <daniel.buenzli@erratique.ch> wrote:
>
> Le 6 févr. 08 à 13:24, Till Varoquaux a écrit :
>
> > would work but it seems clunky and convoluted.
>
> Still clunky but what about
>
> type permission_kind = [ `Read | `Write ]
> type 'a account contraint 'a = [< `None | `Some of [<
> permission_kind]];;
>
> Best,
>
> Daniel
>
>



-- 
http://till-varoquaux.blogspot.com/