From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id VAA04803; Tue, 11 Sep 2001 21:17:00 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id VAA04638 for ; Tue, 11 Sep 2001 21:16:59 +0200 (MET DST) Received: from shell5.ba.best.com (shell5.ba.best.com [206.184.139.136]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f8BJGwL11736 for ; Tue, 11 Sep 2001 21:16:58 +0200 (MET DST) Received: from localhost (bpr@localhost) by shell5.ba.best.com (8.9.3/8.9.2/best.sh) with ESMTP id MAA28596; Tue, 11 Sep 2001 12:16:57 -0700 (PDT) Date: Tue, 11 Sep 2001 12:16:57 -0700 (PDT) From: Brian Rogoff To: cc: The Caml Trade Subject: Re: [Caml-list] Re: Phantom types (very long) In-Reply-To: <25775F60-A6E4-11D5-9E93-000502DB38F5@mac.com> Message-ID: <20010911120100.F11489-100000@shell5.ba.best.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Tue, 11 Sep 2001, j h woodyatt wrote: > So okay... I take it back. Caml *does* have invariants. (I'm > learning. Slowly. But I'm learning.) > > This "phantom types" design pattern is one I have never seen before. I remember reading J. Vouillon's post a long time ago and thinking "Man, that's weird, having that type parameter not show up on the right hand side of the type definition!" But it wasn't until Blume's post on the ML ng that I got a name for the concept "phantom" and "witness" types. Do a Google search on "phantom type" and you'll turn up a few Haskell paper's, most notably tsome ones on connecting Haskell to Microsoft COM, and some on domain specific languages. > 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). It's always a good idea to have thin (low level bindings) available. You can build your abstractions on top of them, but to do otherwise is an abstraction inversion. > Are there any other mind-blowingly elegant design patterns lurking in > the corners of the Caml type inference engine that I should know about? Yes! And there there will be even more when we get polymorphic recursion and generics ;-) -- Brian PS: Yeah, I'll post some more soon assuming I don't get blown up. Many tricks involve simulating dependent types so if you look up dependent types that'll get you started. In particular try to understand Danvy's "Functional Unparsing"" paper. ------------------- 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