Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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-31 (13:08)
From: Chris King <colanderman@g...>
Subject: Re: [Caml-list] Re: Void type?
On 7/31/07, Richard Jones <> wrote:
> The question is, which void type definition do you use?
>   type void
> or
>   type void = { v: 'a. 'a }

Personally I would use the second.  That way, when you come across a
void value (say, in pattern matching a variant), you can take care of
that match case without resorting to "assert false" (whether directly
or via void_elim):

type t = A of int | B of void

match foo with
| A i -> print_int i
| B v -> v.v

It makes me feel all warm & fuzzy inside that one doesn't have to
resort to "assert false" here :)