Version française
Home     About     Download     Resources     Contact us    
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 Garrigue <garrigue@k...>
Subject: Re: [Caml-list] First order compile time functorial polymorphism in Ocaml
From: "Jacques Carette" <carette@mcmaster.ca>

> > 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 ?

I know this is a bit confusing, but this is the pattern case expansion
of polymorphic variants (the above is a pattern-matching, not a type),
and this is not obsolete.
The notatation is obsolete in types, as [< usual_case] is more
symmetric with [> usual_case]. By the way,
  fun #usual_case as x -> x
has type
  [< usual_case] -> [> usual_case]

But honestly, if you have no particular need to cut your type in small
pieces (you need it for incremental extension for instance), you're
better off with sum types, and the safe approach I presented in my
previous mail.

Jacques

-------------------
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