On Thursday 31 May 2007 15:36:13 Al Falloon wrote:
> I bring this up because I have been working on a Scheme compiler in
> Haskell for fun, and something like polymorphic variants would be quite
> convinent to allow you to specify versions of the AST (input ast, after
> closure conversion, after CPS transform, etc.), but allow you to write
> functions that work generically over all the ASTs (getting the free
> vars, pretty printing, etc.).

Although this is the theoretical justification for OCaml's polymorphic 
variants, it is not their most common use.

They are more commonly used to implement overlapping enumerations (see 
LablGL), to avoid sum type declarations with short scope (e.g. [`Some|`None|
`Maybe] inside a single function) and when sum types keep changing during 
development.

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
OCaml for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists/?e
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to