The standard prelude of Curry. All top-level functions defined in this module are always available in any Curry program.
| Exported names: |
Datatypes:
()
| (,)
| (,,)
| (,,,)
| (,,,,)
| (,,,,,)
| (,,,,,,)
| (,,,,,,,)
| (,,,,,,,,)
| (,,,,,,,,,)
| (,,,,,,,,,,)
| (,,,,,,,,,,,)
| (,,,,,,,,,,,,)
| (,,,,,,,,,,,,,)
| (,,,,,,,,,,,,,,)
| Bool
| Char
| Either
| Float
| Int
| IO
| Maybe
| Ordering
| String
| Success
| []
Constructors:
()
| (,)
| (,,)
| (,,,)
| (,,,,)
| (,,,,,)
| (,,,,,,)
| (,,,,,,,)
| (,,,,,,,,)
| (,,,,,,,,,)
| (,,,,,,,,,,)
| (,,,,,,,,,,,)
| (,,,,,,,,,,,,)
| (,,,,,,,,,,,,,)
| (,,,,,,,,,,,,,,)
| :
| EQ
| False
| GT
| Just
| Left
| LT
| Nothing
| Right
| True
| []
Functions:
!!
| $
| $!
| $!!
| $#
| $##
| &
| &&
| &>
| *
| +
| ++
| -
| .
| /=
| <
| <=
| =:<<=
| =:<=
| =:=
| ==
| >
| >=
| >>
| >>=
| ?
| all
| and
| any
| appendFile
| apply
| best
| break
| browse
| browseList
| catchFail
| chr
| compare
| concat
| concatMap
| cond
| const
| curry
| div
| done
| doSolve
| drop
| dropWhile
| either
| elem
| ensureNotFree
| ensureSpine
| enumFrom
| enumFromThen
| enumFromThenTo
| enumFromTo
| error
| failed
| failure
| filter
| findall
| findfirst
| flip
| foldl
| foldl1
| foldr
| foldr1
| fst
| getAllValues
| getChar
| getLine
| getSomeValue
| groundNormalForm
| head
| id
| ifVar
| if_then_else
| inject
| iterate
| length
| letrec
| lines
| lookup
| map
| mapIO
| mapIO_
| max
| maybe
| min
| mod
| negate
| negateFloat
| normalForm
| not
| notElem
| null
| once
| or
| ord
| otherwise
| prim_appendFile
| prim_chr
| prim_error
| prim_Int_div
| prim_Int_minus
| prim_Int_mod
| prim_Int_plus
| prim_Int_times
| prim_negateFloat
| prim_ord
| prim_putChar
| prim_readFile
| prim_readFileContents
| prim_show
| prim_writeFile
| print
| putChar
| putStr
| putStrLn
| PEVAL
| readFile
| repeat
| replicate
| return
| reverse
| seq
| sequenceIO
| sequenceIO_
| show
| snd
| solveAll
| solveAll2
| span
| splitAt
| success
| tail
| take
| takeWhile
| try
| uncurry
| unknown
| unlines
| unpack
| until
| unwords
| unzip
| unzip3
| words
| writeFile
| zip
| zip3
| zipWith
| zipWith3
| ||
| Summary of exported functions: |
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
| Imported modules: |
| Exported datatypes: |
Constructors:
:: ()
Constructors:
:: [] a
:: a -> [a] -> [] a
Constructors:
:: a -> b -> (,) a b
Constructors:
:: a -> b -> c -> (,,) a b c
Constructors:
:: a -> b -> c -> d -> (,,,) a b c d
Constructors:
:: a -> b -> c -> d -> e -> (,,,,) a b c d e
Constructors:
:: a -> b -> c -> d -> e -> f -> (,,,,,) a b c d e f
Constructors:
:: a -> b -> c -> d -> e -> f -> g -> (,,,,,,) a b c d e f g
Constructors:
:: a -> b -> c -> d -> e -> f -> g -> h -> (,,,,,,,) a b c d e f g h
Constructors:
:: a -> b -> c -> d -> e -> f -> g -> h -> i -> (,,,,,,,,) a b c d e f g h i
Constructors:
:: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> (,,,,,,,,,) a b c d e f g h i j
Constructors:
:: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> (,,,,,,,,,,) a b c d e f g h i j k
Constructors:
:: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> (,,,,,,,,,,,) a b c d e f g h i j k l
Constructors:
:: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> (,,,,,,,,,,,,) a b c d e f g h i j k l m
Constructors:
:: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> (,,,,,,,,,,,,,) a b c d e f g h i j k l m n
Constructors:
:: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> (,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o
Type synonym: String = [Char]
Constructors:
Constructors:
Constructors:
Constructors:
:: Bool
:: Bool
Ordering type. Useful as a result of comparison functions.
Constructors:
:: Ordering
:: Ordering
:: Ordering
Constructors:
Constructors:
:: Maybe a
:: a -> Maybe a
Constructors:
:: a -> Either a b
:: b -> Either a b
Constructors:
| Exported functions: |
:: (a -> b) -> (c -> a) -> c -> b
Function composition.
:: a -> a
Identity function.
:: a -> b -> a
Constant function.
:: ((a,b) -> c) -> a -> b -> c
Converts an uncurried function to a curried function.
:: (a -> b -> c) -> (a,b) -> c
Converts an curried function to a function on pairs.
:: (a -> b -> c) -> b -> a -> c
(flip f) is identical to f but with the order of arguments reversed.
:: (a -> Bool) -> (a -> a) -> a -> a
Repeats application of a function until a predicate holds.
:: a -> b -> b
Evaluates the first argument to head normal form (which could also be a free variable) and returns the second argument.
:: a -> a
Evaluates the argument to head normal form and returns it. Suspends until the result is bound to a non-variable term.
:: [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.
:: (a -> b) -> a -> b
Right-associative application with strict evaluation of its argument.
:: (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.
:: String -> a
Aborts the execution with an error message.
:: String -> a
:: 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 []
:: Bool -> Bool -> Bool
Sequential conjunction on Booleans.
:: Bool -> Bool -> Bool
Sequential disjunction on Booleans.
:: Bool -> Bool
Negation on Booleans.
:: Bool
Useful name for the last condition in a sequence of conditional equations.
:: Bool -> a -> a -> a
The standard conditional. It suspends if the condition is a free variable.
:: a -> a -> Bool
Equality on finite ground data terms.
:: a -> a -> Bool
Disequality.
:: a -> a -> Ordering
Comparison of arbitrary ground data terms. Data constructors are compared in the order of their definition in the datatype declarations and recursively in the arguments.
:: a -> a -> Bool
Less-than on ground data terms.
:: a -> a -> Bool
Greater-than on ground data terms.
:: a -> a -> Bool
Less-or-equal on ground data terms.
:: a -> a -> Bool
Greater-or-equal on ground data terms.
:: a -> a -> a
Maximum of ground data terms.
:: a -> a -> a
Minimum of ground data terms.
:: (a,b) -> a
Selects the first component of a pair.
:: (a,b) -> b
Selects the second component of a pair.
:: [a] -> a
Computes the first element of a list.
:: [a] -> [a]
Computes the remaining elements of a list.
:: [a] -> Bool
Is a list empty?
:: [a] -> [a] -> [a]
Concatenates two lists. Since it is flexible, it could be also used to split a list into two sublists etc.
:: [a] -> Int
Computes the length of a list.
:: [a] -> Int -> a
List index (subscript) operator, head has index 0.
:: (a -> b) -> [a] -> [b]
Map a function on all elements of a list.
:: (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
:: (a -> a -> a) -> [a] -> a
Accumulates a non-empty list from left to right.
:: (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)...))
:: (a -> a -> a) -> [a] -> a
Accumulates a non-empty list from right to left:
:: (a -> Bool) -> [a] -> [a]
Filters all elements satisfying a given predicate in a list.
:: [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.
:: [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.
:: (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 (,)
:: (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 (,,)
:: [(a,b)] -> ([a],[b])
Transforms a list of pairs into a pair of lists.
:: [(a,b,c)] -> ([a],[b],[c])
Transforms a list of triples into a triple of lists.
:: [[a]] -> [a]
Concatenates a list of lists into one list.
:: (a -> [b]) -> [a] -> [b]
Maps a function from elements to lists and merges the result into one list.
:: (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),...]
:: a -> [a]
Infinite list where all elements have the same value.
Thus, repeat x = [x, x, x,...]
:: Int -> a -> [a]
List of length n where all elements have the same value.
:: Int -> [a] -> [a]
Returns prefix of length n.
:: Int -> [a] -> [a]
Returns suffix without first n elements.
:: Int -> [a] -> ([a],[a])
(splitAt n xs) is equivalent to (take n xs, drop n xs)
:: (a -> Bool) -> [a] -> [a]
Returns longest prefix with elements satisfying a predicate.
:: (a -> Bool) -> [a] -> [a]
Returns suffix without takeWhile prefix.
:: (a -> Bool) -> [a] -> ([a],[a])
(span p xs) is equivalent to (takeWhile p xs, dropWhile p xs)
:: (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.
:: 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.
:: [String] -> String
Concatenates a list of strings with terminating newlines.
:: String -> [String]
Breaks a string into a list of words where the words are delimited by white spaces.
:: [String] -> String
Concatenates a list of strings with a blank between two strings.
:: [a] -> [a]
Reverses the order of all elements in a list.
:: [Bool] -> Bool
Computes the conjunction of a Boolean list.
:: [Bool] -> Bool
Computes the disjunction of a Boolean list.
:: (a -> Bool) -> [a] -> Bool
Is there an element in a list satisfying a given predicate?
:: (a -> Bool) -> [a] -> Bool
Is a given predicate satisfied by all elements in a list?
:: a -> [a] -> Bool
Element of a list?
:: a -> [a] -> Bool
Not element of a list?
:: a -> [(a,b)] -> Maybe b
Looks up a key in an association list.
:: Int -> [Int]
Generates an infinite sequence of ascending integers.
:: Int -> Int -> [Int]
Generates an infinite sequence of integers with a particular in/decrement.
:: Int -> Int -> [Int]
Generates a sequence of ascending integers.
:: Int -> Int -> Int -> [Int]
Generates a sequence of integers with a particular in/decrement.
:: Char -> Int
Converts a character into its ASCII value.
:: Char -> Int
:: Int -> Char
Converts an ASCII value into a character.
:: Int -> Char
:: Int -> Int -> Int
Adds two integers.
:: Int -> Int -> Int
:: Int -> Int -> Int
Subtracts two integers.
:: Int -> Int -> Int
:: Int -> Int -> Int
Multiplies two integers.
:: Int -> Int -> Int
:: Int -> Int -> Int
Integer division. The value is the integer quotient of its arguments
and always truncated towards zero.
Thus, the value of 13 `div` 5 is 2,
and the value of -15 `div` 4 is -3.
:: Int -> Int -> Int
:: Int -> Int -> Int
Integer remainder. The value is the remainder of the integer division and
it obeys the rule x `mod` y = x - y * (x `div` y).
Thus, the value of 13 `mod` 5 is 3,
and the value of -15 `mod` 4 is -3.
:: Int -> Int -> Int
:: Int -> Int
Unary minus. Usually written as "- e".
:: Float -> Float
Unary minus on Floats. Usually written as "-e".
:: Float -> Float
:: a -> a -> Success
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).
:: Success
The always satisfiable constraint.
:: Success -> Success -> Success
Concurrent conjunction on constraints. An expression like (c1 & c2) is evaluated by evaluating the constraints c1 and c2 in a concurrent manner.
:: Success -> a -> a
Constrained expression. An expression like (c &> e) is evaluated by first solving constraint c and then evaluating e.
:: a -> (b -> a) -> Maybe b -> a
:: (a -> b) -> (c -> b) -> Either a c -> b
:: IO a -> (a -> IO b) -> IO b
Sequential composition of actions.
Example call: (a >>= fa)
a
- An action
fa
- A function from a value into an action
:: a -> IO a
The empty action that directly returns its argument.
:: IO a -> IO b -> IO b
Sequential composition of actions.
Example call: (a1 >> a2)
a1
- An action
a2
- An action
:: IO ()
The empty action that returns nothing.
:: Char -> IO ()
An action that puts its character argument on standard output.
:: Char -> IO ()
:: IO Char
An action that reads a character from standard output and returns it.
:: String -> IO String
An action that (lazily) reads a file and returns its contents.
:: String -> IO String
:: String -> String
:: String -> String -> IO ()
An action that writes a file.
Example call: (writeFile filename contents)
filename
- The name of the file to be written.
contents
- The contents to be written to the file.
:: String -> String -> IO ()
:: 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)
filename
- The name of the file to be written.
contents
- The contents to be appended to the file.
:: String -> String -> IO ()
:: IO a -> IO a -> IO a
Catches a possible failure during the execution of an I/O action.
(catchFail act err):
apply action act and, if it fails,
apply action err
:: String -> IO ()
Action to print a string on stdout.
:: String -> IO ()
Action to print a string with a newline on stdout.
:: IO String
Action to read a line from stdin.
:: a -> String
Converts an arbitrary term into an external string representation.
:: a -> String
:: a -> IO ()
Converts a term into a string and prints it.
:: Success -> IO ()
Solves a constraint as an I/O action. Note: the constraint should be always solvable in a deterministic way
:: [IO a] -> IO [a]
Executes a sequence of I/O actions and collects all results in a list.
:: [IO a] -> IO ()
Executes a sequence of I/O actions and ignores the results.
:: (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.
:: (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.
:: a -> a -> a
Non-deterministic choice par excellence. The value of x ? y is either x or y.
Example call: (x ? y)
x
- The right argument.
y
- The left argument.
:: a
Evaluates to a fresh free variable.
:: a -> IO [a]
Gets all values of an expression (currently, via an incomplete depth-first strategy). Conceptually, all values are computed on a copy of the expression, i.e., the evaluation of the expression does not share any results. Moreover, the evaluation suspends as long as the expression contains unbound variables. Similar to Prolog's findall.
:: a -> IO a
Gets a value of an expression (currently, via an incomplete depth-first strategy). The expression must have a value, otherwise the computation fails. Conceptually, the value is computed on a copy of the expression, i.e., the evaluation of the expression does not share any results. Moreover, the evaluation suspends as long as the expression contains unbound variables.
:: (a -> Success) -> [a -> Success]
Basic search control operator.
:: (a -> Success) -> (a -> Success) -> a -> Success
Inject operator which adds the application of the unary procedure p to the search variable to the search goal taken from Oz. p x comes before g x to enable a test+generate form in a sequential implementation.
:: (a -> Success) -> [a -> Success]
Computes all solutions via a a depth-first strategy.
:: (a -> Success) -> [a -> Success]
:: (a -> Success) -> a -> Success
Gets the first solution via a depth-first strategy.
:: (a -> Success) -> (a -> a -> Bool) -> [a -> Success]
Gets the best solution via a depth-first strategy according to a specified operator that can always take a decision which of two solutions is better. In general, the comparison operation should be rigid in its arguments!
:: (a -> Success) -> [a]
Gets all solutions via a depth-first strategy and unpack the values from the lambda-abstractions. Similar to Prolog's findall.
:: (a -> Success) -> a
Gets the first solution via a depth-first strategy and unpack the values from the search goals.
:: (a -> Success) -> IO ()
Shows the solution of a solved constraint.
:: [a -> Success] -> IO ()
Unpacks solutions from a list of lambda abstractions and write them to the screen.
:: (a -> Success) -> a
Unpacks a solution's value from a (solved) search goal.
:: a -> a
Identity function used by the partial evaluator to mark expressions to be partially evaluated.
:: a -> a
Evaluates the argument to normal form and returns it.
:: 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.
:: (a -> b) -> a -> b
:: Success -> a -> a
:: a -> a -> Success
:: a -> a -> Success
Non-strict equational constraint. Experimental.
:: a -> a -> Success
Non-strict equational constraint for linear function patterns. Thus, it must be ensured that the first argument is always (after evalutation by narrowing) a linear pattern. Experimental.
:: a -> b -> b -> b
internal function to implement =:<=
:: a -> b -> c
internal operation to implement failure reporting