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
[Caml-list] Some, None and the caml-C interface
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-01-10 (17:17)
From: Xavier Leroy <xavier.leroy@i...>
Subject: Re: [Caml-list] Some, None and the caml-C interface
> I've written some simple macros for accessing options in ocaml, and I
> want to double check that they are actually right.  Does this look
> right?

Yes, it is.

> And is this documented anywhere?

The general representation of sum datatypes is described in section
18.3.4 of the OCaml manual.  If you "instantiate" this description to
the actual definition of type option
        type 'a option = None | Some of 'a
you can derive the macros that you posted.

- Xavier Leroy
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners