caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Fine-grained types with more general library
@ 2008-02-10 19:07 Dawid Toton
  2008-02-10 19:15 ` [Caml-list] " Edgar Friendly
  2008-02-10 19:22 ` David Teller
  0 siblings, 2 replies; 5+ messages in thread
From: Dawid Toton @ 2008-02-10 19:07 UTC (permalink / raw)
  To: Caml List

I have a type (e.g. of path to file)

type path = string list

 and many operations (e.g. path manipulation). Then I need to have two 
kinds of paths (e.g. local and remote) and want type system to enforce 
proper usage (some functions act on remote paths only etc.). So I create 
new two types:

type remote_t = Remote path
type local_t = Local path

Then I avoid using type path for greater safety. But I have a problem: 
can't use path manipulation library on these new types. I have created 
"mirror" versions of the library for each new type, but this made my 
source code unmaintainable. What is the right solution?

I'd prefer not to contaminate the path library with things specific to 
this particular problem, since it's reused.

Dawid


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-02-10 19:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-10 19:07 Fine-grained types with more general library Dawid Toton
2008-02-10 19:15 ` [Caml-list] " Edgar Friendly
2008-02-10 19:20   ` Bünzli Daniel
2008-02-10 19:56   ` Dawid Toton
2008-02-10 19:22 ` David Teller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).