From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 77BC0BC6B for ; Sun, 10 Feb 2008 20:07:37 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAJrarkfAXQImh2dsb2JhbACQOwEBAQgKKZU6 X-IronPort-AV: E=Sophos;i="4.25,330,1199660400"; d="scan'208";a="22448282" Received: from discorde.inria.fr ([192.93.2.38]) by mail4-smtp-sop.national.inria.fr with ESMTP; 10 Feb 2008 20:07:37 +0100 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id m1AJ7VUC016131 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Sun, 10 Feb 2008 20:07:37 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAACfarkeVnFluh2dsb2JhbACQOwEBAQgKKZU1 X-IronPort-AV: E=Sophos;i="4.25,330,1199660400"; d="scan'208";a="7875426" Received: from spica.uoks.uj.edu.pl (HELO mail.uj.edu.pl) ([149.156.89.110]) by mail1-smtp-roc.national.inria.fr with ESMTP; 10 Feb 2008 20:07:32 +0100 Received: from [137.73.5.196] by mail.uj.edu.pl (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with ESMTPA id <0JW100HQAEGELF00@mail.uj.edu.pl> for caml-list@inria.fr; Sun, 10 Feb 2008 20:07:27 +0100 (CET) Date: Sun, 10 Feb 2008 19:07:26 +0000 From: Dawid Toton Subject: Fine-grained types with more general library To: Caml List Message-id: <47AF4B6E.3070306@uj.edu.pl> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7BIT User-Agent: Thunderbird 1.5.0.12 (X11/20071219) X-Miltered: at discorde with ID 47AF4B73.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; fine-grained:01 functions:01 string:02 library:03 library:03 types:05 types:05 enforce:05 problem:05 problem:05 paths:05 paths:05 i'd:06 path:07 path:07 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