PAKCS: System Libraries

Here is the collection of libraries contained in the distribution of PAKCS. 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 connects 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".

CHR

A representation of CHR rules in Curry, an interpreter for CHR rules based on the refined operational semantics of Duck et al. (ICLP 2004), and a compiler into CHR(Prolog).

CLP.FD

Library for finite domain constraint solving.

CLPB

This library provides a Boolean Constraint Solver based on BDDs.

CLPFD

Library for finite domain constraint solving.

The general structure of a specification of an FD problem is as follows:

CLPR

Library for constraint programming with arithmetic constraints over reals.

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.

Constraint

Some useful operations for constraint programming.

Database

Library for accessing and storing data in databases. The contents of a database is represented in this library as dynamic predicates that are defined by facts than can change over time and can be persistently stored. All functions in this library distinguishes between queries that access the database and transactions that manipulates data in the database. Transactions have a monadic structure. Both queries and transactions can be executed as I/O actions. However, arbitrary I/O actions cannot be embedded in transactions.

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.

Dynamic

Library for dynamic predicates. This paper contains a description of the basic ideas behind this library.

Either

Library with some useful operations for the Either data type.

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.

GUI

This library contains definitions and functions to implement graphical user interfaces for Curry programs. It is based on Tcl/Tk and its basic ideas are described in detail in this paper

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.

GlobalVariable

Library for handling global variables. A global variable has a name declared in the program. Its value (a data term possibly containing free variables) can be accessed and modified by IO actions.

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.

JavaScript

A library to represent JavaScript programs.

KeyDB

This module provides a general interface for databases (persistent predicates) where each entry consists of a key and an info part. The key is an integer and the info is arbitrary. All functions are parameterized with a dynamic predicate that takes an integer key as a first parameter.

KeyDatabase

This module provides a general interface for databases (persistent predicates) where each entry consists of a key and an info part. The key is an integer and the info is arbitrary. All functions are parameterized with a dynamic predicate that takes an integer key as a first parameter.

KeyDatabaseSQLite

This module provides a general interface for databases (persistent predicates) where each entry consists of a key and an info part. The key is an integer and the info is arbitrary. All functions are parameterized with a dynamic predicate that takes an integer key as a first parameter.

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.

Parser

Library with functional logic parser combinators.

PlProfileData

Library to access profile data of the Prolog system

Ports

Library for distributed programming with ports. This paper contains a description of the basic ideas behind this library.

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.

Prolog

A library defining a representation for Prolog programs together with a simple pretty printer. It does not cover all aspects of Prolog but might be useful for applications generating Prolog programs.

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.

Random

Library for pseudo-random number generation in Curry.

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.

System

Library to access parts of the system environment.

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.

GraphInductive

Library for inductive graphs (port of a Haskell library by Martin Erwig).

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.

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.

Libraries for web applications:

CategorizedHtmlList

This library provides functions to categorize a list of entities into a HTML page with an index access (e.g., "A-Z") to these entities.

HTML

Library for HTML and CGI programming. This paper contains a description of the basic ideas behind this library.

HtmlParser

This module contains a very simple parser for HTML documents.

Mail

This library contains functions for sending emails. The implementation might need to be adapted to the local environment.

Markdown

Library to translate markdown documents into HTML or LaTeX. The slightly restricted subset of the markdown syntax recognized by this implementation is documented in this page.

URL

Library for dealing with URLs (Uniform Resource Locators).

WUI

A library to support the type-oriented construction of Web User Interfaces (WUIs).

XML

Library for processing XML data.

XmlConv

Provides type-based combinators to construct XML converters. Arbitrary XML data can be represented as algebraic datatypes and vice versa. See here for a description of this library.

Libraries for meta-programming:

AbstractCurry

This library contains a definition for representing Curry programs in Curry and an I/O action to read Curry programs and transform them into this abstract representation.

AbstractCurryGoodies

This library provides some useful operations to write programs that generate AbstractCurry programs in a more compact and readable way.

AbstractCurryPrinter

This library contains a pretty printer for AbstractCurry programs in order to show an AbstractCurry program in standard Curry syntax.

AnnotatedFlatCurry

This library contains a version of FlatCurry's abstract syntax tree which can be annotated with arbitrary information due to a polymorphic type parameter. For instance, this could be used to annotate function declarations and expressions with their corresponding type.

AnnotatedFlatCurryGoodies

This library provides selector functions, test and update operations as well as some useful auxiliary functions for FlatCurry data terms. Most of the provided functions are based on general transformation functions that replace constructors with user-defined functions. For recursive datatypes the transformations are defined inductively over the term structure. This is quite usual for transformations on FlatCurry terms, so the provided functions can be used to implement specific transformations without having to explicitly state the recursion. Essentially, the tedious part of such transformations - descend in fairly complex term structures - is abstracted away, which hopefully makes the code more clear and brief.

AnnotatedFlatCurryPretty

This library provides pretty-printers for AnnotatedFlatCurry modules and all substructures (e.g., expressions). Note that annotations are ignored for pretty-printing.

CompactFlatCurry

This module contains functions to reduce the size of FlatCurry programs by combining the main module and all imports into a single program that contains only the functions directly or indirectly called from a set of main functions.

CurryStringClassifier

The Curry string classifier is a simple tool to process strings containing Curry source code. The source string is classified into the following categories:

FlatCurry

This library supports meta-programming, i.e., the manipulation of Curry programs in Curry. For this purpose, the library contains definitions of datatypes for the representation of so-called FlatCurry programs and an I/O action to read Curry programs and transform them into this representation.

FlatCurryGoodies

This library provides selector functions, test and update operations as well as some useful auxiliary functions for FlatCurry data terms. Most of the provided functions are based on general transformation functions that replace constructors with user-defined functions. For recursive datatypes the transformations are defined inductively over the term structure. This is quite usual for transformations on FlatCurry terms, so the provided functions can be used to implement specific transformations without having to explicitly state the recursion. Essentially, the tedious part of such transformations - descend in fairly complex term structures - is abstracted away, which hopefully makes the code more clear and brief.

FlatCurryPretty

This library provides pretty-printers for FlatCurry modules and all substructures (e.g., expressions).

FlatCurryRead

This library defines operations to read a FlatCurry programs or interfaces together with all its imported modules in the current load path.

FlatCurryShow

This library contains operations to transform FlatCurry programs into string representations, either in a FlatCurry format or in a Curry-like syntax.

FlatCurryXML

This library contains functions to convert FlatCurry programs into corresponding XML expressions and vice versa. This can be used to store Curry programs in a way independent of a Curry system or to use a Curry system, like PAKCS, as back end by other functional logic programming systems.

FlexRigid

This library provides a function to compute the rigid/flex status of a FlatCurry expression (right-hand side of a function definition).

PrettyAbstract

This library contains a pretty printer for AbstractCurry programs in order to show an AbstractCurry program in human-readable Curry syntax. In contrast to the library AbstractCurryPrinter, this library implements a better human-readable pretty printing of AbstractCurry programs.