From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id OAA23480; Tue, 24 Jun 2003 14:45:41 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id OAA23139 for ; Tue, 24 Jun 2003 14:45:40 +0200 (MET DST) Received: from mail3.tpgi.com.au (mail.tpgi.com.au [203.12.160.59]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h5OCjbP22940 for ; Tue, 24 Jun 2003 14:45:38 +0200 (MET DST) Received: from ozemail.com.au (203-213-82-135-syd-ts14-2600.tpgi.com.au [203.213.82.135]) (authenticated (0 bits)) by mail3.tpgi.com.au (8.11.6/8.11.6) with ESMTP id h5OCjTv01052; Tue, 24 Jun 2003 22:45:30 +1000 Message-ID: <3EF847E2.1010501@ozemail.com.au> Date: Tue, 24 Jun 2003 22:45:22 +1000 From: John Max Skaller User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.2.1) Gecko/20010901 X-Accept-Language: en-us MIME-Version: 1.0 To: Jacques Carette CC: caml-list@inria.fr Subject: Re: [Caml-list] First order compile time functorial polymorphism in Ocaml References: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; ozemail:01 caml-list:01 functorial:01 jacques:01 reuse:01 partition:01 toxteth:01 glebe:01 2037,:01 9660:01 0850:01 ocaml:01 variants:01 nsw:01 polymorphic:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Jacques Carette wrote: > I most certainly would welcome such a set of tools for reuse. > would welcome any and all criticisms of it [the code works and is > useful, but is doubtless a horrible hack]. Curious: how useful? How many times did you reuse it? Its a hack yes, looks ugly :( Perhaps can do better with polymorphic variants. Ugly separating the filter for the special actions from those actions: let filt = function | Mlist _ | Mseq _ -> true | _ -> false and do_something = function | Mlist x -> List.map Simpl.flatten x | Mseq x -> List.map Simpl.flatten2 x | _ -> raise CannotHappenButCompilerCantKnowIt ;; Uggh. Like to be writing something like | `Mlist args -> .. | `Mseq args -> .. | _ -> .. or perhaps | #usual_case -> instead of the last line if there happens to be a type partition matching the requirements. -- John Max Skaller, mailto:skaller@ozemail.com.au snail:10/1 Toxteth Rd, Glebe, NSW 2037, Australia. voice:61-2-9660-0850 ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners