Module Prelude

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

Summary of exported operations:

(.) :: (a -> b) -> (c -> a) -> c -> b   
Function composition.
id :: a -> a   
Identity function.
const :: a -> b -> a   
Constant function.
curry :: ((a,b) -> c) -> a -> b -> c   
Converts an uncurried function to a curried function.
uncurry :: (a -> b -> c) -> (a,b) -> c   
Converts an curried function to a function on pairs.
flip :: (a -> b -> c) -> b -> a -> c   
(flip f) is identical to f but with the order of arguments reversed.
until :: (a -> Bool) -> (a -> a) -> a -> a   
Repeats application of a function until a predicate holds.
seq :: a -> b -> b   
Evaluates the first argument to head normal form (which could also be a free variable) and returns the second argument.
ensureNotFree :: a -> a   
Evaluates the argument to head normal form and returns it.
ensureSpine :: [a] -> [a]   
Evaluates the argument to spine form and returns it.
($) :: (a -> b) -> a -> b   
Right-associative application.
($!) :: (a -> b) -> a -> b   
Right-associative application with strict evaluation of its argument to head normal form.
($!!) :: (a -> b) -> a -> b   
Right-associative application with strict evaluation of its argument to normal form.
($#) :: (a -> b) -> a -> b   
Right-associative application with strict evaluation of its argument to a non-variable term.
($##) :: (a -> b) -> a -> b   
Right-associative application with strict evaluation of its argument to ground normal form.
error :: String -> a   
Aborts the execution with an error message.
failed :: a   
A non-reducible polymorphic function.
(&&) :: Bool -> Bool -> Bool   
Sequential conjunction on Booleans.
(||) :: Bool -> Bool -> Bool   
Sequential disjunction on Booleans.
not :: Bool -> Bool   
Negation on Booleans.
otherwise :: Bool   
Useful name for the last condition in a sequence of conditional equations.
if_then_else :: Bool -> a -> a -> a   
The standard conditional.
solve :: Bool -> Bool   
Enforce a Boolean condition to be true.
(&>) :: Bool -> a -> a   
Conditional expression.
(=:=) :: a -> a -> Bool   
The equational constraint.
(&) :: Bool -> Bool -> Bool   
Concurrent conjunction.
fst :: (a,b) -> a   
Selects the first component of a pair.
snd :: (a,b) -> b   
Selects the second component of a pair.
head :: [a] -> a   
Computes the first element of a list.
tail :: [a] -> [a]   
Computes the remaining elements of a list.
null :: [a] -> Bool   
Is a list empty?
(++) :: [a] -> [a] -> [a]   
Concatenates two lists.
length :: [a] -> Int   
Computes the length of a list.
(!!) :: [a] -> Int -> a   
List index (subscript) operator, head has index 0.
map :: (a -> b) -> [a] -> [b]   
Map a function on all elements of a list.
foldl :: (a -> b -> a) -> a -> [b] -> a   
Accumulates all list elements by applying a binary operator from left to right.
foldl1 :: (a -> a -> a) -> [a] -> a   
Accumulates a non-empty list from left to right.
foldr :: (a -> b -> b) -> b -> [a] -> b   
Accumulates all list elements by applying a binary operator from right to left.
foldr1 :: (a -> a -> a) -> [a] -> a   
Accumulates a non-empty list from right to left:
filter :: (a -> Bool) -> [a] -> [a]   
Filters all elements satisfying a given predicate in a list.
zip :: [a] -> [b] -> [(a,b)]   
Joins two lists into one list of pairs.
zip3 :: [a] -> [b] -> [c] -> [(a,b,c)]   
Joins three lists into one list of triples.
zipWith :: (a -> b -> c) -> [a] -> [b] -> [c]   
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]   
Joins three lists into one list by applying a combination function to corresponding triples of elements.
unzip :: [(a,b)] -> ([a],[b])   
Transforms a list of pairs into a pair of lists.
unzip3 :: [(a,b,c)] -> ([a],[b],[c])   
Transforms a list of triples into a triple of lists.
concat :: [[a]] -> [a]   
Concatenates a list of lists into one list.
concatMap :: (a -> [b]) -> [a] -> [b]   
Maps a function from elements to lists and merges the result into one list.
iterate :: (a -> a) -> a -> [a]   
Infinite list of repeated applications of a function f to an element x.
repeat :: a -> [a]   
Infinite list where all elements have the same value.
replicate :: Int -> a -> [a]   
List of length n where all elements have the same value.
take :: Int -> [a] -> [a]   
Returns prefix of length n.
drop :: Int -> [a] -> [a]   
Returns suffix without first n elements.
splitAt :: Int -> [a] -> ([a],[a])   
(splitAt n xs) is equivalent to (take n xs, drop n xs)
takeWhile :: (a -> Bool) -> [a] -> [a]   
Returns longest prefix with elements satisfying a predicate.
dropWhile :: (a -> Bool) -> [a] -> [a]   
Returns suffix without takeWhile prefix.
span :: (a -> Bool) -> [a] -> ([a],[a])   
(span p xs) is equivalent to (takeWhile p xs, dropWhile p xs)
break :: (a -> Bool) -> [a] -> ([a],[a])   
(break p xs) is equivalent to (takeWhile (not.p) xs, dropWhile (not.p) xs).
lines :: String -> [String]   
Breaks a string into a list of lines where a line is terminated at a newline character.
unlines :: [String] -> String   
Concatenates a list of strings with terminating newlines.
words :: String -> [String]   
Breaks a string into a list of words where the words are delimited by white spaces.
unwords :: [String] -> String   
Concatenates a list of strings with a blank between two strings.
reverse :: [a] -> [a]   
Reverses the order of all elements in a list.
and :: [Bool] -> Bool   
Computes the conjunction of a Boolean list.
or :: [Bool] -> Bool   
Computes the disjunction of a Boolean list.
any :: (a -> Bool) -> [a] -> Bool   
Is there an element in a list satisfying a given predicate?
all :: (a -> Bool) -> [a] -> Bool   
Is a given predicate satisfied by all elements in a list?
elem :: Eq a => a -> [a] -> Bool   
Element of a list?
notElem :: Eq a => a -> [a] -> Bool   
Not element of a list?
lookup :: Eq a => a -> [(a,b)] -> Maybe b   
Looks up a key in an association list.
enumFrom_ :: Int -> [Int]   
Generates an infinite sequence of ascending integers.
enumFromThen_ :: Int -> Int -> [Int]   
Generates an infinite sequence of integers with a particular in/decrement.
enumFromTo_ :: Int -> Int -> [Int]   
Generates a sequence of ascending integers.
enumFromThenTo_ :: Int -> Int -> Int -> [Int]   
Generates a sequence of integers with a particular in/decrement.
ord :: Char -> Int   
Converts a character into its ASCII value.
chr :: Int -> Char   
Converts a Unicode value into a character.
negate_ :: Int -> Int   
Unary minus.
negateFloat :: Float -> Float   
Unary minus on Floats.
success :: Bool   
The always satisfiable constraint.
maybe :: a -> (b -> a) -> Maybe b -> a   
either :: (a -> b) -> (c -> b) -> Either a c -> b   
done :: IO ()   
The empty IO action that returns nothing.
putChar :: Char -> IO ()   
An action that puts its character argument on standard output.
getChar :: IO Char   
An action that reads a character from standard output and returns it.
readFile :: String -> IO String   
An action that (lazily) reads a file and returns its contents.
writeFile :: String -> String -> IO ()   
An action that writes a file.
appendFile :: String -> String -> IO ()   
An action that appends a string to a file.
putStr :: String -> IO ()   
Action to print a string on stdout.
putStrLn :: String -> IO ()   
Action to print a string with a newline on stdout.
getLine :: IO String   
Action to read a line from stdin.
userError :: String -> IOError   
A user error value is created by providing a description of the error situation as a string.
ioError :: IOError -> IO a   
Raises an I/O exception with a given error value.
showError :: IOError -> String   
Shows an error values as a string.
catch :: IO a -> (IOError -> IO a) -> IO a   
Catches a possible error or failure during the execution of an I/O action.
print :: Show a => a -> IO ()   
Converts a term into a string and prints it.
doSolve :: Bool -> IO ()   
Solves a constraint as an I/O action.
sequenceIO :: [IO a] -> IO [a]   
Executes a sequence of I/O actions and collects all results in a list.
sequenceIO_ :: [IO a] -> IO ()   
Executes a sequence of I/O actions and ignores the results.
mapIO :: (a -> IO b) -> [a] -> IO [b]   
Maps an I/O action function on a list of elements.
mapIO_ :: (a -> IO b) -> [a] -> IO ()   
Maps an I/O action function on a list of elements.
foldIO :: (a -> b -> IO a) -> a -> [b] -> IO a   
Folds a list of elements using an binary I/O action and a value for the empty list.
liftIO :: (a -> b) -> IO a -> IO b   
Apply a pure function to the result of an I/O action.
forIO :: [a] -> (a -> IO b) -> IO [b]   
Like mapIO, but with flipped arguments.
forIO_ :: [a] -> (a -> IO b) -> IO ()   
Like mapIO_, but with flipped arguments.
unless :: Bool -> IO () -> IO ()   
Performs an IO action unless the condition is met.
when :: Bool -> IO () -> IO ()   
Performs an IO action when the condition is met.
(?) :: a -> a -> a   
Non-deterministic choice par excellence.
anyOf :: [a] -> a   
unknown :: a   
Evaluates to a fresh free variable.
PEVAL :: a -> a   
Identity function used by the partial evaluator to mark expressions to be partially evaluated.
normalForm :: a -> a   
Evaluates the argument to normal form and returns it.
groundNormalForm :: a -> a   
Evaluates the argument to ground normal form and returns it.
apply :: (a -> b) -> a -> b   
cond :: Bool -> a -> a   
letrec :: a -> a -> Bool   
This operation is internally used by PAKCS to implement recursive lets by using cyclic term structures.
(=:<=) :: a -> a -> Bool   
Non-strict equational constraint.
(=:<<=) :: a -> a -> Bool   
Non-strict equational constraint for linear functional patterns.
shows :: Show a => a -> String -> String   
showChar :: Char -> String -> String   
showString :: String -> String -> String   
showParen :: Bool -> (String -> String) -> String -> String   
reads :: Read a => String -> [(a,String)]   
readParen :: Bool -> (String -> [(a,String)]) -> String -> [(a,String)]   
read :: Read a => String -> a   
lex :: String -> [(String,String)]   
boundedEnumFrom :: (Bounded a, Enum a) => a -> [a]   
boundedEnumFromThen :: (Bounded a, Enum a) => a -> a -> [a]   
asTypeOf :: a -> a -> a   
sequence :: Monad a => [a b] -> a [b]   
Evaluates a sequence of monadic actions and collects all results in a list.
sequence_ :: Monad a => [a b] -> a ()   
Evaluates a sequence of monadic actions and ignores the results.
mapM :: Monad a => (b -> a c) -> [b] -> a [c]   
Maps a monadic action function on a list of elements.
mapM_ :: Monad a => (b -> a c) -> [b] -> a ()   
Maps a monadic action function on a list of elements.
foldM :: Monad a => (b -> c -> a b) -> b -> [c] -> a b   
Folds a list of elements using a binary monadic action and a value for the empty list.
liftM :: Monad a => (b -> c) -> a b -> a c   
Apply a pure function to the result of a monadic action.
liftM2 :: Monad a => (b -> c -> d) -> a b -> a c -> a d   
Apply a pure binary function to the result of two monadic actions.
forM :: Monad a => [b] -> (b -> a c) -> a [c]   
Like mapM, but with flipped arguments.
forM_ :: Monad a => [b] -> (b -> a c) -> a ()   
Like mapM_, but with flipped arguments.
unlessM :: Monad a => Bool -> a () -> a ()   
Performs a monadic action unless the condition is met.
whenM :: Monad a => Bool -> a () -> a ()   
Performs a monadic action when the condition is met.

Exported datatypes:


Int

Constructors:


Float

Constructors:


Char

Constructors:


String

Type synonym: String = [Char]


Bool

Constructors:

  • False :: Bool
  • True :: Bool

Ordering

Ordering type. Useful as a result of comparison functions.

Constructors:

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

Success

Type synonym: Success = Bool


Maybe

Constructors:

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

Either

Constructors:

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

IO

Constructors:


IOError

The (abstract) type of error values. Currently, it distinguishes between general IO errors, user-generated errors (see userError), failures and non-determinism errors during IO computations. These errors can be caught by catch and shown by showError. 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

DET

Identity type synonym used to mark deterministic operations.

Type synonym: DET a = a


ShowS

Type synonym: ShowS = String -> String


ReadS

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


Exported operations:

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

Function composition.

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

id :: a -> a   

Identity function.

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

const :: a -> b -> a   

Constant function.

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

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

Converts an uncurried function to a curried function.

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

Converts an curried function to a function on pairs.

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

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

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

Repeats application of a function until a predicate holds.

seq :: a -> b -> b   

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   

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]   

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

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

