Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] First order compile time functorial polymorphism in Ocaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jacques Carette <carette@m...>
Subject: Re: [Caml-list] First order compile time functorial polymorphism in Ocaml
John Max Skaller <> wrote:
> Jacques Carette wrote:
> Curious: how useful? How many times did you reuse it?

I've used generic_traverse in a dozen places, and will likely use it more often.

> Its a hack yes, looks ugly :(

Oh, fully agreed!  The point of posting it was to get some constructive criticism in the hopes of being able to do 

> Perhaps can do better with polymorphic variants.

My first prototype (which got wiped out in some disk crash) did use polymorphic variants.  I decide to not use them 
again to see if I really needed them.  And perhaps I do.

> Ugly separating the filter
> for the special actions from those actions:

Very much so, but I found the combined filter/action routines even harder to read, with more code duplication than I 
could swallow!!  So I used this 2-stage approach.

> Uggh. Like to be writing something like
> 	| `Mlist args -> ..
> 	| `Mseq args -> ..
> 	| _ -> ..

I will re-explore this.

> or perhaps
> 	| #usual_case ->
> instead of the last line if there happens to be
> a type partition matching the requirements.

I read about #types in the Ocaml manual.  Are you referring to using classes or the (documented obsolete) expansion of 
variant types ?

Even though  S. Boulmé, Th. Hardin, and R. Rioboo in
"Polymorphic Data Types, Objects, Modules and Functors: is it too much ?" (see argue quite cogently about the use of the full power of Ocaml for doing 
mathematics [my real goal], I was hoping that for writing a language interpreter I did not need to go that far.


To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: