Curry Logo

Curry

A Truly Integrated Functional Logic Programming Language
-- Returns the last number of a list.
last :: [Int] -> Int
last (_ ++ [x]) = x

-- Returns some permutation of a list.
perm :: [a] -> [a]
perm []     = []
perm (x:xs) = insert (perm xs)
 where insert ys     = x : ys
       insert (y:ys) = y : insert ys

Curry is a declarative multi-paradigm programming language which combines in a seamless way features from functional programming (nested expressions, higher-order functions, strong typing, lazy evaluation) and logic programming (non-determinism, built-in search, free variables, partial data structures). Compared to the single programming paradigms, Curry provides additional features, like optimal evaluation for logic-oriented computations and flexible, non-deterministic pattern matching with user-defined functions.

Features

Purely Declarative

Curry is called a declarative language, because computed results are independent of the time and order of evaluation, which simplifies reasoning on programs. Side effects can be modeled as “IO” operations, i.e., a declarative description of what to do. Operations are constructed by expressions only, there are no statements or instructions, and every binding to a variable is immutable.

Type Inference

Curry is strongly typed but type annotations of functions need not be written by the programmer: they are automatically inferred by the compiler using a type inference algorithm. Nevertheless, it is a good style to write down the types of functions in order to provide at least a minimal documentation of the intended use of functions.

Non-Determinism

Curry supports non-deterministic operations which can return different values for the same input. Non-deterministic operations support a programming style similar to that of logic programming while preserving some advantages of functional programs such as expression nesting and lazy (demand-driven) evaluation.

Free Variables

Free variables denote “unknown” values. They are instantiated (i.e., replaced by some concrete values) so that the instantiated expression is evaluable. REPLs of Curry systems show bindings (i.e., instantiations) of the free variables of the main expression it has computed to evaluate an expression.

The development of Curry is an international initiative intended to provide a common platform for the research, teaching and application of integrated functional logic languages. The design of Curry is mainly discussed in the Curry mailing list. A detailed report describing the language is also available. To get an idea of Curry, you may have a look into the short list of Curry's features or a tutorial on Curry.

Ecosystem

Compilers

Several implementations of Curry are available and/or under development. The most prominent representatives are the Portland Aachen Kiel Curry System (PAKCS), the new version of the Kiel Curry System (KiCS2), and the Münster Curry Compiler (MCC).

Package Manager

The Curry Package Manager (CPM) is a tool to distribute and install Curry libraries and applications and manage version dependencies between them. These libraries are organized in packages. There is a central index of all these packages which can easily be downloaded by CPM.

CurryDoc

CurryDoc is a tool that generates the documentation for a Curry program in HTML (and optionally also LaTeX) format. The generated HTML pages contain information about all data types and operations exported by a module as well as links between the different entities.

Curr(y)gle API Search

Curr(y)gle is a Curry API search engine which allows you to search the Curry libraries indexed by CPM. You can search by names of either operations, data types, and modules. It was designed following the example set by Haskell’s search engine Hoogle.