Right-associative application.

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

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

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   

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   

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   

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

error :: String -> a   

Aborts the execution with an error message.

failed :: a   

A non-reducible polymorphic function. It is useful to express a failure in a search branch of the execution. It could be defined by: failed = head []

Further infos:
  • externally defined

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

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   

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   

Negation on Booleans.

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

otherwise :: Bool   

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

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

if_then_else :: Bool -> a -> a -> a   

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

solve :: Bool -> Bool   

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

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

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 -> Bool   

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
  • solution complete, i.e., able to compute all solutions
  • externally defined

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

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

fst :: (a,b) -> a   

Selects the first component of a pair.

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

snd :: (a,b) -> b   

Selects the second component of a pair.

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

tail :: [a] -> [a]   

Computes the remaining elements of a list.

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

null :: [a] -> Bool   

Is a list empty?

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

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

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   

Computes the length of a list.

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

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]   

Map a function on all elements of a list.

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

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

foldl f z [x1,x2,...,xn] = (...((z `f` x1) `f` x2) ...) `f` xn

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

Accumulates a non-empty list from left to right.

Further infos:
  • partially defined

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

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

foldr f z [x1,x2,...,xn] = (x1 `f` (x2 `f` ... (xn `f` z)...))

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

Accumulates a non-empty list from right to left:

