Module Prelude

The standard prelude of Curry with type classes. All exported functions, data types, type classes and methods defined in this module are always available in any Curry program.

Summary of exported operations:

(/==) :: Data a => a -> a -> Bool  Deterministic 
The negation of strict equality.
shows :: Show a => a -> String -> String  Deterministic 
Converts a showable value to a show function that prepends this value.
showChar :: Char -> String -> String  Deterministic 
Converts a character to a show function that prepends the character.
showString :: String -> String -> String  Deterministic 
Converts a string to a show function that prepends the string.
showParen :: Bool -> (String -> String) -> String -> String  Deterministic 
If the first argument is True, Converts a show function to a show function adding enclosing brackets, otherwise the show function is returned unchanged.
showTuple :: [String -> String] -> String -> String  Deterministic 
Converts a list of show functions to a show function combining the given show functions to a tuple representation.
reads :: Read a => String -> [(a,String)]  Deterministic 
A parser to read data from a string.
readParen :: Bool -> (String -> [(a,String)]) -> String -> [(a,String)]  Deterministic 
readParen True p parses what p parses, but surrounded with parentheses.
read :: Read a => String -> a  Deterministic 
Reads data of the given type from a string.
lex :: String -> [(String,String)]  Deterministic 
Reads a single lexeme from the given string.
even :: Integral a => a -> Bool  Deterministic 
Returns whether an integer is even.
odd :: Integral a => a -> Bool  Deterministic 
Returns whether an integer is odd.
fromIntegral :: (Integral a, Num b) => a -> b  Deterministic 
General coercion from integral types.
realToFrac :: (Real a, Fractional b) => a -> b  Deterministic 
General coercion to fractional types.
(^) :: (Num a, Integral b) => a -> b -> a  Deterministic 
Raises a number to a non-negative integer power.
(<$>) :: Functor a => (b -> c) -> a b -> a c  Deterministic 
liftM2 :: Monad a => (b -> c -> d) -> a b -> a c -> a d  Deterministic 
Promotes a function to a monad.
sequence :: Monad a => [a b] -> a [b]  Deterministic 
Executes a sequence of monadic actions and collects all results in a list.
sequence_ :: Monad a => [a b] -> a ()  Deterministic 
Executes a sequence of monadic actions and ignores the results.
mapM :: Monad a => (b -> a c) -> [b] -> a [c]  Deterministic 
Maps a monadic action function on a list of elements.
mapM_ :: Monad a => (b -> a c) -> [b] -> a ()  Deterministic 
Maps an monadic action function on a list of elements.
isUpper :: Char -> Bool  Deterministic 
Returns true if the argument is an uppercase letter.
isLower :: Char -> Bool  Deterministic 
Returns true if the argument is an lowercase letter.
isAlpha :: Char -> Bool  Deterministic 
Returns true if the argument is a letter.
isDigit :: Char -> Bool  Deterministic 
Returns true if the argument is a decimal digit.
isAlphaNum :: Char -> Bool  Deterministic 
Returns true if the argument is a letter or digit.
isBinDigit :: Char -> Bool  Deterministic 
Returns true if the argument is a binary digit.
isOctDigit :: Char -> Bool  Deterministic 
Returns true if the argument is an octal digit.
isHexDigit :: Char -> Bool  Deterministic 
Returns true if the argument is a hexadecimal digit.
isSpace :: Char -> Bool  Deterministic 
Returns true if the argument is a white space.
ord :: Char -> Int  Deterministic 
Converts a character into its ASCII value.
chr :: Int -> Char  Deterministic 
Converts a Unicode value into a character.
lines :: String -> [String]  Deterministic 
Breaks a string into a list of lines where a line is terminated at a newline character.
unlines :: [String] -> String  Deterministic 
Concatenates a list of strings with terminating newlines.
words :: String -> [String]  Deterministic 
Breaks a string into a list of words where the words are delimited by white spaces.
unwords :: [String] -> String  Deterministic 
Concatenates a list of strings with a blank between two strings.
($) :: (a -> b) -> a -> b  Deterministic 
Right-associative application.
($!) :: (a -> b) -> a -> b  Deterministic 
Right-associative application with strict evaluation of its argument to head normal form.
($!!) :: (a -> b) -> a -> b  Deterministic 
Right-associative application with strict evaluation of its argument to normal form.
($#) :: (a -> b) -> a -> b  Deterministic 
Right-associative application with strict evaluation of its argument to a non-variable term.
($##) :: (a -> b) -> a -> b  Deterministic 
Right-associative application with strict evaluation of its argument to ground normal form.
seq :: a -> b -> b  Deterministic 
Evaluates the first argument to head normal form (which could also be a free variable) and returns the second argument.
ensureNotFree :: a -> a  Deterministic 
Evaluates the argument to head normal form and returns it.
ensureSpine :: [a] -> [a]  Deterministic 
Evaluates the argument to spine form and returns it.
normalForm :: a -> a  Deterministic 
Evaluates the argument to normal form and returns it.
groundNormalForm :: a -> a  Deterministic 
Evaluates the argument to ground normal form and returns it.
(.) :: (a -> b) -> (c -> a) -> c -> b  Deterministic 
Function composition.
id :: a -> a  Deterministic 
Identity function.
const :: a -> b -> a  Deterministic 
Constant function.
asTypeOf :: a -> a -> a  Deterministic 
asTypeOf is a type-restricted version of const.
curry :: ((a,b) -> c) -> a -> b -> c  Deterministic 
Converts an uncurried function to a curried function.
uncurry :: (a -> b -> c) -> (a,b) -> c  Deterministic 
Converts an curried function to a function on pairs.
flip :: (a -> b -> c) -> b -> a -> c  Deterministic 
flip f is identical to f, but with the order of arguments reversed.
until :: (a -> Bool) -> (a -> a) -> a -> a  Deterministic 
Repeats application of a function until a predicate holds.
(&&) :: Bool -> Bool -> Bool  Deterministic 
Sequential conjunction on Booleans.
(||) :: Bool -> Bool -> Bool  Deterministic 
Sequential disjunction on Booleans.
not :: Bool -> Bool  Deterministic 
Negation on Booleans.
otherwise :: Bool  Deterministic 
Useful name for the last condition in a sequence of conditional equations.
ifThenElse :: Bool -> a -> a -> a  Deterministic 
The standard conditional.
fst :: (a,b) -> a  Deterministic 
Selects the first component of a pair.
snd :: (a,b) -> b  Deterministic 
Selects the second component of a pair.
head :: [a] -> a  Deterministic 
Computes the first element of a list.
tail :: [a] -> [a]  Deterministic 
Computes the remaining elements of a list.
null :: [a] -> Bool  Deterministic 
Is a list empty?
(++) :: [a] -> [a] -> [a]  Deterministic 
Concatenates two lists.
length :: [a] -> Int  Deterministic 
Computes the length of a list.
(!!) :: [a] -> Int -> a  Deterministic 
List index (subscript) operator, head has index 0.
map :: (a -> b) -> [a] -> [b]  Deterministic 
Maps a function on all elements of a list.
foldl :: (a -> b -> a) -> a -> [b] -> a  Deterministic 
Accumulates all list elements by applying a binary operator from left to right.
foldl1 :: (a -> a -> a) -> [a] -> a  Deterministic 
Accumulates a non-empty list from left to right.
foldr :: (a -> b -> b) -> b -> [a] -> b  Deterministic 
Accumulates all list elements by applying a binary operator from right to left.
foldr1 :: (a -> a -> a) -> [a] -> a  Deterministic 
Accumulates a non-empty list from right to left:
filter :: (a -> Bool) -> [a] -> [a]  Deterministic 
Filters all elements satisfying a given predicate in a list.
zip :: [a] -> [b] -> [(a,b)]  Deterministic 
Joins two lists into one list of pairs.
zip3 :: [a] -> [b] -> [c] -> [(a,b,c)]  Deterministic 
Joins three lists into one list of triples.
zipWith :: (a -> b -> c) -> [a] -> [b] -> [c]  Deterministic 
Joins two lists into one list by applying a combination function to corresponding pairs of elements.
zipWith3 :: (a -> b -> c -> d) -> [a] -> [b] -> [c] -> [d]  Deterministic 
Joins three lists into one list by applying a combination function to corresponding triples of elements.
unzip :: [(a,b)] -> ([a],[b])  Deterministic 
Transforms a list of pairs into a pair of lists.
unzip3 :: [(a,b,c)] -> ([a],[b],[c])  Deterministic 
Transforms a list of triples into a triple of lists.
concat :: [[a]] -> [a]  Deterministic 
Concatenates a list of lists into one list.
concatMap :: (a -> [b]) -> [a] -> [b]  Deterministic 
Maps a function from elements to lists and merges the result into one list.
iterate :: (a -> a) -> a -> [a]  Deterministic 
Infinite list of repeated applications of a function f to an element x.
repeat :: a -> [a]  Deterministic 
Infinite list where all elements have the same value.
replicate :: Int -> a -> [a]  Deterministic 
List of length n where all elements have the same value.
take :: Int -> [a] -> [a]  Deterministic 
Returns prefix of length n.
drop :: Int -> [a] -> [a]  Deterministic 
Returns suffix without first n elements.
splitAt :: Int -> [a] -> ([a],[a])  Deterministic 
splitAt n xs is equivalent to (take n xs, drop n xs)
takeWhile :: (a -> Bool) -> [a] -> [a]  Deterministic 
Returns longest prefix with elements satisfying a predicate.
dropWhile :: (a -> Bool) -> [a] -> [a]  Deterministic 
Returns suffix without takeWhile prefix.
span :: (a -> Bool) -> [a] -> ([a],[a])  Deterministic 
span p xs is equivalent to (takeWhile p xs, dropWhile p xs)
break :: (a -> Bool) -> [a] -> ([a],[a])  Deterministic 
break p xs is equivalent to `(takeWhile (not .
reverse :: [a] -> [a]  Deterministic 
Reverses the order of all elements in a list.
and :: [Bool] -> Bool  Deterministic 
Computes the conjunction of a Boolean list.
or :: [Bool] -> Bool  Deterministic 
Computes the disjunction of a Boolean list.
any :: (a -> Bool) -> [a] -> Bool  Deterministic 
Is there an element in a list satisfying a given predicate?
all :: (a -> Bool) -> [a] -> Bool  Deterministic 
Is a given predicate satisfied by all elements in a list?
elem :: Eq a => a -> [a] -> Bool  Deterministic 
Element of a list?
notElem :: Eq a => a -> [a] -> Bool  Deterministic 
Not element of a list?
lookup :: Eq a => a -> [(a,b)] -> Maybe b  Deterministic 
Looks up a key in an association list.
maybe :: a -> (b -> a) -> Maybe b -> a  Deterministic 
The maybe function takes a default value, a function, and a Maybe value.
either :: (a -> b) -> (c -> b) -> Either a c -> b  Deterministic 
Apply a case analysis to a value of the Either type.
getChar :: IO Char  Deterministic 
An action that reads a character from standard output and returns it.
getLine :: IO String  Deterministic 
An action that reads a line from standard input and returns it.
putChar :: Char -> IO ()  Deterministic 
An action that puts its character argument on standard output.
putStr :: String -> IO ()  Deterministic 
Action to print a string on standard output.
putStrLn :: String -> IO ()  Deterministic 
Action to print a string with a newline on standard output.
print :: Show a => a -> IO ()  Deterministic 
Converts a term into a string and prints it.
readFile :: String -> IO String  Deterministic 
An action that (lazily) reads a file and returns its contents.
writeFile :: String -> String -> IO ()  Deterministic 
An action that writes a file.
appendFile :: String -> String -> IO ()  Deterministic 
An action that appends a string to a file.
userError :: String -> IOError  Deterministic 
A user error value is created by providing a description of the error situation as a string.
ioError :: IOError -> IO a  Deterministic 
Raises an I/O exception with a given error value.
catch :: IO a -> (IOError -> IO a) -> IO a  Deterministic 
Catches a possible error or failure during the execution of an I/O action.
success :: Bool  Deterministic 
The always satisfiable constraint.
solve :: Bool -> Bool  Deterministic 
Enforce a Boolean condition to be true.
doSolve :: Bool -> IO ()  Deterministic 
Solves a constraint as an I/O action.
(=:=) :: Data a => a -> a -> Bool  Deterministic 
The equational constraint.
constrEq :: a -> a -> Bool  Deterministic 
Internal operation to implement equational constraints.
(=:<=) :: Data a => a -> a -> Bool  Deterministic 
Non-strict equational constraint.
(=:<<=) :: Data a => a -> a -> Bool  Deterministic 
Non-strict equational constraint for linear functional patterns.
(&) :: Bool -> Bool -> Bool  Deterministic 
Concurrent conjunction.
(&>) :: Bool -> a -> a  Deterministic 
Conditional expression.
(?) :: a -> a -> a  Non-deterministic 
Non-deterministic choice par excellence.
anyOf :: [a] -> a  Non-deterministic 
Returns non-deterministically any element of a list.
unknown :: Data a => a  Non-deterministic 
Evaluates to a fresh free variable.
failed :: a  Deterministic 
A non-reducible polymorphic function.
error :: String -> a  Deterministic 
Aborts the execution with an error message.
apply :: (a -> b) -> a -> b  Deterministic 
cond :: Bool -> a -> a  Deterministic 
letrec :: a -> a -> Bool  Deterministic 
failure :: a -> b -> c  Deterministic 
PEVAL :: a -> a  Deterministic 
Identity function used by the partial evaluator to mark expressions to be partially evaluated.

Exported datatypes:


Char

Constructors:


Int

Constructors:


Float

Constructors:


Bool

The type of Boolean values.

Constructors:

  • False :: Bool
  • True :: Bool

Ordering

Ordering type. Useful as a result of comparison functions.

Constructors:

  • LT :: Ordering
  • EQ :: Ordering
  • GT :: Ordering

ShowS

The type synonym ShowS represent strings as difference lists. Composing functions of this type allows concatenation of lists in constant time.

Type synonym: ShowS = String -> String


ReadS

The type synonym ReadS represent a parser for values of type a. Such a parser is a function that takes a String and returns a list of possible parses as (a,String) pairs. Thus, if the result is the empty list, there is no parse, i.e., the input string is not valid.

Type synonym: ReadS a = String -> [(a,String)]


String

The type String is a type synonym for list of characters so that all list operations can be used on strings.

Type synonym: String = [Char]


Maybe

The Maybe type can be used for values which could also be absent.

Constructors:

  • Nothing :: Maybe a
  • Just :: a -> Maybe a

Either

The Either type can be used to combine values of two different types.

Constructors:

  • Left :: a -> Either a b
  • Right :: b -> Either a b

IO

Constructors:


FilePath

The FilePath is j type synonym for strings. It is useful to mark in type signatures if a file path is required.

Type synonym: FilePath = String


IOError

The (abstract) type of error values. Currently, it distinguishes between general I/O errors, user-generated errors (see userError), failures and non-determinism errors during I/O computations. These errors can be caught by catch. Each error contains a string shortly explaining the error. This type might be extended in the future to distinguish further error situations.

Constructors:

  • IOError :: String -> IOError
  • UserError :: String -> IOError
  • FailError :: String -> IOError
  • NondetError :: String -> IOError

Success

The type synonym for constraints. It is included for backward compatibility and should be no longer used.

Type synonym: Success = Bool


DET

Identity type synonym used to mark deterministic operations. Used by the Curry preprocessor.

Type synonym: DET a = a


Exported operations:

(/==) :: Data a => a -> a -> Bool  Deterministic 

The negation of strict equality.

Further infos:
  • defined as non-associative infix operator with precedence 4

shows :: Show a => a -> String -> String  Deterministic 

Converts a showable value to a show function that prepends this value.

showChar :: Char -> String -> String  Deterministic 

Converts a character to a show function that prepends the character.

Further infos:
  • solution complete, i.e., able to compute all solutions

showString :: String -> String -> String  Deterministic 

Converts a string to a show function that prepends the string.

showParen :: Bool -> (String -> String) -> String -> String  Deterministic 

If the first argument is True, Converts a show function to a show function adding enclosing brackets, otherwise the show function is returned unchanged.

showTuple :: [String -> String] -> String -> String  Deterministic 

Converts a list of show functions to a show function combining the given show functions to a tuple representation.

reads :: Read a => String -> [(a,String)]  Deterministic 

A parser to read data from a string. For instance, reads "42" :: [(Int,String)] returns [(42,[])], and reads "hello" :: [(Int,String)] returns [].

readParen :: Bool -> (String -> [(a,String)]) -> String -> [(a,String)]  Deterministic 

readParen True p parses what p parses, but surrounded with parentheses. readParen False p parses what p parses, but the string to be parsed can be optionally with parentheses.

read :: Read a => String -> a  Deterministic 

Reads data of the given type from a string. The operations fails if the data cannot be parsed. For instance read "42" :: Int evaluates to 42, and read "hello" :: Int fails.

Further infos:
  • partially defined

lex :: String -> [(String,String)]  Deterministic 

Reads a single lexeme from the given string. Initial white space is discarded and the characters of the lexeme are returned. If the input string contains only white space, lex returns the empty string as lexeme. If there is no legal lexeme at the beginning of the input string, the operation fails, i.e., [] is returned.

Further infos:
  • partially defined

even :: Integral a => a -> Bool  Deterministic 

Returns whether an integer is even.

odd :: Integral a => a -> Bool  Deterministic 

Returns whether an integer is odd.

fromIntegral :: (Integral a, Num b) => a -> b  Deterministic 

General coercion from integral types.

realToFrac :: (Real a, Fractional b) => a -> b  Deterministic 

General coercion to fractional types.

(^) :: (Num a, Integral b) => a -> b -> a  Deterministic 

Raises a number to a non-negative integer power.

(<$>) :: Functor a => (b -> c) -> a b -> a c  Deterministic 

Further infos:
  • defined as left-associative infix operator with precedence 4

liftM2 :: Monad a => (b -> c -> d) -> a b -> a c -> a d  Deterministic 

Promotes a function to a monad. The function arguments are scanned from left to right. For instance, liftM2 (+) [1,2] [3,4] evaluates to [4,5,5,6], and liftM2 (,) [1,2] [3,4] evaluates to [(1,3),(1,4),(2,3),(2,4)].

sequence :: Monad a => [a b] -> a [b]  Deterministic 

Executes a sequence of monadic actions and collects all results in a list.

sequence_ :: Monad a => [a b] -> a ()  Deterministic 

Executes a sequence of monadic actions and ignores the results.

mapM :: Monad a => (b -> a c) -> [b] -> a [c]  Deterministic 

Maps a monadic action function on a list of elements. The results of all monadic actions are collected in a list.

mapM_ :: Monad a => (b -> a c) -> [b] -> a ()  Deterministic 

Maps an monadic action function on a list of elements. The results of all monadic actions are ignored.

isUpper :: Char -> Bool  Deterministic 

Returns true if the argument is an uppercase letter.

isLower :: Char -> Bool  Deterministic 

Returns true if the argument is an lowercase letter.

isAlpha :: Char -> Bool  Deterministic 

Returns true if the argument is a letter.

isDigit :: Char -> Bool  Deterministic 

Returns true if the argument is a decimal digit.

isAlphaNum :: Char -> Bool  Deterministic 

Returns true if the argument is a letter or digit.

isBinDigit :: Char -> Bool  Deterministic 

Returns true if the argument is a binary digit.

isOctDigit :: Char -> Bool  Deterministic 

Returns true if the argument is an octal digit.

isHexDigit :: Char -> Bool  Deterministic 

Returns true if the argument is a hexadecimal digit.

isSpace :: Char -> Bool  Deterministic 

Returns true if the argument is a white space.

ord :: Char -> Int  Deterministic 

Converts a character into its ASCII value.

chr :: Int -> Char  Deterministic 

Converts a Unicode value into a character. The conversion is total, i.e., for out-of-bound values, the smallest or largest character is generated.

lines :: String -> [String]  Deterministic 

Breaks a string into a list of lines where a line is terminated at a newline character. The resulting lines do not contain newline characters.

unlines :: [String] -> String  Deterministic 

Concatenates a list of strings with terminating newlines.

words :: String -> [String]  Deterministic 

Breaks a string into a list of words where the words are delimited by white spaces.

unwords :: [String] -> String  Deterministic 

Concatenates a list of strings with a blank between two strings.

($) :: (a -> b) -> a -> b  Deterministic 

Right-associative application.

Further infos:
  • defined as right-associative infix operator with precedence 0

($!) :: (a -> b) -> a -> b  Deterministic 

Right-associative application with strict evaluation of its argument to head normal form.

Further infos:
  • defined as right-associative infix operator with precedence 0
  • externally defined

($!!) :: (a -> b) -> a -> b  Deterministic 

Right-associative application with strict evaluation of its argument to normal form.

Further infos:
  • defined as right-associative infix operator with precedence 0
  • externally defined

($#) :: (a -> b) -> a -> b  Deterministic 

Right-associative application with strict evaluation of its argument to a non-variable term.

Further infos:
  • defined as right-associative infix operator with precedence 0

($##) :: (a -> b) -> a -> b  Deterministic 

Right-associative application with strict evaluation of its argument to ground normal form.

Further infos:
  • defined as right-associative infix operator with precedence 0
  • externally defined

seq :: a -> b -> b  Deterministic 

Evaluates the first argument to head normal form (which could also be a free variable) and returns the second argument.

Further infos:
  • defined as right-associative infix operator with precedence 0

ensureNotFree :: a -> a  Deterministic 

Evaluates the argument to head normal form and returns it. Suspends until the result is bound to a non-variable term.

Further infos:
  • externally defined

ensureSpine :: [a] -> [a]  Deterministic 

Evaluates the argument to spine form and returns it. Suspends until the result is bound to a non-variable spine.

normalForm :: a -> a  Deterministic 

Evaluates the argument to normal form and returns it.

groundNormalForm :: a -> a  Deterministic 

Evaluates the argument to ground normal form and returns it. Suspends as long as the normal form of the argument is not ground.

(.) :: (a -> b) -> (c -> a) -> c -> b  Deterministic 

Function composition.

Further infos:
  • defined as right-associative infix operator with precedence 9

id :: a -> a  Deterministic 

Identity function.

Further infos:
  • solution complete, i.e., able to compute all solutions

const :: a -> b -> a  Deterministic 

Constant function.

Further infos:
  • solution complete, i.e., able to compute all solutions

asTypeOf :: a -> a -> a  Deterministic 

asTypeOf is a type-restricted version of const. It is usually used as an infix operator, and its typing forces its first argument (which is usually overloaded) to have the same type as the second.

Further infos:
  • solution complete, i.e., able to compute all solutions

curry :: ((a,b) -> c) -> a -> b -> c  Deterministic 

Converts an uncurried function to a curried function.

uncurry :: (a -> b -> c) -> (a,b) -> c  Deterministic 

Converts an curried function to a function on pairs.

flip :: (a -> b -> c) -> b -> a -> c  Deterministic 

flip f is identical to f, but with the order of arguments reversed.

until :: (a -> Bool) -> (a -> a) -> a -> a  Deterministic 

Repeats application of a function until a predicate holds.

(&&) :: Bool -> Bool -> Bool  Deterministic 

Sequential conjunction on Booleans.

Further infos:
  • defined as right-associative infix operator with precedence 3
  • solution complete, i.e., able to compute all solutions

(||) :: Bool -> Bool -> Bool  Deterministic 

Sequential disjunction on Booleans.

Further infos:
  • defined as right-associative infix operator with precedence 2
  • solution complete, i.e., able to compute all solutions

not :: Bool -> Bool  Deterministic 

Negation on Booleans.

Further infos:
  • solution complete, i.e., able to compute all solutions

otherwise :: Bool  Deterministic 

Useful name for the last condition in a sequence of conditional equations.

Further infos:
  • solution complete, i.e., able to compute all solutions

ifThenElse :: Bool -> a -> a -> a  Deterministic 

The standard conditional. It suspends if the condition is a free variable.

fst :: (a,b) -> a  Deterministic 

Selects the first component of a pair.

Further infos:
  • solution complete, i.e., able to compute all solutions

snd :: (a,b) -> b  Deterministic 

Selects the second component of a pair.

Further infos:
  • solution complete, i.e., able to compute all solutions

tail :: [a] -> [a]  Deterministic 

Computes the remaining elements of a list.

Further infos:
  • partially defined
  • solution complete, i.e., able to compute all solutions

null :: [a] -> Bool  Deterministic 

Is a list empty?

Further infos:
  • solution complete, i.e., able to compute all solutions

(++) :: [a] -> [a] -> [a]  Deterministic 

Concatenates two lists. Since it is flexible, it could be also used to split a list into two sublists etc.

Further infos:
  • defined as right-associative infix operator with precedence 5
  • solution complete, i.e., able to compute all solutions

length :: [a] -> Int  Deterministic 

Computes the length of a list.

(!!) :: [a] -> Int -> a  Deterministic 

List index (subscript) operator, head has index 0.

Further infos:
  • defined as left-associative infix operator with precedence 9
  • partially defined

map :: (a -> b) -> [a] -> [b]  Deterministic 

Maps a function on all elements of a list.

foldl :: (a -> b -> a) -> a -> [b] -> a  Deterministic 

Accumulates all list elements by applying a binary operator from left to right.

foldl1 :: (a -> a -> a) -> [a] -> a  Deterministic 

Accumulates a non-empty list from left to right.

Further infos:
  • partially defined

foldr :: (a -> b -> b) -> b -> [a] -> b  Deterministic 

Accumulates all list elements by applying a binary operator from right to left.

foldr1 :: (a -> a -> a) -> [a] -> a  Deterministic 

Accumulates a non-empty list from right to left:

Further infos:
  • partially defined

filter :: (a -> Bool) -> [a] -> [a]  Deterministic 

Filters all elements satisfying a given predicate in a list.

zip :: [a] -> [b] -> [(a,b)]  Deterministic 

Joins two lists into one list of pairs. If one input list is shorter than the other, the additional elements of the longer list are discarded.

Further infos:
  • solution complete, i.e., able to compute all solutions

zip3 :: [a] -> [b] -> [c] -> [(a,b,c)]  Deterministic 

Joins three lists into one list of triples. If one input list is shorter than the other, the additional elements of the longer lists are discarded.

Further infos:
  • solution complete, i.e., able to compute all solutions

zipWith :: (a -> b -> c) -> [a] -> [b] -> [c]  Deterministic 

Joins two lists into one list by applying a combination function to corresponding pairs of elements. Thus zip = zipWith (,)

zipWith3 :: (a -> b -> c -> d) -> [a] -> [b] -> [c] -> [d]  Deterministic 

Joins three lists into one list by applying a combination function to corresponding triples of elements. Thus zip3 = zipWith3 (,,)

unzip :: [(a,b)] -> ([a],[b])  Deterministic 

Transforms a list of pairs into a pair of lists.

Further infos:
  • solution complete, i.e., able to compute all solutions

unzip3 :: [(a,b,c)] -> ([a],[b],[c])  Deterministic 

Transforms a list of triples into a triple of lists.

Further infos:
  • solution complete, i.e., able to compute all solutions

concat :: [[a]] -> [a]  Deterministic 

Concatenates a list of lists into one list.

concatMap :: (a -> [b]) -> [a] -> [b]  Deterministic 

Maps a function from elements to lists and merges the result into one list.

iterate :: (a -> a) -> a -> [a]  Deterministic 

Infinite list of repeated applications of a function f to an element x. Thus, iterate f x = [x, f x, f (f x), ...].

repeat :: a -> [a]  Deterministic 

Infinite list where all elements have the same value. Thus, repeat x = [x, x, x, ...].

Further infos:
  • solution complete, i.e., able to compute all solutions

replicate :: Int -> a -> [a]  Deterministic 

List of length n where all elements have the same value.

take :: Int -> [a] -> [a]  Deterministic 

Returns prefix of length n.

drop :: Int -> [a] -> [a]  Deterministic 

Returns suffix without first n elements.

splitAt :: Int -> [a] -> ([a],[a])  Deterministic 

splitAt n xs is equivalent to (take n xs, drop n xs)

takeWhile :: (a -> Bool) -> [a] -> [a]  Deterministic 

Returns longest prefix with elements satisfying a predicate.

dropWhile :: (a -> Bool) -> [a] -> [a]  Deterministic 

Returns suffix without takeWhile prefix.

span :: (a -> Bool) -> [a] -> ([a],[a])  Deterministic 

span p xs is equivalent to (takeWhile p xs, dropWhile p xs)

break :: (a -> Bool) -> [a] -> ([a],[a])  Deterministic 

break p xs is equivalent to (takeWhile (not . p) xs, dropWhile (not . p) xs). Thus, it breaks a list at the first occurrence of an element satisfying p.

reverse :: [a] -> [a]  Deterministic 

Reverses the order of all elements in a list.

and :: [Bool] -> Bool  Deterministic 

Computes the conjunction of a Boolean list.

or :: [Bool] -> Bool  Deterministic 

Computes the disjunction of a Boolean list.

any :: (a -> Bool) -> [a] -> Bool  Deterministic 

Is there an element in a list satisfying a given predicate?

all :: (a -> Bool) -> [a] -> Bool  Deterministic 

Is a given predicate satisfied by all elements in a list?

elem :: Eq a => a -> [a] -> Bool  Deterministic 

Element of a list?

Further infos:
  • defined as non-associative infix operator with precedence 4

notElem :: Eq a => a -> [a] -> Bool  Deterministic 

Not element of a list?

Further infos:
  • defined as non-associative infix operator with precedence 4

lookup :: Eq a => a -> [(a,b)] -> Maybe b  Deterministic 

Looks up a key in an association list.

maybe :: a -> (b -> a) -> Maybe b -> a  Deterministic 

The maybe function takes a default value, a function, and a Maybe value. If the Maybe value is Nothing, the default value is returned. Otherwise, the function is applied to the value inside the Just and the result is returned.

either :: (a -> b) -> (c -> b) -> Either a c -> b  Deterministic 

Apply a case analysis to a value of the Either type. If the value is Left x, the first function is applied to x. If the value is Right y, the second function is applied to y.

getChar :: IO Char  Deterministic 

An action that reads a character from standard output and returns it.

Further infos:
  • externally defined

getLine :: IO String  Deterministic 

An action that reads a line from standard input and returns it.

putChar :: Char -> IO ()  Deterministic 

An action that puts its character argument on standard output.

putStr :: String -> IO ()  Deterministic 

Action to print a string on standard output.

putStrLn :: String -> IO ()  Deterministic 

Action to print a string with a newline on standard output.

print :: Show a => a -> IO ()  Deterministic 

Converts a term into a string and prints it.

readFile :: String -> IO String  Deterministic 

An action that (lazily) reads a file and returns its contents.

writeFile :: String -> String -> IO ()  Deterministic 

An action that writes a file.

appendFile :: String -> String -> IO ()  Deterministic 

An action that appends a string to a file. It behaves like writeFile if the file does not exist.

userError :: String -> IOError  Deterministic 

A user error value is created by providing a description of the error situation as a string.

Further infos:
  • solution complete, i.e., able to compute all solutions

ioError :: IOError -> IO a  Deterministic 

Raises an I/O exception with a given error value.

catch :: IO a -> (IOError -> IO a) -> IO a  Deterministic 

Catches a possible error or failure during the execution of an I/O action. catch act errfun executes the I/O action act. If an exception or failure occurs during this I/O action, the function errfun is applied to the error value.

Further infos:
  • externally defined

success :: Bool  Deterministic 

The always satisfiable constraint. It is included for backward compatibility and should be no longer used.

Further infos:
  • solution complete, i.e., able to compute all solutions

solve :: Bool -> Bool  Deterministic 

Enforce a Boolean condition to be true. The computation fails if the argument evaluates to False.

Further infos:
  • partially defined
  • solution complete, i.e., able to compute all solutions

doSolve :: Bool -> IO ()  Deterministic 

Solves a constraint as an I/O action. Note: The constraint should be always solvable in a deterministic way.

(=:=) :: Data a => a -> a -> Bool  Deterministic 

The equational constraint. (e1 =:= e2) is satisfiable if both sides e1 and e2 can be reduced to a unifiable data term (i.e., a term without defined function symbols).

Further infos:
  • defined as non-associative infix operator with precedence 4

constrEq :: a -> a -> Bool  Deterministic 

Internal operation to implement equational constraints. It is used by the strict equality optimizer but should not be used in regular programs.

Further infos:
  • externally defined

(=:<=) :: Data a => a -> a -> Bool  Deterministic 

Non-strict equational constraint. This operation is not intended to be used in source programs but it is used to implement functional patterns. Conceptually, (e1 =:<= e2) is satisfiable if e1 can be evaluated to some pattern (data term) that matches e2, i.e., e2 is an instance of this pattern. The Data context is required since the resulting pattern might be non-linear so that it abbreviates some further equational constraints, see Section 7.

Further infos:
  • defined as non-associative infix operator with precedence 4

(=:<<=) :: Data a => a -> a -> Bool  Deterministic 

Non-strict equational constraint for linear functional patterns. Thus, it must be ensured that the first argument is always (after evalutation by narrowing) a linear pattern. Experimental.

Further infos:
  • defined as non-associative infix operator with precedence 4

(&) :: Bool -> Bool -> Bool  Deterministic 

Concurrent conjunction. An expression like (c1 & c2) is evaluated by evaluating the c1 and c2 in a concurrent manner.

Further infos:
  • defined as right-associative infix operator with precedence 0
  • solution complete, i.e., able to compute all solutions
  • externally defined

(&>) :: Bool -> a -> a  Deterministic 

Conditional expression. An expression like (c &> e) is evaluated by evaluating the first argument to True and then evaluating e. The expression has no value if the condition does not evaluate to True.

Further infos:
  • defined as right-associative infix operator with precedence 0
  • partially defined
  • solution complete, i.e., able to compute all solutions

(?) :: a -> a -> a  Non-deterministic 

Non-deterministic choice par excellence. The value of x ? y is either x or y.

Further infos:
  • defined as right-associative infix operator with precedence 0
  • solution complete, i.e., able to compute all solutions

anyOf :: [a] -> a  Non-deterministic 

Returns non-deterministically any element of a list.

unknown :: Data a => a  Non-deterministic 

Evaluates to a fresh free variable.

Further infos:
  • solution complete, i.e., able to compute all solutions

failed :: a  Deterministic 

A non-reducible polymorphic function. It is useful to express a failure in a search branch of the execution.

Further infos:
  • externally defined

error :: String -> a  Deterministic 

Aborts the execution with an error message.

apply :: (a -> b) -> a -> b  Deterministic 

Further infos:
  • externally defined

cond :: Bool -> a -> a  Deterministic 

Further infos:
  • externally defined

letrec :: a -> a -> Bool  Deterministic 

Further infos:
  • externally defined

failure :: a -> b -> c  Deterministic 

Further infos:
  • externally defined

PEVAL :: a -> a  Deterministic 

Identity function used by the partial evaluator to mark expressions to be partially evaluated.

Further infos:
  • solution complete, i.e., able to compute all solutions