Report on Curry
Since the design and implementation of Curry is under development,
the language definition contained in the report
should be considered as preliminary in various aspects.
Nevertheless, the report is the main reference on Curry
so that implementations of Curry should refer to this report
to explain restrictions or differences.
If you are interested in a
general introduction to programming in Curry, please look
at the
tutorial on Curry.
Here
you can also find a Java applet for showing
syntax diagrams for Curry
which can be easily traversed by clicking on the corresponding
grammar symbols.
For completeness, here are also the older versions of the Curry report:
-
Version 0.8.0 of April 15, 2003
Changes to the previous version:
-
Sect. 2.3: Rules with multiple guards must contain Boolean guards,
i.e., multiple guards of type Success are no longer allowed.
-
Sect. 5 on expressions introduced and new subsection
on case expressions added.
-
Appendix B (Prelude): Functions sequenceIO, sequenceIO_,
mapIO, mapIO_ added.
-
Appendix C.3: Syntax of identifiers extended: single quotes are
allowed as digits or underscores.
-
Appendix C.3: Syntax of "do" expressions corrected:
the last element must be an expression and not a statement.
-
Appendix C.3: Syntax of "case" expressions added.
-
Appendix D.8: Multiple constraint guards eliminated.
-
Appendix D.8: Transformation to eliminate local patterns changed to support
lazy pattern matching.
-
Version 0.7.2 of September 16, 2002
Changes to the previous version:
-
Sect. 3: Defaults for flexible and rigid functions changed.
Only IO actions are rigid, all others are flexible.
Consequently, pragmas are no longer necessary (i.e., the section
on pragmas has been deleted) as well as the evaluation annotation
"eval flex". The syntax has been adapted accordingly.
-
Appendix B (Prelude): Definition of zip/zip3
changed so that it is compatible with Haskell.
-
Appendix B (Prelude): Functions error, failed,
zipWith, zipWith3, unzip, unzip3,
words, unwords, reverse, and,
or, any, all,
elem, notElem, doSolve,
seq, $! added
-
Appendix B (Prelude): Search operator "all" renamed to
"solveAll" (to avoid name clash with Haskell's "all")
-
Appendix B (Prelude):
Bug in definition of "one" eliminated (dfs -> solveAll)
-
Appendix B (Prelude):
Explicit definitions for >> and browse provided.
-
Appendix B (Prelude):
Definition of !! slightly changed so that it is only defined
on the correct bounds
-
Version 0.7.1 of June 6, 2000
Changes to the previous version:
-
Sect. 2.2: Type synonym declarations added.
-
Sect. 4.1.2: Explanation of type "Success" slightly improved.
-
Sect. 4.1.7: Notation for arithmetic sequences and list comprehensions added.
-
Sect. 6.2: Do notation added.
-
Appendix B (Prelude): Operators >> and >>=
defined as left associative to be compatible with Haskell.
-
Appendix B (Prelude): Generator functions for arithmetic sequences
(enumFrom...), if_then_else, null, and
print added to the prelude.
-
Appendix C.3: Curry grammar extended for the new syntactic sugar (see above).
-
Appendix C.3 and Sect. 5: Syntactic ambiguities between module
qualification and function composition resolved by clarifying
the positioning of blanks.
-
Version 0.7 of February 2, 2000
Changes to the previous version:
-
Name of type constructor "Constraint" replaced by "Success",
i.e., a constraint is now a function with result type "Success".
-
The old pragma "optmatch" has been omitted and this is
now the default strategy.
-
Sect. 2.1: Restriction on arities in applications omitted
since this is not intended in higher-order functions
like twice. Actually, current implementations of Curry
already dropped this restriction.
-
Sect. 4.1: Tuple constructors defined as "(,...,)"
to be compatible with Haskell.
-
Sect. 4.2: Precise definition of type expressions added so that
it is clear that partial type constructor applications
are not allowed.
-
New Section 11 about literate programming included.
-
Appendix D.6: Description of optmatch strategy for
generating definitional trees added.
-
Appendix D.8: Elimination of local patterns corrected:
a local let should not be moved to the top-level before
eliminating it, otherwise there are problems with
let's in branches of conditionals.
-
Version 0.6 of October 22, 1999
Changes to the previous version:
- Section 2.6: Footnote about instantiation of unbound functional variables
added.
- Section 4.2: Typing rules for existentials and defining equations
corrected.
- Section 5: Definition of module system changed so that it is
almost compatible with Haskell (e.g., renaming is replaced by
qualification and hiding)
- Section 10: Command ":type" shows the type of an expression instead
of a function
- Appendix B: standard prelude extended (const, /=, lines, unlines,
either, maybe,...)
- Syntax: bugs w.r.t. infix operators and unary minus corrected
- Syntax: module syntax slightly changed, list of keywords updated
Changes: qualified infix operators allowed, renaming is replaced by
qualification and hiding
- Appendix D: "pattern" replaced by "call pattern" to avoid confusion
with patterns in the syntax of Curry (which are defined as expressions
without defined functions).
- Typo in Figure 3 corrected.
- Section 2.2.1 and Appendix D.2: Explanation of sharing made more precise.
- Appendix D: Section about the elimination of local declarations
(let/where) included. This lifting of local declarations is necessary
to explain the operational semantics and the type system of the entire
language. Concrete implementations are free to choose other techniques
if they are conform with this specification.
-
Draft of January 13, 1999
Changes to the previous version:
- Section 2.2.2: special case of single Boolean guard removed.
- Section 2.4:
- implicit declarations of free variables deleted (see email of
January 7, 1999)
- discussion of mutally recursive "free" declarations added
- Section 4.1: explanation added that "predicates" in the logic programming
sense should be considered as constraints rather than Boolean functions
in Curry.
- Section 4.2: Definition of well-typed programs added by means of
typing rules.
- Section 10: ".curry" defined as the standard extension for loading
Curry programs and full command names for the interactive
environment added.
- Some fixity declarations in the prelude corrected.
- Section B (Prelude):
- function "tryone" (cf. Section 7.4) added since it is necessary to
define search operator "one"
- "unpack" modified so that it extracts only a single search goal
(the previous "unpack" on lists is now equivalent to "map unpack")
- Section C.1:
- Characters "\:" added to valid OpID characters
- Keywords of Curry defined
- Section C.3:
- rules for type expressions and patterns corrected
(for compatibility with Haskell)
- order in function declarations relaxed: signature, eval annotation
and equations can come in any order
- Expression syntax extended (sections and unary minus included)
- Section C.4 about handling of infix operators added.
- Section D.2: evaluation of conditional rules directly integrated in the
operational semantics of Curry. Thus, Section D.3 is deleted since
the special handling of conditional rules by a syntactic transformation
caused some confusion.
- Section D.4: Inference rule 6 for solving equational constraints corrected.
-
Draft of November 23, 1998
Changes to the previous version:
-
Draft of June 29, 1998
Changes to the previous version:
-
Evaluation annotations simplified: only rigid or flex
are still allowed, the more complicated tree annotations are
omitted.
-
Grammar slightly corrected.
-
Description of the layout rules inserted (Section C.2).
-
Draft of February 2, 1998
Changes to the previous version:
-
and alternatives in evaluation annotations dropped, i.e.,
concurrent evaluation is expressed through concurrent conjunction
of constraints, which seems enough in practice and is also used
in Goffin or Oz.
- Section 2.3 on local declarations (describing let and
where) added.
-
Section 2.4 on free variables added. Free variables can be declared
similarly to other local objects by let and where
declarations.
-
Section 2.5 on constraints and equality updated (in particular,
references to the internal constant Valid dropped
and and evaluation annotations omitted).
-
Section 3 on the operational semantics simplified
(usually, only the evaluation annotations flex and
rigid are important; thus, the explanation of the other
more specialized annotations has been moved into the appendix).
-
Section 5 on the module system added.
-
Section 7 describing the encapsulated search facilities added.
-
Pragmas (Section 9) slightly modified.
-
Prelude updated.
-
Syntax updated.
-
Operational semantics (Appendix D) updated according to the new
features (equational constraints, concurrent conjunction,
encapsulated search).
-
Draft of June 6, 1997
Changes to the previous version:
- equational constraints and concurrent conjunction introduced
-
restriction to confluent programs dropped, i.e., non-deterministic
functions are allowed, but sufficient criteria to ensure "well-definedness"
of functions in the traditional sense are given
- meaning of committed choice modified (now it is compatible
with concurrent constraint languages)
-
Prelude added
-
Syntax added
-
Draft of January 10, 1997
Changes to the previous version: syntax made compatible with Haskell
-
Draft of December 5, 1996
This was the first proposal
Back to Homepage of Curry
Michael Hanus