Further infos:
  • partially defined

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

Filters all elements satisfying a given predicate in a list.

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

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)]   

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]   

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]   

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

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

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])   

Transforms a list of triples into a triple of lists.

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

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

Concatenates a list of lists into one list.

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

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

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

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]   

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]   

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

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

Returns prefix of length n.

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

Returns suffix without first n elements.

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

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

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

Returns longest prefix with elements satisfying a predicate.

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

Returns suffix without takeWhile prefix.

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

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

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

(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.

lines :: String -> [String]   

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   

Concatenates a list of strings with terminating newlines.

words :: String -> [String]   

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

unwords :: [String] -> String   

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

reverse :: [a] -> [a]   

Reverses the order of all elements in a list.

and :: [Bool] -> Bool   

Computes the conjunction of a Boolean list.

or :: [Bool] -> Bool   

Computes the disjunction of a Boolean list.

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

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

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

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

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

Element of a list?

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

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

Not element of a list?

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

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

Looks up a key in an association list.

enumFrom_ :: Int -> [Int]   

Generates an infinite sequence of ascending integers.

enumFromThen_ :: Int -> Int -> [Int]   

Generates an infinite sequence of integers with a particular in/decrement.

enumFromTo_ :: Int -> Int -> [Int]   

Generates a sequence of ascending integers.

enumFromThenTo_ :: Int -> Int -> Int -> [Int]   

Generates a sequence of integers with a particular in/decrement.

ord :: Char -> Int   

Converts a character into its ASCII value.

chr :: Int -> Char   

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.

negate_ :: Int -> Int   

Unary minus. Usually written as "- e".

negateFloat :: Float -> Float   

Unary minus on Floats. Usually written as "-e".

success :: Bool   

The always satisfiable constraint.

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

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

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

done :: IO ()   

The empty IO action that returns nothing.

putChar :: Char -> IO ()   

An action that puts its character argument on standard output.

getChar :: IO Char   

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

Further infos:
  • externally defined

readFile :: String -> IO String   

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

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

An action that writes a file.

Example call:
(writeFile filename contents)
Parameters:
  • filename : The name of the file to be written.
  • contents : The contents to be written to the file.

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

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

Example call:
(appendFile filename contents)
Parameters:
  • filename : The name of the file to be written.
  • contents : The contents to be appended to the file.

putStr :: String -> IO ()   

Action to print a string on stdout.

putStrLn :: String -> IO ()   

Action to print a string with a newline on stdout.

getLine :: IO String   

Action to read a line from stdin.

userError :: String -> IOError   

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   

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

showError :: IOError -> String   

Shows an error values as a string.

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

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

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

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

Converts a term into a string and prints it.

doSolve :: Bool -> IO ()   

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

sequenceIO :: [IO a] -> IO [a]   

Executes a sequence of I/O actions and collects all results in a list.

sequenceIO_ :: [IO a] -> IO ()   

Executes a sequence of I/O actions and ignores the results.

mapIO :: (a -> IO b) -> [a] -> IO [b]   

Maps an I/O action function on a list of elements. The results of all I/O actions are collected in a list.

mapIO_ :: (a -> IO b) -> [a] -> IO ()   

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

foldIO :: (a -> b -> IO a) -> a -> [b] -> IO a   

Folds a list of elements using an binary I/O action and a value for the empty list.

liftIO :: (a -> b) -> IO a -> IO b   

Apply a pure function to the result of an I/O action.

forIO :: [a] -> (a -> IO b) -> IO [b]   

Like mapIO, but with flipped arguments.

This can be useful if the definition of the function is longer than those of the list, like in

forIO [1..10] $ \n -> do ...

forIO_ :: [a] -> (a -> IO b) -> IO ()   

Like mapIO_, but with flipped arguments.

This can be useful if the definition of the function is longer than those of the list, like in

forIO_ [1..10] $ \n -> do ...

unless :: Bool -> IO () -> IO ()   

Performs an IO action unless the condition is met.

when :: Bool -> IO () -> IO ()   

Performs an IO action when the condition is met.

(?) :: a -> a -> a   

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

Example call:
(x ? y)
Parameters:
  • x : The right argument.
  • y : The left argument.
Returns:
either x or y non-deterministically.
Further infos:
  • defined as right-associative infix operator with precedence 0
  • solution complete, i.e., able to compute all solutions

anyOf :: [a] -> a   

unknown :: a   

Evaluates to a fresh free variable.

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

PEVAL :: a -> a   

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

normalForm :: a -> a   

Evaluates the argument to normal form and returns it.

groundNormalForm :: a -> a   

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

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

Further infos:
  • externally defined

cond :: Bool -> a -> a   

Further infos:
  • externally defined

letrec :: a -> a -> Bool   

This operation is internally used by PAKCS to implement recursive lets by using cyclic term structures. Basically, the effect of

letrec ones (1:ones)

(where ones is a logic variable) is the binding of ones to (1:ones).

Further infos:
  • externally defined

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

Non-strict equational constraint. Used to implement functional patterns.

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

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

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
  • externally defined

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

showChar :: Char -> String -> String   

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

showString :: String -> String -> String   

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

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

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

read :: Read a => String -> a   

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

boundedEnumFrom :: (Bounded a, Enum a) => a -> [a]   

boundedEnumFromThen :: (Bounded a, Enum a) => a -> a -> [a]   

asTypeOf :: a -> a -> a   

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

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

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

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

Evaluates a sequence of monadic actions and ignores the results.

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

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

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

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

Folds a list of elements using a binary monadic action and a value for the empty list.

liftM :: Monad a => (b -> c) -> a b -> a c   

Apply a pure function to the result of a monadic action.

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

Apply a pure binary function to the result of two monadic actions.

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

Like mapM, but with flipped arguments.

This can be useful if the definition of the function is longer than those of the list, like in

forM [1..10] $ \n -> do ...

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

Like mapM_, but with flipped arguments.

This can be useful if the definition of the function is longer than those of the list, like in

forM_ [1..10] $ \n -> do ...

unlessM :: Monad a => Bool -> a () -> a ()   

Performs a monadic action unless the condition is met.

whenM :: Monad a => Bool -> a () -> a ()   

Performs a monadic action when the condition is met.