Browse thread
Fine-grained types with more general library
-
Dawid Toton
-
Edgar Friendly
- Bünzli_Daniel
- Dawid Toton
- David Teller
-
Edgar Friendly
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Dawid Toton <d0@w...> |
| Subject: | Re: [Caml-list] Fine-grained types with more general library |
> type 'a path = string list > type remote_t = `Remote path > type local_t = `Local path > > val works_on_remote_t : [> `Remote] path -> whatever > val works_on_local_t : [> `Local] path -> whatever > val works_on_any_t : 'a path -> whatever > > See the following URL for more details on this trick (called Phantom Types): > http://caml.inria.fr/pub/ml-archives/caml-list/2001/09/081c77179ee2a3787233902a51633122.en.html > > Thank you all for immediate responses! After playing with toplevel I managed to get the correct syntax: type 'a path = string list type remote_t = [`Remote] path type local_t = [`Local] path This seems as yet to be very good solution.:) Dawid