You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 2353 Reporter: administrator Status: closed (set by @xavierleroy on 2013-08-31T10:46:17Z) Resolution: won't fix Priority: normal Severity: feature Category: ~DO NOT USE (was: OCaml general)
I would like to have curried data constructors, a la Haskell. Xavier Leroy has
already stated (http://caml.inria.fr/archives/200108/msg00022.html) that this
will not be made the default behaviour in Caml. What I would like to have is the option of having curried constructors. This would be a backwards-compatible
extension, which would have no impact on programs that don't use it.
A possible syntax is:
type t = Curried of int int | ...
The underlying representation of this in terms of the current syntax would be:
Curried of int, int
That is, the arity is 2 in both cases. Each ocurrence of 'Curried' in an
expression can be desugared to (fun x y -> Curried x, y). A similar translation
is done in patterns. I believe this needs be done before type-checking. In
addition, for exported types, the fact that a constructor is curried should be
present in .cmi files, so that desugaring is done in client modules.
Thanks,
Fermin Reig
The text was updated successfully, but these errors were encountered:
Camlp4 and the revised syntax provide some amount of support for curried constructors. We do not think it would make a good addition to the traditional syntax.
Original bug ID: 2353
Reporter: administrator
Status: closed (set by @xavierleroy on 2013-08-31T10:46:17Z)
Resolution: won't fix
Priority: normal
Severity: feature
Category: ~DO NOT USE (was: OCaml general)
Bug description
Full_Name: Fermin Reig
Version: 3.07
OS: linux
Submission from: franc.cs.nott.ac.uk (128.243.21.224)
Hello,
I would like to have curried data constructors, a la Haskell. Xavier Leroy has
already stated (http://caml.inria.fr/archives/200108/msg00022.html) that this
will not be made the default behaviour in Caml. What I would like to have is the
option of having curried constructors. This would be a backwards-compatible
extension, which would have no impact on programs that don't use it.
A possible syntax is:
type t = Curried of int int | ...
The underlying representation of this in terms of the current syntax would be:
Curried of int, int
That is, the arity is 2 in both cases. Each ocurrence of 'Curried' in an
expression can be desugared to (fun x y -> Curried x, y). A similar translation
is done in patterns. I believe this needs be done before type-checking. In
addition, for exported types, the fact that a constructor is curried should be
present in .cmi files, so that desugaring is done in client modules.
Thanks,
Fermin Reig
The text was updated successfully, but these errors were encountered: