Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0002353OCamlOCaml generalpublic2004-03-17 11:052013-08-31 12:46
Reporteradministrator 
Assigned To 
PrioritynormalSeverityfeatureReproducibilityalways
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: 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

TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0006841)
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


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker