Browse thread
[Caml-list] First order compile time functorial polymorphism in Ocaml
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | John Max Skaller <skaller@o...> |
| Subject: | Re: [Caml-list] First order compile time functorial polymorphism in Ocaml |
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