KiCS2: System Libraries

Here is the collection of libraries contained in the distribution of KiCS2. Most of these libraries have been implemented during the development of larger Curry applications. If you have suggestions for changes/improvements or if you want to contribute your own library, please contact Michael Hanus.


General libraries:

AllSolutions

This module contains a collection of functions for obtaining lists of solutions to constraints. These operations are useful to encapsulate non-deterministic operations between I/O actions in order to connect the worlds of logic and functional programming and to avoid non-determinism failures on the I/O level.

AnsiCodes

Library for formatted output on terminals

Assertion

This module defines the datatype and operations for the Curry module tester "currytest".

CSV

Library for reading/writing files in CSV format. Files in CSV (comma separated values) format can be imported and exported by most spreadsheed and database applications.

Char

Library with some useful functions on characters.

Combinatorial

A collection of common non-deterministic and/or combinatorial operations. Many operations are intended to operate on sets. The representation of these sets is not hidden; rather sets are represented as lists. Ideally these lists contains no duplicate elements and the order of their elements cannot be observed. In practice, these conditions are not enforced.

Debug

This library contains some useful operation for debugging programs.

Directory

Library for accessing the directory structure of the underlying operating system.

Distribution

This module contains functions to obtain information concerning the current distribution of the Curry implementation, e.g., compiler version, load paths, front end.

Either

Library with some useful operations for the Either data type.

ErrorState

A combination of Error and state monad like ErrorT State in Haskell.

FileGoodies

A collection of useful operations when dealing with files.

FilePath

This library is a direct port of the Haskell library System.FilePath of Neil Mitchell.

Findall

Library with some operations for encapsulating search. Note that some of these operations are not fully declarative, i.e., the results depend on the order of evaluation and program rules. There are newer and better approaches the encpasulate search, in particular, set functions (see module SetFunctions), which should be used.

Float

A collection of operations on floating point numbers.

Format

The library provides some operations to format values of basic data types with arbitrary flags similarly to the printf statement of C.

Function

This module provides some utility functions for function application.

FunctionInversion

This module provides some utility functions for inverting functions.

GetOpt

This Module is a modified version of the Module System.Console.GetOpt by Sven Panne from the ghc-base package it has been adapted for Curry by Bjoern Peemoeller

Global

Library for handling global entities. A global entity has a name declared in the program. Its value can be accessed and modified by IO actions. Furthermore, global entities can be declared as persistent so that their values are stored across different program executions.

IO

Library for IO operations like reading and writing files that are not already contained in the prelude.

IOExts

Library with some useful extensions to the IO monad.

Integer

A collection of common operations on integer numbers. Most operations make no assumption on the precision of integers. Operation bitNot is necessarily an exception.

List

Library with some useful operations on lists.

Maybe

Library with some useful functions on the Maybe datatype.

NamedSocket

Library to support network programming with sockets that are addressed by symbolic names. In contrast to raw sockets (see library Socket), this library uses the Curry Port Name Server to provide sockets that are addressed by symbolic names rather than numbers.

Nat

Library defining natural numbers in Peano representation and some operations on this representation.

Parser

Library with functional logic parser combinators.

Prelude

The standard prelude of Curry. All top-level functions defined in this module are always available in any Curry program.

Pretty

This library provides pretty printing combinators. The interface is that of Daan Leijen's library linear-time, bounded implementation by Olaf Chitil. Note that the implementation of fill and fillBreak is not linear-time bounded Support of ANSI escape codes for formatting and colorisation of documents in text terminals (see https://en.wikipedia.org/wiki/ANSIescapecode)

Profile

Preliminary library to support profiling.

PropertyFile

A library to read and update files containing properties in the usual equational syntax, i.e., a property is defined by a line of the form prop=value where prop starts with a letter. All other lines (e.g., blank lines or lines starting with # are considered as comment lines and are ignored.

Read

Library with some functions for reading special tokens.

ReadNumeric

Library with some functions for reading and converting numeric tokens.

ReadShowTerm

Library for converting ground terms to strings and vice versa.

RegExp

A library to defined and match regular expressions. This library is used to translated integrated code in the form of POSIX extended regular expressions into Curry programs.

SetFunctions

This module contains an implementation of set functions. The general idea of set functions is described in:

ShowS

This library provides a type and combinators for show functions using functional lists.

Socket

Library to support network programming with sockets. In standard applications, the server side uses the operations listenOn and socketAccept to provide some service on a socket, and the client side uses the operation connectToSocket to request a service.

State

This library provides an implementation of the state monad.

System

Library to access parts of the system environment.

Test.Contract

This library defines some auxiliaries to check contracts based on specifications or pre- and postconditions provided in a Curry module. The interface might probably change with the further development of the contract implementation.

Test.EasyCheck

EasyCheck is a library for automated, property-based testing of Curry programs. The ideas behind EasyCheck are described in this paper. The CurryCheck tool automatically executes tests defined with this library. CurryCheck supports the definition of unit tests (also for I/O operations) and property tests parameterized over some arguments. CurryCheck is described in more detail in this paper.

Test.EasyCheckExec

EasyCheck is a library for automated, property-based testing of Curry programs. The ideas behind EasyCheck are described in this paper. This module implements the operations to actually execute the tests.

Test.Prop

This module defines the interface of properties that can be checked with the CurryCheck tool, an automatic property-based test tool based on the EasyCheck library. The ideas behind EasyCheck are described in this paper. CurryCheck automatically tests properties defined with this library. CurryCheck supports the definition of unit tests (also for I/O operations) and property tests parameterized over some arguments. CurryCheck is described in more detail in this paper.

Time

Library for handling date and time information.

Unsafe

Library containing unsafe operations. These operations should be carefully used (e.g., for testing or debugging). These operations should not be used in application programs!

Data structures and algorithms:

Array

Implementation of Arrays with Braun Trees. Conceptually, Braun trees are always infinite. Consequently, there is no test on emptiness.

Dequeue

An implementation of double-ended queues supporting access at both ends in constant amortized time.

FiniteMap

A finite map is an efficient purely functional data structure to store a mapping from keys to values. In order to store the mapping efficiently, an irreflexive(!) order predicate has to be given, i.e., the order predicate le should not satisfy (le x x) for some key x.

Random

Library for pseudo-random number generation in Curry.

RedBlackTree

Library with an implementation of red-black trees:

Serves as the base for both TableRBT and SetRBT All the operations on trees are generic, i.e., one has to provide two explicit order predicates ("lessThan" and "eq"below) on elements.

SCC

Computing strongly connected components

SearchTree

This library defines a representation of a search space as a tree and various search strategies on this tree. This module implements strong encapsulation as discussed in the JFLP'04 paper.

SearchTreeGenerators

This library implements some operations to generate search trees for various data types.

SearchTreeTraversal

Implements additional traversals on search trees.

SetRBT

Library with an implementation of sets as red-black trees.

Sort

A collection of useful functions for sorting and comparing characters, strings, and lists.

TableRBT

Library with an implementation of tables as red-black trees:

A table is a finite mapping from keys to values. All the operations on tables are generic, i.e., one has to provide an explicit order predicate ("cmp" below) on elements. Each inner node in the red-black tree contains a key-value association.

Traversal

Library to support lightweight generic traversals through tree-structured data. See here for a description of the library.

UnsafeSearchTree

This library defines a representation of a search space as a tree and various search strategies on this tree. This module implements strong encapsulation as discussed in this paper


Explanations of the icons used in the documentation:

  Operation is deterministic, i.e., defined by exclusive rules and depend only on deterministic operations
  Operation might be non-deterministic, i.e., it is defined by overlapping rules or depend on non-deterministic operations