Module "AllSolutions.curry"

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.
In contrast the "old" concept of encapsulated search (which could be applied to any subexpression in a computation), the operations to encapsulate search in this module are I/O actions in order to avoid some anomalities in the old concept.


 Exported names:

Datatypes:
SearchTree

Constructors:
SearchBranch | Solutions

Functions:
getAllFailures | getAllSolutions | getOneSolution | getOneValue | getSearchTree


 Summary of exported functions:

getAllSolutions  :: (a -> Success) -> IO [a]  deterministic 
          Gets all solutions to a constraint (currently, via an incomplete depth-first left-to-right strategy).
getOneSolution  :: (a -> Success) -> IO (Maybe a)  deterministic 
          Gets one solution to a constraint (currently, via an incomplete left-to-right strategy).
getOneValue  :: a -> IO (Maybe a)  deterministic 
          Gets one value of an expression (currently, via an incomplete left-to-right strategy).
getAllFailures  :: a -> (a -> Success) -> IO [a]  deterministic 
          Returns a list of values that do not satisfy a given constraint.
getSearchTree  :: [a] -> (b -> Success) -> IO (SearchTree b a)  deterministic 
          Computes a tree of solutions where the first argument determines the branching level of the tree.

 Imported modules:

Prelude

 Exported datatypes:

SearchTree

A search tree for representing search structures.

Constructors:

SearchBranch :: [(b,SearchTree a b)] -> SearchTree a b
Solutions :: [a] -> SearchTree a b



 Exported functions:

getAllSolutions :: (a -> Success) -> IO [a]  deterministic 

Gets all solutions to a constraint (currently, via an incomplete depth-first left-to-right strategy). Conceptually, all solutions are computed on a copy of the constraint, i.e., the evaluation of the constraint does not share any results. Moreover, this evaluation suspends if the constraints contain unbound variables. Similar to Prolog's findall.


getOneSolution :: (a -> Success) -> IO (Maybe a)  deterministic 

Gets one solution to a constraint (currently, via an incomplete left-to-right strategy). Returns Nothing if the search space is finitely failed.


getOneValue :: a -> IO (Maybe a)  deterministic 

Gets one value of an expression (currently, via an incomplete left-to-right strategy). Returns Nothing if the search space is finitely failed.


getAllFailures :: a -> (a -> Success) -> IO [a]  deterministic 

Returns a list of values that do not satisfy a given constraint.

Example call:  (getAllFailures x c)

Parameters:
x - an expression (a generator evaluable to various values)
c - a constraint that should not be satisfied
Returns:
A list of all values of e such that (c e) is not provable

getSearchTree :: [a] -> (b -> Success) -> IO (SearchTree b a)  deterministic 

Computes a tree of solutions where the first argument determines the branching level of the tree. For each element in the list of the first argument, the search tree contains a branch node with a child tree for each value of this element. Moreover, evaluations of elements in the branch list are shared within corresponding subtrees.



Generated by CurryDoc (Version 0.4.1 of June 7, 2007) at Aug 28 15:25:25 2008