On Tuesday 06 October 2009 13:45:04 David Allsopp wrote:
> >   Is there a reason for constructors not to behave like functions? For
> > instance, one cannot make a partial application from a constructor:
>
> This is how SML handles constructors, Xavier explained the reasons he chose
> to depart from this in:
>
> http://caml.inria.fr/pub/ml-archives/caml-list/2001/08/47db53a4b42529708647
>c9e81183598b.en.html
>
> I think it would be possible to simulate the SML behaviour in OCaml using
> camlp4 (if you assume that for [type foo = Bar of int] that future unbound
> references to [bar] are interpreted as [fun x -> bar x] instead of an
> error)

Only if you turned multi-argument type constructors into single-argument ones 
taking a tuple, i.e. type definitions like:

  type t = Bar of int * int

must become:

  type t = Bar of (int * int)

-- 
Dr Jon Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?e

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to