Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0002353OCaml~DO NOT USE (was: OCaml general)public2004-03-17 11:052013-08-31 12:46
Assigned To 
StatusclosedResolutionwon't fix 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0002353: Curried data constructors (feature wish)
DescriptionFull_Name: Fermin Reig
Version: 3.07
OS: linux
Submission from: (


I would like to have curried data constructors, a la Haskell. Xavier Leroy has
already stated ( [^]) 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.

Fermin Reig

TagsNo tags attached.
Attached Files

- Relationships

-  Notes
doligez (administrator)
2012-01-30 15:25

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.

- Issue History
Date Modified Username Field Change
2005-11-18 10:13 administrator New Issue
2012-01-30 15:25 doligez Note Added: 0006841
2012-01-30 15:25 doligez Status acknowledged => resolved
2012-01-30 15:25 doligez Resolution open => won't fix
2012-01-30 15:25 doligez Description Updated View Revisions
2013-08-31 12:46 xleroy Status resolved => closed
2017-02-23 16:36 doligez Category OCaml general => -OCaml general
2017-03-03 17:55 doligez Category -OCaml general => -(deprecated) general
2017-03-03 18:01 doligez Category -(deprecated) general => ~deprecated (was: OCaml general)
2017-03-06 17:04 doligez Category ~deprecated (was: OCaml general) => ~DO NOT USE (was: OCaml general)

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker