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] opaque polymorphism
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-09-12 (09:32)
From: Daan Leijen <daan@c...>
Subject: Re: [Caml-list] Re: Phantom types (very long)
On Tue, 11 Sep 2001, j h woodyatt wrote:
> This "phantom types" design pattern is one I have never seen before.  It
> doesn't seem to be used in the standard library anywhere I can see.  It
> looks like it might be useful in presenting a safer network programming
> interface than the low-level wrappers around BSD sockets (which I've
> never liked).

We used phantom types extensively  for exactly this purpose -- a typed
wrapper around a low-level interface. It seems that the trick has been in
already in the 80's for ML libraries that accessed sockets (allthough it
had a sexy name in that time). We tried to describe the general use pattern
in detail in the paper "domain specific embedded compilers" which can be
found at:


We also used phantom types to encode single type inheritance for the
H/direct frame work (described in "calling hell from heaven and heaven from

All the best,
    Daan Leijen.

Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr