English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Void type?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-07-29 (11:05)
From: Arnaud Spiwack <aspiwack@l...>
Subject: Re: [Caml-list] Re: Void type?

> What about:
>     # type void = { v: 'a. 'a };;
>     type void = { v : 'a. 'a; }
>     # let rec vv = { v = vv };;
>     This field value has type 'a which is less general than 'b. 'b
Now that's a very nice solution. You give the impredicative coding of 
the void type (forall 'a. 'a) by boxing it into record type.

You get void_elim withouth cheating :
  let void_elim x = x.v

It is the good solution if you work with the original syntax (and it's 
absolutely equivalent to the dual definition in term of empty variant 
which you can write in the revised syntax).

Well spotted.

Arnaud Spiwack