Hi,

On Thu, Jan 15, 2009 at 3:35 PM, Dario Teixeira <darioteixe...@yahoo.com> wrote:
> Note that type-conv still chokes on some type definitions.
> For example:
>
> type wrapper_order_t = (Order.ordinal_t as 'a, [ 'a Order.auto_given_t | 
> Order.user_given_t ]) Order.t with sexp
>
> Produces a "type_is_recursive: unknown type construct".  If the
> alias is expanded it compiles fine though:
>
> type wrapper_order_t = (Order.ordinal_t, [ Order.ordinal_t Order.auto_given_t 
> | Order.user_given_t ]) Order.t with sexp

I guess I'll just pass on that one.  It seems like too much work,
especially since there is a trivial workaround, and almost nobody ever
uses this somewhat obscure feature.  I'd have to keep track of free
variables within the whole type definition, possibly even by having to
consider unification, to fully support this and substitute appropriate
conversion functions.

If you want to save yourself some typing effort for entering large
shared types within a definition, just use an intermediate polymorphic
type, e.g.:

  type 'a mk_wrapper_order_t = ('a, [ 'a Order.auto_given_t |
Order.user_given_t ]) Order.t with sexp
  type wrapper_order_t = Order.ordinal_t mk_wrapper_order_t

Then the compiler will do the heavy lifting, and everybody is happy...

Cheers,
Markus

-- 
Markus Mottl        http://www.ocaml.info        markus.mo...@gmail.com

_______________________________________________
Godi-list mailing list
Godi-list@ocaml-programming.de
https://godirepo.camlcity.org/mailman/listinfo/godi-list

Reply via email to