Version française
Home     About     Download     Resources     Contact us    
Browse thread
Fine-grained types with more general library
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: David Teller <David.Teller@u...>
Subject: Re: [Caml-list] Fine-grained types with more general library
I'm not sure I understand the question. Still, if you haven't used
phantom types yet, it sounds like the right thing to do:
 type 'a path = string list
 type remote_t = Remote path
 type local_t  = Local path

Now, you can write things such as

val print_local : Local path  -> unit  (*only works on local paths*)
val print_remote: Remote path -> unit  (*only works on remote paths*)
val print_any   : 'a path     -> unit  (*works with either*)

Does this help you ?

Cheers,
 David

-- 
David Teller
 Security of Distributed Systems
  http://www.univ-orleans.fr/lifo/Members/David.Teller
 Angry researcher: French Universities need reforms, but the LRU act
brings liquidations.