From: Dawid Toton <dawid.toton@uj.edu.pl>
To: Caml List <caml-list@inria.fr>
Subject: Fine-grained types with more general library
Date: Sun, 10 Feb 2008 19:07:26 +0000 [thread overview]
Message-ID: <47AF4B6E.3070306@uj.edu.pl> (raw)
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
next reply other threads:[~2008-02-10 19:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-10 19:07 Dawid Toton [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=47AF4B6E.3070306@uj.edu.pl \
--to=dawid.toton@uj.edu.pl \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox