Home
Manual
Contents
1. Curry programs This commands starts a graphical user interface to show the observation results and adds to the load path the directory containing the modules that must be imported in order to annotate a program with observation points Details about the use of COOSy can be found in the COOSy interface under the Info button and details about the general idea of observation debugging and the implementation of COOSy can be found in 11 xml Translate the currently loaded program module into an XML representation according to the format described in http www informatik uni kiel de curry flat Actually this yields an implementation independent representation of the corresponding FlatCurry program see Appendix A 1 4 for a description of FlatCurry If prog is the name of the currently loaded program the XML representation will be written into the file prog_flat xm1 peval Translate the currently loaded program module into an equivalent program where some subexpressions are partially evaluated so that these subexpressions are hopefully more ef ficiently executed An expression e to be partially evaluated must be marked in the source program by PEVAL e where PEVAL is defined as the identity function in the prelude so that it has no semantical meaning The partial evaluator translates a source program prog curry into the partially evaluated program in intermediate representation stored in
2. wCons6 la gt b gt c gt d gt e gt f g gt WuiSpec a gt WuiSpec b WuiSpec c gt WuiSpec d WuiSpec e WuiSpec f WuiSpec g WUI combinator for constructors of arity 6 The first argument is the ternary construc tor The further arguments are the WUI specifications for the argument types wCons6JS Maybe JSExp gt JSExp gt a gt b gt c def g WuiSpec a WuiSpec b WuiSpec c WuiSpec d WuiSpec e WuiSpec f gt WuiSpec 8 w Tuple WuiSpec a gt WuiSpec b gt WuiSpec c WuiSpec d gt WuiSpec e gt WuiSpec f WuiSpec g gt WuiSpec a b c d e f g WUI combinator for tuples of arity 7 wCons7 la gt b gt c gt d gt e gt gt 8 gt h gt WuiSpec a gt WuiSpec b gt WuiSpec c WuiSpec d WuiSpec e WuiSpec f gt WuiSpec g gt WuiSpec h WUI combinator for constructors of arity 7 The first argument is the ternary construc tor The further arguments are the WUI specifications for the argument types wCons7JS Maybe JSExp gt JSExp gt a gt b gt c gt d gt e gt f gt 8g gt b gt WuiSpec a WuiSpec b WuiSpec c gt WuiSpec d WuiSpec e WuiSpec f gt WuiSpec g gt WuiSpec h w8Tuple WuiSpec a gt WuiSpec b WuiSpec c gt WuiSpec d WuiSpec e gt WuiSpec f gt WuiSpec g gt WuiSpec h WuiSpec a b c d e f g h 226 WUI combinator
3. Find a solution that minimizes the domain variable v using a branch and bound algo rithm Maximize Int Option Maximize v Find a solution that maximizes the domain variable v using a branch and bound algo rithm Assumptions Int Option Assumptions x The variable x is unified with the number of choices made by the selected enumeration strategy when a solution is found RandomVariable Int Option RandomVariable x Select a random variable for instantiation where x is a seed value for the random numbers only supported by SWI Prolog RandomValue Int Option RandomValue x 66 Label variables with random integer values where x is a seed value for the random numbers only supported by SWI Prolog data FDExpr Exported constructors data FDConstr Exported constructors Exported functions domain Int gt Int FDExpr Operations to construct basic constraints Returns infinite list of FDVars with a given domain fd Int gt FDExpr Represent an integer value as an FD expression 4 FDExpr FDExpr gt FDExpr Addition of FD expressions FDExpr FDExpr FDExpr Subtraction of FD expressions FDExpr FDExpr FDExpr Multiplication of FD expressions FDExpr FDExpr FDConstr Equality of FD expressions FDExpr FDExpr FDConstr Disequality of FD expressions lt FDExpr
4. PAKCS 1 14 0 The Portland Aachen Kiel Curry System User Manual Version of 2015 11 27 Michael Hanus editor Additional Contributors Sergio Antoy Bernd BraBel Martin Engelke Klaus H ppner Johannes Koj Philipp Niederau Bjorn Peem ller Ramin Sadre Frank Steiner 1 University of Kiel Germany mh informatik uni kiel de 2 Portland State University USA antoy cs pdx edu 3 University of Kiel Germany bbr informatik uni kiel de 4 University of Kiel Germany menCinformatik uni kiel de 5 University of Kiel Germany klh informatik uni kiel de 6 RWTH Aachen Germany johannes koj sdm de 7 RWTH Aachen Germany philipp navigium de 8 University of Kiel Germany bjp informatik uni kiel de 9 RWTH Aachen Germany ramin lvs informatik rwth aachen de 10 LMU Munich Germany fst bio informatik uni muenchen de Contents Preface 1 Overview of PAKCS 1 1 General Use 1 2 Restrictions 1 3 Modules in PAKOCS ccooooor oo cu sera a a ee 2 PAKCS An Interactive Curry Development System 2 1 Invoking PAKCS 24 Comminds or PARCS oie o a A owe Be Ek e a a 23 plenas at PAROS lt lt cursa ES a Oa Pa ee ew Ee E 2 4 Using PAKCS in Batch Mode 0 0 00002 eee ee ee 25 Command Line Editing lt 4 ies remenar adega ta taa ae eed eS 2 6 Customization 2 7 Emacs Interface 3 Extensions 3 1 Recursive Variable Bindings 0 0 00 eee asasan 2a Pimetional Patterns omo i 4244
5. The leftmost variable with the smallest domain is selected also known as first fail prin ciple e FirstFailConstrained LabelingOption FirstFailConstrained The leftmost variable with the smallest domain and the most constraints on it is selected e Min LabelingOption Min The leftmost variable with the smalled lower bound is selected 69 Max LabelingOption Max The leftmost variable with the greatest upper bound is selected Step LabelingOption Step Make a binary choice between x b and x b for the selected variable x where b is the lower or upper bound of x default Enum LabelingOption Enum Make a multiple choice for the selected variable for all the values in its domain Bisect LabelingOption Bisect Make a binary choice between x lt m and x gt m for the selected variable x where m is the midpoint of the domain x also known as domain splitting Up LabelingOption Up The domain is explored for instantiation in ascending order default Down LabelingOption Down The domain is explored for instantiation in descending order All LabelingOption All Enumerate all solutions by backtracking default Minimize Int LabelingOption Minimize v Find a solution that minimizes the domain variable v using a branch and bound algo rithm Maximize Int LabelingOption Maximize v Find a solution that maximizes the doma
6. gt String String CExpr gt CExpr CRecUpdate CExpr String String CExpr gt CExpr data CLiteral Data type for representing literals occurring in an expression It is either an integer a float or a character constant Exported constructors e CIntc Int gt CLiteral e CFloatc Float CLiteral e CCharc Char CLiteral e CStringc String CLiteral data CStatement Data type for representing statements in do expressions and list comprehensions Exported constructors e CSExpr CExpr CStatement e CSPat CPattern CExpr CStatement e CSLet CLocalDec1 CStatement data CCaseType Type of case expressions Exported constructors e CRigid CCaseType e CFlex CCaseType 244 Exported functions version String Current version of AbstractCurry pre String gt String String Converts a string into a qualified name of the Prelude A 5 2 Library AbstractCurry Files This library defines various I O actions to read Curry programs and transform them into the AbstractCurry representation and to write AbstractCurry files Assumption an abstract Curry program is stored in file with extension acy in the subdirectory curry Exported functions readCurry String 10 CurryProg I O action which parses a Curry program and returns the corresponding typed Abstract Curry program Thus the argument is the file name without suffix curry or
7. Doc pretty print operator precedence declarations ppCTypeDecl Options CTypeDecl Doc pretty print type declarations like data type or newtype ppCFuncDecl Options gt CFuncDecl Doc pretty print a function declaration ppCFuncDeclWithoutSig Options CFuncDecl Doc pretty print a function declaration without signature ppCFuncSignature Options gt String String gt CTypeExpr Doc pretty print a function signature according to given options ppCTypeExpr Options CTypeExpr Doc pretty print a type expression ppCPattern Options gt CPattern Doc pretty print a pattern expression ppCLiteral Options gt CLiteral Doc pretty print given literal Int Float ppCExpr Options CExpr Doc 254 pretty print an expression ppCStatement Options CStatement Doc ppQFunc Options gt String String Doc pretty print a function name or constructor name qualified according to given options Use ppQType or ppType for pretty printing type names ppFunc String String Doc pretty print a function name or constructor name non qualified Use ppQType or ppType for pretty printing type names ppQType Options gt String String Doc pretty print a type QName qualified according to given options ppType String String Doc pretty print a type QName non qualified A 5 6 Library FlatCurry
8. String splitDirectories String gt String joinPath String String equalFilePath String String Bool makeRelative String String String normalise String String 97 isValid String Bool makeValid String String isRelative String Bool isAbsolute String Bool A 2 23 Library 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 In previous versions of PAKCS some of these operations were part of the standard prelude We keep them in this separate module in order to support a more portable standard prelude Exported functions getAllValues a gt 10 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 getSomeValue a gt 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
9. String String gt String String gt Fixity gt Fixity gt Int gt Int OpDecl gt OpDecl update operator declaration updOpName String String gt String String OpDecl gt OpDecl update name of operator declaration updOpFixity Fixity gt Fixity gt OpDecl OpDecl update fixity of operator declaration updOpPrecedence Int Int OpDecl OpDecl update precedence of operator declaration trFunc String String Int Visibility TypeExpr Rule gt a gt FuncDecl gt a transform function funcName FuncDecl gt String String get name of function funcArity FuncDecl Int get arity of function funcVisibility FuncDecl Visibility get visibility of function funcType FuncDecl TypeExpr get type of function funcRule FuncDecl Rule get rule of function updFunc String String gt String String Int gt Int gt Visibility gt Visibility TypeExpr gt TypeExpr gt Rule Rule FuncDecl gt FuncDecl update function updFuncName String String gt String String FuncDecl gt FuncDecl update name of function updFuncArity Int gt Int FuncDecl gt FuncDecl 268 update arity of function updFuncVisibility Visibility gt Visibility FuncDecl gt FuncDecl update visibility of function updFuncType TypeExpr gt TypeExpr FuncDe
10. Transforms a FlatCurry program term into a corresponding XML file flatCurry2Xml Prog XmlExp Transforms a FlatCurry program term into a corresponding XML expression xmlFile2FlatCurry String gt 10 Prog Reads an XML file with a FlatCurry program and returns the FlatCurry program xml2FlatCurry XmlExp Prog Transforms an XML term into a FlatCurry program 280 A 5 13 Library FlatCurry FlexRigid This library provides a function to compute the rigid flex status of a FlatCurry expression right hand side of a function definition Exported types data FlexRigidResult Datatype for representing a flex rigid status of an expression Exported constructors e UnknownFR FlexRigidResult e ConflictFR FlexRigidResult e KnownFlex FlexRigidResult e KnownRigid FlexRigidResult Exported functions getFlexRigid Expr gt FlexRigidResult Computes the rigid flex status of a FlatCurry expression This function checks all cases in this expression If the expression has rigid as well as flex cases which cannot be the case for source level programs but might occur after some program transformations the result ConflictFR is returned A 5 14 Library FlatCurry Compact 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 Exported ty
11. WuiHandler gt 10 HtmlForm I0 HtmlForm Puts a WUI into a HTML form containing holes for the WUI and the handler wuiWithErrorForm WuiSpec a gt a gt a I0 HtmlForm gt HtmlExp gt WuiHandler gt I0 HtmlForm HtmlExp WuiHandler Generates HTML editors and a handler from a WUI data specification an initial value and an update form In addition to wui2html we can provide a skeleton form used to show illegal inputs 221 A 4 9 Library WUljs A library to support the type oriented construction of Web User Interfaces WUIs The ideas behind the application and implementation of WUIs are described in a paper that is available via this web page In addition to the original library this version provides also support for JavaScript Exported types type Rendering HtmlExp HtmlExp A rendering is a function that combines the visualization of components of a data structure into some HTML expression data WuiHandler A handler for a WUI is an event handler for HTML forms possibly with some specific JavaScript code attached Exported constructors data WuiSpec The type of WUI specifications The first component are parameters specifying the behavior of this WUI type rendering error message and constraints on inputs The second component is a show function returning an HTML expression for the edit fields and a WUI state containing the CgiRefs to extract the values from the edi
12. a Transaction b Applies a function that yields transactions to all elements of a list executes the trans action sequentially and collects their results mapT_ a Transaction b a gt Transaction Applies a function that yields transactions to all elements of a list executes the trans actions sequentially and ignores their results 132 persistentSQLite String gt String gt String Int gt a Dynamic This function is used instead of dynamic or persistent to declare predicates whose facts are stored in an SQLite database If the provided database or the table do not exist they are created automatically when the declared predicate is accessed for the first time Multiple column names can be provided if the second argument of the predicate is a tuple with a matching arity Other record types are not supported If no column names are provided a table with a single column called info is created Columns of name rowid are not supported and lead to a run time error existsDBKey Int gt a Dynamic gt Int gt Query Bool Checks whether the predicate has an entry with the given key allDBKeys Int gt a Dynamic Query Int Returns a list of all stored keys Do not use this function unless the database is small allDBInfos Int gt a gt Dynamic gt Query a Returns a list of all info parts of stored entries Do not use this function unl
13. getRcVar String IO Maybe String Look up a specific configuration variable as specified by user in his rc file Upper case lowercase is ignored for the variable names getRcVars String I0 Maybe String Look up configuration variables as specified by user in his rc file Uppercase lowercase is ignored for the variable names splitModuleFileName String String gt String String Split the FilePath of a module into the directory prefix and the FilePath correspond ing to the module name For instance the call splitModuleFileName Data Set lib Data Set curry evaluates to 1ib Data Set curry This can be useful to compute output directories while retaining the hierarchical module structure splitModuleldentifiers String gt String Split up the components of a module identifier For instance splitModuleldentifiers Data Set evaluates to Data Set joinModuleldentifiers String String Join the components of a module identifier For instance joinModuleIdentifiers Data Set evaluates to Data Set stripCurrySuffix String String Strips the suffix curry or lcurry from a file name 86 modNameToPath String String Transforms a hierarchical module name into a path name i e replace the dots in the name by directory separator chars currySubdir String Name of the sub directory where auxiliary files fint fcy etc are stored inCur
14. gt I0 String Reads a file in CSV format and returns the list of records where each record is a list of strings readCSVFileWithDelims String gt String I0 String Reads a file in CSV format and returns the list of records where each record is a list of strings readCSV String gt String Reads a string in CSV format and returns the list of records where each record is a list of strings readCSVWithDelims String String String Reads a string in CSV format and returns the list of records where each record is a list of strings 78 A 2 14 Library 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 A dynamic predicate p with arguments of type t1 tn must be declared by p ti gt gt tn gt Dynamic p dynamic A dynamic predicate where all facts should be persistently stored in the directory DIR must be declared by p ti gt gt tn gt Dynamic p persistent file DIR Exported t
15. see also Section 1 3 The directory pakcshome too1s ui examples contains a few examples for such user interface specifications 44 14 Preprocessing FlatCurry Files After the invocation of the Curry front end to parse Curry programs and translate them into the intermediate FlatCurry representation one can apply transformations on the FlatCurry files before they are passed to the back end which translates the FlatCurry files into Prolog code These transformations are invoked by the FlatCurry preprocessor pakcs bin fycpp Currently only the FlatCurry file corresponding to the main module can be transformed A transformation can be specified as follows 1 Options to pakcs bin fcypp fpopt Apply functional pattern optimization see pakcs tools optimize NonStrictOpt curry for details compact Apply code compactification after parsing i e transform the main module and all its imported into one module and delete all non accessible functions compactexport Similar to compact but delete all functions that are not accessible from the exported functions of the main module compactmain f Similar to compact but delete all functions that are not accessible from the function f of the main module fcypp cmd Apply command cmd to the main module after parsing This is useful to in tegrate your own transformation into the compilation process Note that the command
16. ARule a Doc pretty print a function rule ppExp AExpr a Doc pretty print a top level expression ppExpr Int AExpr a Doc pretty print an expression ppAVarIndex Int a Doc pretty print an annotated variable ppVarIndex Int Doc pretty print a variable ppLiteral Literal Doc pretty print a literal showEscape Char String Escape character literal ppComb Int gt String String a AExpr b Doc Pretty print a constructor or function call ppDecls Int a AExpr b Doc pretty print a list of declarations ppDecl Int a AExpr b Doc pretty print a single declaration 286 ppCaseType CaseType Doc Pretty print the type of a case expression ppBranch ABranchExpr a Doc Pretty print a case branch ppPattern APattern a Doc Pretty print a pattern ppPrefixOp String String Doc pretty print a prefix operator ppInfixOp String String Doc pretty print an infix operator ppQName String String Doc Pretty print a qualified name isInfixOp String String Bool Check whether an operator is an infix operator isListId String String Bool Check whether an identifier represents a list isTupleld String String Bool Check whether an identifier represents a tuple indent Doc Doc Indentation A 5 17 Library FlatCurry Annotated Goodies This library provides selector functions test and update operations as well
17. Bool is function externally defined allVarsInFunc AFuncDecl a gt Int get variable names in a function declaration funcArgs AFuncDecl a gt Int a get arguments of function if not externally defined funcBody AFuncDecl a gt AExpr a get body of function if not externally defined funcRHS AFuncDecl a gt AExpr a rnmAllVarsInFunc Int gt Int gt AFuncDecl a AFuncDecl a rename all variables in function updQNamesInFunc String String gt String String AFuncDecl a gt AFuncDecl a update all qualified names in function updFuncArgs Int a gt Int a AFuncDecl a AFuncDecl a update arguments of function if not externally defined updFuncBody AExpr a AExpr a AFuncDecl a gt AFuncDecl a update body of function if not externally defined trRule a gt Int a gt AExpr a gt b gt a gt String gt b gt ARule a gt b transform rule ruleArgs ARule a gt Int a get rules arguments if it s not external ruleBody ARule a AExpr a get rules body if it s not external ruleExtDecl ARule a gt String get rules external declaration isRuleExternal ARule a gt Bool is rule external 294 updRule a gt a gt Int a gt Int a AExpr a gt AExpr a gt String gt String ARule a gt ARule a update rule updRuleArgs Int a Int a ARule a gt ARule a update
18. Creates a new directory with the given name if it does not already exist If the first parameter is True it will also create all missing parent directories removeDirectory String gt 10 Deletes a directory from the file system renameDirectory String String gt I0 Renames a directory getHomeDirectory 10 String Returns the home directory of the current user getTemporaryDirectory 10 String Returns the temporary directory of the operating system getAbsolutePath String gt 10 String Convert a path name into an absolute one For instance a leading is replaced by the current home directory removeFile String gt 10 Deletes a file from the file system renameFile String String gt I0 Renames a file copyFile String String gt I0 Copy the contents from one file to another file A 2 17 Library Distribution This module contains functions to obtain information concerning the current distribution of the Curry implementation e g compiler version load paths front end Exported types data FrontendTarget Data type for representing the different target files that can be produced by the front end of the Curry compiler Exported constructors e FCY FrontendTarget FCY 84 data FlatCurry file ending with fcy FINT FrontendTarget FINT FlatCurry interface file ending with fint ACY FrontendTarget ACY AbstractCurry file end
19. FDExpr FDConstr Less than constraint on FD expressions lt FDExpr FDExpr FDConstr Less than or equal constraint on FD expressions 67 gt FDExpr FDExpr FDConstr Greater than constraint on FD expressions gt FDExpr FDExpr FDConstr Greater than or equal constraint on FD expressions true FDConstr The always satisfied FD constraint FDConstr FDConstr FDConstr Conjunction of FD constraints andC FDConstr gt FDConstr Conjunction of a list of FD constraints allC a gt FDConstr gt a gt FDConstr Maps a constraint abstraction to a list of FD constraints and joins them allDifferent FDExpr gt FDConstr All different constraint on FD variables sum FDExpr FDRel gt FDExpr gt FDConstr Relates the sum of FD variables with some integer of FD variable scalarProduct FDExpr gt FDExpr FDRel gt FDExpr gt FDConstr scalarProduct cs vs relop v is satisfied if sum cs vs relop v is satisfied The first argument must be a list of integers The other arguments are as in sum count FDExpr FDExpr FDRel gt FDExpr gt FDConstr count v vs relop c is satisfied if n relop c where n is the number of elements in the list of FD variables vs that are equal to v is satisfied The first argument must be an integer The other arguments are as in sun solv
20. FormParam FormOnSubmit s a JavaScript statement to be executed when the form is submitted i e lt form onsubmit s gt FormTarget String FormParam FormTarget s a name of a target frame where the output of the script should be represented should only be used for scripts running in a frame FormEnc String FormParam FormEnc 198 the encoding scheme of this form e FormMeta String String FormParam FormMeta as meta information in form of attributes for this form e HeadInclude HtmlExp FormParam HeadInclude he HTML expression to be included in form header e MultipleHandlers FormParam MultipleHandlers indicates that the event handlers of the form can be multiply used i e are not deleted if the form is submitted so that they are still available when going back in the browser but then there is a higher risk that the web server process might overflow with unused events the default is a single use of event handlers i e one cannot use the back button in the browser and submit the same form again which is usually a reasonable behavior to avoid double submissions of data e BodyAttr String String gt FormParam BodyAttr ps optional attribute for the body element more than one occurrence is allowed data CookieParam The possible parameters of a cookie Exported constructors e CookieExpire ClockTime Co
21. In order to evaluate the condition xs _ x the Boolean equality is evaluated to True or False by instantiating the free variables _ and x However since we know that a condition must be evaluated to True only and all evaluations to False can be ignored we can use the constrained equality to obtain a more efficient program last xs xs _ x x where x free Since the selection of the appropriate equality operator is not obvious and might be tedious PAKCS e encourages programmers to use only the Boolean equality operator in programs The con 4 straint equality operator can be considered as an optimization of if it is ensured that only positive results are required e g in conditions of program rules To support this programming style PAKCS has a built in optimization phase on FlatCurry files For this purpose the optimizer analyzes the FlatCurry programs for occurrences of and replaces them by whenever the result False is not required The usage of the optimizer can be influenced by setting the property flag bindingoptimization in the configuration file pakcsrc The following values are recognized for this flag no Do not apply this transformation fast This is the default value The transformation is based on pre computed values for the prelude operations in order to decide whether the value False is not required as a result of a Boole
22. Signature FunctionNames Equat FunLHS CondExprs Pattern ConsPattern SimplePat FieldPat QLabelID LocalDefs ValueDeclaration PatternDeclaration Expr see lexicon FixityKeyword Digit InfixOpID InfizOpID n gt 0 infixl infixr infix see lexicon Signature External Equat FunctionNames external externally defined functions FunctionNames TypeExpr FunctionName FunctionName n gt 0 FunLHS Expr where LocalDefs FunLHS CondExprs where LocalDefs FunctionName SimplePat SimplePat n gt 0 SimplePat InficOpID SimplePat InfixExpr Expr CondExprs ConsPattern QConsOp Pattern infix constructor pattern GDataConstr SimplePat SimplePat constructor pattern SimplePat Variable wildcard QDataConstr Literal Int negative pattern Float negative float pattern O empty tuple pattern Pattern Pattern n gt 1 Pattern Pattern Pattern 1 Variable SimplePat SimplePat SimplePat QFunOp SimplePat gt QFunctionName SimplePat QDataConstr FieldPati parenthesized pattern n gt 0 as pattern irrefutable pattern infix functional pattern SimplePat functional pattern n gt 0 FieldPat y labeled pattern n gt 0 QLabelID Pattern see lexicon ValueDeclaration ValueDeclaration y n gt 0 FunctionDeclaration PatternDeclarat
23. Web links can be put in angle brackets like in the link http www google com lt http www google com gt Currently only links starting with http are recognized so that one can also use HTML markup If one wants to put a link under a text one can put the text in square brackets directly followed by the link in round brackets as in Google Google http www google com If one wants to put a character that has a specific meaning in the syntax of Markdown like or _ in the output document it should be escaped with a backslash i e a backslash followed by a special character in the source text is translated into the given character this also holds for program code see below For instance the input text _word _ produces the output _word_ The following backslash escapes are recognized backslash i backtick asterisk _ underscore curly braces square brackets 305 O parentheses hash symbol plus symbol minus symbol dash dot blank exclamation mark B 2 Lists and Block Formatting An unordered list i e without numbering is introduced by putting a star in front of the list elements where the star can be preceded by blanks The individual list elements must contain the same indentation as in First list element with two lines Next list element It contains two paragraphs Final list element This is formatted as follows e First list element with two lines
24. WuiSpec j wi0Tuple WuiSpec a WuiSpec b WuiSpec c WuiSpec d WuiSpec e gt WuiSpec f gt WuiSpec g WuiSpec h WuiSpec i WuiSpec j WuiSpec a b c d e f g h i j WUI combinator for tuples of arity 10 wCons10 a lt b gt c gt d gt e gt fl gt g gt h gt i gt j gt k gt WuiSpec a gt WuiSpec b gt WuiSpec c gt WuiSpec d gt WuiSpec e WuiSpec f WuiSpec g gt WuiSpec h gt WuiSpec i WuiSpec j WuiSpec k WUI combinator for constructors of arity 10 The first argument is the ternary con structor The further arguments are the WUI specifications for the argument types wCons10JS Maybe JSExp gt JSExp gt la gt b gt c gt d gt e gt fl gt 8g gt h gt i gt j k WuiSpec a WuiSpec b WuiSpec c WuiSpec d WuiSpec e gt WuiSpec f WuiSpec g WuiSpec h WuiSpec i WuiSpec j WuiSpec k 227 wiiTuple WuiSpec a WuiSpec b WuiSpec c WuiSpec d WuiSpec e gt WuiSpec f WuiSpec g gt WuiSpec h gt WuiSpec i WuiSpec j WuiSpec k gt WuiSpec a b c d e f g h i j k WUI combinator for tuples of arity 11 wCons11 la lt b gt c gt d gt e gt fl gt g gt h gt iw gt j gt k gt 1l gt WuiSpec a gt WuiSpec b gt WuiSpec c gt WuiSpec d WuiSpec e gt WuiSpec f WuiSpec g gt WuiSpec h gt WuiSpec i WuiSpec j WuiSpec k WuiSpec 1 WUI combinator
25. gt Int gt Int gt Bool gt Int gt Bool The constraint sum z1 n op x is satisfied if all 11 n op x is satisfied where op is one of the above finite domain constraint relations e g scalar_product Int gt Int gt Int gt Int gt Bool gt Int gt Bool The constraint scalar_product c1 n 1 n op x is satisfied if all c111 Cn Tn Op x is satisfied where op is one of the above finite domain constraint relations count Int gt Int gt Int gt Int gt Bool gt Int gt Bool The constraint count k x1 n op x is satisfied if all k op x is satisfied where n is the number of the x that are equal to k and op is one of the above finite domain constraint relations allDifferent Int gt Bool The constraint allDifferent 7 2 is satisfied if all x have pairwise different values labeling LabelingOption gt Int gt Bool The constraint labeling os x 2 non deterministically instantiates all x to the val ues of their domain according to the options os see the module documentation for further details about these options These entities are defined in the system module CLPFD cf Section 1 3 i e in order to use it the program must contain the import declaration import CLPFD As an example consider the classical send more money problem where each letter must be replaced by a d
26. 1 Fails if m lt 0 or n lt m abs Int Int The value of abs n is the absolute value of n max3 a gt a gt a gt a Returns the maximum of the three arguments min3 a gt a gt a gt a Returns the minimum of the three arguments maxlist a a Returns the maximum of a list of integer values Fails if the list is empty minlist a a Returns the minimum of a list of integer values Fails if the list is empty bitTrunc Int Int Int The value of bitTrunc n m is the value of the n least significant bits of m bitAnd Int Int gt Int Returns the bitwise AND of the two arguments bitOr Int gt Int gt Int Returns the bitwise inclusive OR of the two arguments bitNot Int gt Int Returns the bitwise NOT of the argument Since integers have unlimited precision only the 32 least significant bits are computed 120 bitXor Int Int gt Int Returns the bitwise exclusive OR of the two arguments even Int Bool Returns whether an integer is even odd Int Bool Returns whether an integer is odd A 2 32 Library IO Library for IO operations like reading and writing files that are not already contained in the prelude Exported types data Handle The abstract type of a handle for a stream Exported constructors data IOMode The modes for opening a file Exported constructors e ReadMode IOMode e WriteMode IOMode e AppendMode IOMode data SeekMode The
27. 11 ERD2Curry A Tool to Generate Programs from ER Specifi cations ERD2Curry is a tool to generate Curry code to access and manipulate data persistently stored from entity relationship diagrams The idea of this tool is described in detail in 13 Thus we describe only the basic steps to use this tool in the following If one creates an entity relationship diagram ERD with the Umbrello UML Modeller one has to store its XML description in XMI format as offered by Umbrello in a file e g myerd xmi This description can be compiled into a Curry program by the command erd2curry x myerd xmi erd2curry is a program stored in pakcshome bin where pakcshome is the installation directory of PAKCS see Section 1 1 If MyData is the name of the ERD the Curry program file MyData curry is generated containing all the necessary database access code as described in 13 In addition to the generated Curry program file two auxiliary program files ERDGeneric curry and KeyDatabase curry are created in the same directory If one does not want to use the Umbrello UML Modeller which might be the preferred method since the interface to the Umbrello UML Modeller is no longer actively supported one can also create a textual description of the ERD as a Curry term of type ERD w r t the type definition given in module pakcshome currytools erd2curry ERD curry and store it in some file e g myerd term This description can be compiled i
28. 8 5 4 group a gt lal Splits the list argument into a list of lists of equal adjacent elements Example group 1 2 2 3 3 3 4 1 2 2 3 3 3 4 groupBy a gt a gt Bool gt a gt a Splits the list argument into a list of lists of related adjacent elements splitOn a gt a gt a Breaks the second list argument into pieces separated by the first list argument con suming the delimiter An empty delimiter is invalid and will cause an error to be raised split a gt Bool gt a gt lal Splits a list into components delimited by separators where the predicate returns True for a separator element The resulting components do not contain the separators Two adjacent separators result in an empty component in the output 137 split a aabbaca Ka Fig bb E R split a 9999 pp inits la gt a Returns all initial segments of a list starting with the shortest Example inits 1 2 3 17 11 21 11 2 311 tails a gt a Returns all final segments of a list starting with the longest Example tails 1 2 3 1 2 3 2 3 3 replace a gt Int gt a gt a Replaces an element in a list isPrefix0f a gt a Bool Checks whether a list is a prefix of another isSuffix0f a gt a Bool Checks whether a list is a suffix of another isInfix0f a gt a Bool Checks whether a li
29. Define the identifier x as an abbreviation for the expression expr which can be used in subsequent expressions The identifier x is visible until the next load or reload command quit Exit the system There are also a number of further commands that are often useful type expr Show the type of the expression expr 10 browse Start the CurryBrowser to analyze the currently loaded module together with all its imported modules see Section 7 for more details edit Load the source code of the current main module into a text editor If the variable 6 editcommand is set in the configuration file pakcsrc see Section 2 6 its value is used as an editor command otherwise the environment variable EDITOR or a default editor e g vi is used edit m Load the source text of module m which must be accessible via the current load path if no path specification is given into a text editor which is defined as in the command edit interface Show the interface of the currently loaded module i e show the names of all imported modules the fixity declarations of all exported operators the exported datatypes declarations and the types of all exported functions 6 interface prog Similar to interface but shows the interface of the module prog curry If g g y this module does not exist this comm
30. Int gt a gt la Array a Creates a default array from a list of entries listToErrorArray a gt Array a Creates an error array from a list of entries combine a gt b gt c gt Array a gt Array b gt Array c combine two arbitrary arrays combineSimilar a gt a gt a Array a gt Array a gt Array a the combination of two arrays with identical default function and a combinator which is neutral in the default can be implemented much more efficient A 3 2 Library Dequeue An implementation of double ended queues supporting access at both ends in constant amortized time Exported types data Queue The datatype of a queue Exported constructors 176 Exported functions empty Queue a The empty queue cons a gt Queue a gt Queue a Inserts an element at the front of the queue snoc a gt Queue a Queue a Inserts an element at the end of the queue isEmpty Queue a gt Bool Is the queue empty deqLength Queue a Int Returns the number of elements in the queue deqHead Queue a gt a The first element of the queue deqTail Queue a Queue a Removes an element at the front of the queue deqLast Queue a gt a The last element of the queue deqInit Queue a Queue a Removes an element at the end of the queue deqReverse Queue a gt Queue a Reverses a double ended queue rotate Queue a gt Queue a Moves the first element to t
31. e COp String String CFixity Int COpDecl data CFixity Data type for operator associativity Exported constructors e CInfixOp CFixity e CInfixlOp CFixity e CInfixrOp CFixity data CFuncDecl Data type for representing function declarations A function declaration in AbstractCurry is a term of the form CFunc name arity visibility type CRules eval CRule rule1 rulek and represents the function name defined by the rules rule1 rulek Note the variable indices are unique inside each rule Thus a function declaration consists of the name arity type and a list of rules A function declaration with the constructor CmtFunc is similarly to CFunc but has a comment as an additional first argument This comment could be used by pretty printers that generate a readable Curry program containing documentation comments Exported constructors e CFunc String String Int gt CVisibility CTypeExpr CRule gt CFuncDecl e CmtFunc String gt String String Int gt CVisibility CTypeExpr gt CRule gt CFuncDecl data CRule The general form of a function rule It consists of a list of patterns left hand side and the right hand side for these patterns Exported constructors e CRule CPattern gt CRhs CRule data CRhs Right hand side of a CRule or a case expression It is either a simple unconditional right hand side or a list of guards with their c
32. e Next list element It contains two paragraphs e Final list element Instead of a star one can also put dashes or plus to mark unordered list items Furthermore one could nest lists Thus the input text Color Yellow Read Blue BW Black White is formatted as e Color 306 Yellow Read Blue e BW Black White Similarly ordered lists i e with numbering each item are introduced by a number followed by a dot and at least one blank All following lines belonging to the same numbered item must have the same indent as the first line The actual value of the number is not important Thus the input 1 First element 99 Second element is formatted as 1 First element 2 Second element A quotation block is marked by putting a right angle followed by a blank in front of each line gt This is gt a quotation It will be formatted as a quote element This is a quotation A block containing program code starts with a blank line and is marked by intending each input line by at least four spaces where all following lines must have at least the same indentation as the first non blank character of the first line f x y let z x y in z z The indentation is removed in the output f x y let z x y in z z To visualize the structure of a document one can also put a line containing only blanks and at least three dashes stars would also work in the source
33. fill widget in both directions FillX Confltem Fil1X fill widget in horizontal direction FillY Confltem FillY fill widget in vertical direction 110 e TclOption String gt ConfItem TclOption further options in Tcl syntax unsafe data ReconfigureItem Data type for describing configurations that are applied to a widget or GUI by some event handler Exported constructors e WidgetConf WidgetRef Confltem Reconfigureltem WidgetConf wref conf reconfigure the widget referred by wref with configuration item conf e StreamHandler Handle gt Handle gt GuiPort gt I0 Reconfigureltem gt Reconfigureltem StreamHandler hdl handler add a new handler to the GUI that processes inputs on an input stream referred by hdl e RemoveStreamHandler Handle Reconfigureltem RemoveStreamHandler hdl remove a handler for an input stream referred by hdl from the GUI usually used to remove handlers for closed streams data Event The data type of possible events on which handlers can react This list is still incomplete and might be extended or restructured in future releases of this library Exported constructors e DefaultEvent Event DefaultEvent the default event of the widget e MouseButton1 Event MouseButton1 left mouse button pressed e MouseButton2 Event MouseButton2 111 middle mouse button pressed e MouseB
34. fix a gt a gt a fix f is the least fixed point of the function f i e the least defined x such that f x gt on a gt ra gt b gt c gt a gt c gt c gt b on f Ax y gt f x f y Typical usage sortBy compare on fst first a gt b gt a c gt b c Apply a function to the first component of a tuple second a gt b gt c a gt c b Apply a function to the second component of a tuple xxx a gt b gt c gt d gt a c gt b d Apply two functions to the two components of a tuple 8288 a gt b gt a gt c Daa b c Apply two functions to a value and returns a tuple of the results both a gt b gt a a gt b b Apply a function to both components of a tuple A 2 26 Library FunctionInversion This module provides some utility functions for inverting functions Exported functions invfi a gt b gt b gt a Inverts a unary function invf2 a gt b gt c gt c gt a b Inverts a binary function inv 3 a gt b gt c gt 4d gt d gt a b c Inverts a ternary function invf4 la gt b gt c gt d gt e gt e5 gt a b c d Inverts a function of arity 4 invf5 a gt b gt c gt d gt e gt f gt f gt a b c d e Inverts a function of arity 5 103 A 2 27 Library GetOpt This Module is a modified version of the Module System Console GetOpt by Sven Panne from the ghc base package it has been ada
35. get indices of variables in let declaration letBody AExpr a AExpr a get body of let declaration freeVars AExpr a Int get variable indices from declaration of free variables freeExpr AExpr a gt AExpr a get expression from declaration of free variables orExps AExpr a AExpr a get expressions from or expression caseType AExpr a CaseType get case type of case expression caseExpr AExpr a AExpr a get scrutinee of case expression caseBranches AExpr a ABranchExpr a isVar AExpr a gt Bool is expression a variable 296 isLit AExpr a Bool is expression a literal expression isComb AExpr a Bool is expression combined isLet AExpr a Bool is expression a let expression isFree AExpr a Bool is expression a declaration of free variables isOr AExpr a Bool is expression an or expression isCase AExpr a Bool is expression a case expression trExpr a gt Int gt b gt a gt Literal gt b gt a CombType gt String String a gt b gt b gt a gt Int a b gt b gt b gt a gt Int a gt b gt b gt a gt b gt b gt b gt a gt CaseType gt b gt c gt b gt APattern a gt b gt c gt a gt b gt TypeExpr gt b gt AExpr a gt b transform expression updVars a gt Int gt AExpr a AExpr a gt AExpr a update all variab
36. mailx and must be adapted according to your local environment A 4 6 Library 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 Exported types type MarkdownDoc MarkdownElem A markdown document is a list of markdown elements data MarkdownElem The data type for representing the different elements occurring in a markdown docu ment 212 Exported constructors Text String MarkdownElem Text s a simple text in a markdown document Emph String MarkdownElem Emph s an emphasized text in a markdown document Strong String MarkdownElem Strong s a strongly emphaszed text in a markdown document Code String MarkdownElem Code s a code string in a markdown document HRef String String MarkdownElem HRef s u a reference to URL u with text s in a markdown document Par MarkdownElem gt MarkdownElem Par md a paragraph in a markdown document CodeBlock String MarkdownElem CodeBlock s a code block in a markdown document UList MarkdownElem MarkdownElem UList mds an unordered list in a markdown document OList MarkdownElem MarkdownElem OList mds an ordered list in a markdown document Quote MarkdownElem gt MarkdownElem Quote md 213 a quoted paragr
37. p ti gt gt tn gt Dynamic p persistent file DIR Remark This library has been revised to the library Database Thus it might not be further supported in the future Exported types data Dynamic The general type of dynamic predicates Exported constructors Exported functions dynamic a dynamic is only used for the declaration of a dynamic predicate and should not be used elsewhere persistent String gt a persistent is only used for the declaration of a persistent dynamic predicate and should not be used elsewhere lt gt Dynamic gt Dynamic Dynamic Snttp www informatik uni kiel de mh papers JFLP04 89 Combine two dynamics l gt Dynamic Bool Dynamic Restrict a dynamic with a condition amp gt Dynamic gt Bool Dynamic Restrict a dynamic with a constraint assert Dynamic gt I0 Asserts new facts without free variables about dynamic predicates Conditional dynamics are asserted only if the condition holds retract Dynamic gt 10 Bool Deletes facts without free variables about dynamic predicates Conditional dynamics are retracted only if the condition holds Returns True if all facts to be retracted exist otherwise False is returned getKnowledge I0 Dynamic Bool Returns the knowledge at a particular point of time about dynamic predicates If other processes made changes to persistent predicates these ch
38. updPattern String String a gt String String a gt Int a gt Int a Literal gt Literal gt APattern a gt APattern a update pattern updPatCons String String String String APattern a APattern a update constructors name of pattern updPatArgs Int a gt Int a gt APattern a gt APattern a update arguments of constructor pattern updPatLiteral Literal Literal gt APattern a gt APattern a update literal of pattern patExpr APattern a gt AExpr a build expression from pattern 299 annRule ARule a gt a annExpr AExpr a gt a Extract the annotation of an annotated expression annPattern APattern a gt a Extract the annotation of an annotated pattern unAnnProg AProg a Prog unAnnFuncDecl AFuncDecl a FuncDecl unAnnRule ARule a gt Rule unAnnExpr AExpr a Expr unAnnPattern APattern a gt Pattern A 5 18 Library FlatCurry Annotated TypeSubst Type substitutions on type annotated AnnotatedFlatCurry Exported types type AFCSubst FM Int TypeExpr The abstract data type for substitutions on TypeExpr Exported functions showAFCSubst FM Int TypeExpr String emptyAFCSubst FM Int TypeExpr The empty substitution lookupAFCSubst FM Int TypeExpr Int Maybe TypeExpr Searches the substitution for a mapping from the given variable index to a term 300 substFunc FM Int Typ
39. 249 maybeType CTypeExpr CTypeExpr Constructs a Maybe type from element type stringType CTypeExpr The type expression of the String type intType CTypeExpr The type expression of the Int type floatType CTypeExpr The type expression of the Float type boolType CTypeExpr The type expression of the Bool type unitType CTypeExpr The type expression of the unit type dateType CTypeExpr The type expression of the Time CalendarTime type cfunc String String Int gt CVisibility CTypeExpr CRule gt CFuncDecl Constructs a function declaration from a given qualified function name arity visibility type expression and list of defining rules cmtfunc String gt String String gt Int CVisibility CTypeExpr gt CRule gt CFuncDecl Constructs a function declaration from a given comment qualified function name arity visibility type expression and list of defining rules simpleRule CPattern gt CExpr gt CRule Constructs a simple rule with a pattern list and an unconditional right hand side guardedRule CPattern gt CExpr CExpr CLocalDec1 CRule Constructs a rule with a possibly guarded right hand side and local declarations A simple right hand side is constructed if there is only one True condition noGuard CExpr gt CExpr CExpr Constructs a guarded expression with the trivial guard applyF String String
40. Char Bool Returns true if the argument is an octal digit isHexDigit Char Bool Returns true if the argument is a hexadecimal digit isSpace Char Bool Returns true if the argument is a white space toUpper Char Char Converts lowercase into uppercase letters toLower Char Char Converts uppercase into lowercase letters digitToInt Char gt Int Converts a hexadecimal digit character into an integer intToDigit Int Char Converts an integer into a hexadecimal digit character 59 A 2 4 Library CHR A representation of CHR rules in Curry an interpreter for CHR rules based on the refined opera tional semantics of Duck et al ICLP 2004 and a compiler into CHR Prolog To use CHR Curry specify the CHR Curry rules in a Curry program load it add module CHR and interpret or compile the rules with runCHR or compileCHR respectively This can be done in one shot with gt pakcs 1 MyRules add CHR eval compileCHR MyCHR rulel rule2 q Exported types data CHR The basic data type of Constraint Handling Rules Exported constructors data Goal A CHR goal is a list of CHR constraints primitive or user defined Exported constructors Exported functions lt gt Goal a b gt Goal a b gt CHR a b Simplification rule gt Goal a b gt Goal a b gt CHR a b Propagation rule Goal a b gt CHR a b gt CHR a b Simpagation rule if rule
41. Float gt Float gt Float Multiplication on floats Float gt Float gt Float Division on floats Float gt Int gt Float The value of a 7 b is a raised to the power of b Executes in O log b steps i2f Int gt Float Conversion function from integers to floats truncate Float Int Conversion function from floats to integers The result is the closest integer between the argument and 0 round Float gt Int Conversion function from floats to integers The result is the nearest integer to the argument If the argument is equidistant between two integers it is rounded to the closest even integer value recip Float Float Reciprocal sqrt Float Float Square root log Float Float Natural logarithm logBase Float Float Float Logarithm to arbitrary Base exp Float Float Natural exponent sin Float Float Sine cos Float gt Float 101 Cosine tan Float Float Tangent asin Float Float Arc sine acos Float Float atan Float Float Arc tangent sinh Float Float Hyperbolic sine cosh Float Float tanh Float Float Hyperbolic tangent asinh Float Float Hyperbolic Arc sine acosh Float gt Float atanh Float Float Hyperbolic Arc tangent A 2 25 Library Function This module provides some utility functions for function application 102 Exported functions
42. HtmlExp String gt String Transforms HTML expressions into a string representation of a complete LaTeX doc ument The variable packages holds the packages to add to the latex document e g ngerman showLatexDocs HtmlExp gt String Transforms a list of HTML expressions into a string representation of a complete LaTeX document where each list entry appears on a separate page showLatexDocsWithPackages HtmlExp String gt String Transforms a list of HTML expressions into a string representation of a complete LaTeX document where each list entry appears on a separate page The variable packages holds the packages to add to the latex document e g ngerman germanLatexDoc HtmlExp gt String show german latex document intForm IO HtmlForm gt I0 Execute an HTML form in interactive mode intFormMain String String String gt String Bool String gt 10 HtmlForm gt I0 Execute an HTML form in interactive mode with various parameters A 4 3 Library HtmlCgi Library to support CGI programming in the HTML library It is only intended as an auxiliary library to implement dynamic web pages according to the HTML library It contains a simple script that is installed for a dynamic web page and which sends the user input to the real application server implementing the application 209 Exported types data CgiServerMsg
43. HtmlExp gt String String HtmlExp Adds a list of attributes name value pair to an HTML element addClass HtmlExp String HtmlExp Adds a class attribute to an HTML element showHtmlExps HtmlExp gt String Transforms a list of HTML expressions into string representation showHtmlExp HtmlExp String 207 Transforms a single HTML expression into string representation showHtmlPage HtmlPage String Transforms HTML page into string representation getUrlParameter IO String Gets the parameter attached to the URL of the script For instance if the script is called with URL http script cgi parameter then parameter is returned by this I O action Note that an URL parameter should be URL encoded to avoid the appearance of characters with a special meaning Use the functions urlencoded2string and string2urlencoded to decode and encode such parameters respectively urlencoded2string String String Translates urlencoded string into equivalent ASCII string string2urlencoded String String Translates arbitrary strings into equivalent urlencoded string getCookies I0 String String Gets the cookies sent from the browser for the current CGI script The cookies are represented in the form of name value pairs since no other components are important here coordinates CgiRef gt String Maybe Int Int For image buttons retrieve the coor
44. PAKCS_SOCKET 54 PAKCS_TRACEPORTS 54 pakcsrc 16 par 203 parens 153 parensIf 153 parseHtmlString 211 Parser 142 parser 15 ParserRep 142 parseXmlString 232 partition 76 137 partitionEithers 92 328 password 206 patArgs 274 299 patCons 274 299 patExpr 274 299 Path 182 path 8 14 pathSeparator 94 pathSeparatorChar 93 pathSeparators 94 patLiteral 274 299 Pattern 261 pattern functional 17 pChar 251 permutations 137 permute 76 persistent 89 persistentSQLite 133 pi 100 ping 144 plainCode 304 PlClause 161 PlGoal 161 plList 162 PlTerm 161 plusFM 179 plusFM_C 179 pNil 251 popupMessage 118 Port 53 143 ports 53 Pos 194 pow 119 ppAVarIndex 286 ppBranch 278 287 ppCaseType 278 287 ppCExpr 254 ppCFuncDecl 254 ppCFuncDeclWithoutSig 254 ppCFuncSignature 254 ppCLiteral 254 ppComb 278 286 ppConsDecl 277 285 ppConsDecls 277 285 ppConsExports 276 285 ppCOpDecl 254 ppCPattern 254 ppCStatement 255 ppCTypeDecl 254 ppCTypeExpr 254 ppCurryProg 253 ppDecl 278 286 ppDecls 278 286 ppExp 277 286 ppExports 254 276 285 ppExpr 277 286 ppFixity 277 285 ppFunc 255 ppFuncDecl 277 286 ppFuncDecls 277 286 ppFuncExports 276 285 ppHeader 276 284 ppImport 276 285 ppImports 254 276 285 ppInfix0Op 287 ppInfixQOp 278 ppLiteral 278 286 ppMName 254 ppName 278 ppOpDecl 276 285 ppOpDecls 276 285 ppPattern 278 287 ppPre
45. TypeExpr get arguments from constructed type trTypeExpr Int gt a gt String String gt a gt a gt a gt a gt a gt TypeExpr gt a 266 transform type expression isTVar TypeExpr Bool is type expression a type variable isTCons TypeExpr Bool is type declaration a constructed type isFuncType TypeExpr Bool is type declaration a functional type updTVars Int TypeExpr TypeExpr TypeExpr update all type variables updTCons String String TypeExpr TypeExpr gt TypeExpr TypeExpr update all type constructors updFuncTypes TypeExpr TypeExpr gt TypeExpr TypeExpr TypeExpr update all functional types argTypes TypeExpr gt TypeExpr get argument types from functional type resultType TypeExpr TypeExpr get result type from nested functional type rnmAllVarsInTypeExpr Int Int gt TypeExpr TypeExpr rename variables in type expression updQNamesInTypeExpr String String gt String String TypeExpr gt TypeExpr update all qualified names in type expression trOp String String gt Fixity Int gt a gt OpDecl gt a transform operator declaration opName OpDecl gt String String get name from operator declaration opFixity OpDecl Fixity get fixity of operator declaration opPrecedence OpDecl gt Int 267 get precedence of operator declaration updOp
46. Types This library supports meta programming i e the manipulation of Curry programs in Curry For this purpose the library contains definitions of data types for the representation of so called FlatCurry programs Exported types type QName String String The data type for representing qualified names In FlatCurry all names are qualified to avoid name clashes The first component is the module name and the second component the unqualified name as it occurs in the source program type TVarIndex Int The data type for representing type variables They are represented by TVar i where i is a type variable index type VarIndex Int Data type for representing object variables Object variables occurring in expressions are represented by Var i where i is a variable index data Prog Data type for representing a Curry module in the intermediate form A value of this data type has the form 259 Prog modname imports typedecls functions opdecls where modname is the name of this module imports is the list of modules names that are imported and typedecls functions and opdecls are the list of data type function and operator declarations contained in this module respectively Exported constructors e Prog String gt String TypeDecl gt FuncDecl gt OpDec1 gt Prog data Visibility Data type to specify the visibility of various entities Exported constructors e Public Visibility e Pri
47. gt al Deletes the first occurrence of an element in a list according to an equivalence relation AV a gt a gt a Computes the difference of two lists union a gt a gt a Computes the union of two lists unionBy a gt a gt Bool gt a gt a gt a Computes the union of two lists according to the given equivalence relation intersect a gt a gt al 136 Computes the intersection of two lists intersectBy a gt a gt Bool gt a gt a gt al Computes the intersection of two lists according to the given equivalence relation intersperse a gt a gt al Puts a separator element between all elements in a list Example intersperse 9 1 2 3 4 1 9 2 9 3 9 4 intercalate a gt a gt a intercalate xs xss is equivalent to concat intersperse xs xss It inserts the list xs in between the lists in xss and concatenates the result transpose a gt a Transposes the rows and columns of the argument Example transpose 1 2 3 4 5 6 1 4 2 5 3 6 permutations a gt a Returns the list of all permutations of the argument partition a gt Bool gt a gt a a Partitions a list into a pair of lists where the first list contains those elements that satisfy the predicate argument and the second list contains the remaining arguments Example partition lt 4 8 1 5 2 4 3 1 2 3
48. gt 2 lit ModuleID Ident Ident TypeConstrID Ident DataConstrID Ident TypeVarID Ident _ InficOpID Symbol Symbol Dashes FunctionID Ident Variable ID Ident LabelID Ident 20 QTypeConstrID ModuleID TypeConstrID QDataConstrID ModuleID DataConstrID QInfizxOpID ModuleID InfixOpID QFunctionID ModulelD FunctionID QVariablelD ModuleID VariableID QLabellD ModuleID LabelID The following identifiers are recognized as keywords and cannot be used as an identifier case data do else external fcase foreign free if import in infix infixl infixr let module newtype of then type where Note that the symbols as hiding and qualified are not keywords They have only a special meaning in module headers and can be used as ordinary identifiers The following symbols also have a special meaning and cannot be used as an infix operator identifier 4 2 3 Comments Comments begin either with and terminate at the end of the line or with and terminate with a matching i e the delimiters and act as parentheses and can be nested 4 2 4 Numeric and Character Literals Contrasting to the Curry Report PAKCS adopts Haskell s notation of literals for both numeric literals as well as Char and String literals The precise syntax for both kinds is given below Int Decimal Ob Binary 0B Binary 00 Octal
49. gt Int The number of Nodes in a Graph nodeRange Graph a b gt Int Int The minimum and maximum Node in a Graph context Graph a b gt Int gt b Int Int a b Int Find the context for the given Node In contrast to match context causes an error if the Node is not present in the Graph lab Graph a b gt Int Maybe a Find the label for a Node neighbors Graph a b gt Int gt Int Find the neighbors for a Node suc Graph a b gt Int gt Int Find all Nodes that have a link from the given Node pre Graph a b gt Int gt Int Find all Nodes that link to to the given Node lsuc Graph a b gt Int gt Int b Find all Nodes and their labels which are linked from the given Node 184 lpre Graph a b gt Int gt Int b Find all Nodes that link to the given Node and the label of each link out Graph a b gt Int gt Int Int b Find all outward bound LEdges for the given Node inn Graph ab gt Int gt Int Int b Find all inward bound LEdges for the given Node outdeg Graph a b gt Int Int The outward bound degree of the Node indeg Graph a b gt Int gt Int The inward bound degree of the Node deg Graph ab gt Int gt Int The degree of the Node gelem Int Graph a b gt Bool True if the Node is present in the Graph equal Graph a b Graph a b Bool graph equality node a Int Int b a Int gt Int The Node in a
50. lcurry and the result is a Curry term representing this program readCurryWithImports String gt 10 CurryProg Read an AbstractCurry file with all its imports tryReadCurryWithImports String gt 10 Either String CurryProg tryReadCurryFile String I0 Either String CurryProg tryParse String gt I0 Either String CurryProg Try to parse an AbstractCurry file readUntypedCurry String 10 CurryProg I O action which parses a Curry program and returns the corresponding untyped Ab stract Curry program Thus the argument is the file name without suffix curry or Icurry and the result is a Curry term representing this program readCurryWithParseOptions String FrontendParams gt IO CurryProg acy with respect to some parser options This I O action is used by the standard action I O action which reads a typed Curry program from a file with extension readCurry It is currently predefined only in Curry2Prolog 245 readUntypedCurryWithParseOptions String FrontendParams 10 CurryProg I O action which reads an untyped Curry program from a file with extension uacy with respect to some parser options For more details see function readCurryWithParseOptions abstractCurryFileName String String Transforms a name of a Curry program with or without suffix curry or lcurry into the name of the file containing the corresponding Abs
51. line is returned hGetContents Handle IO String Reads the complete contents from an input handle and closes the input handle before returning the contents getContents 10 String Reads the complete contents from the standard input stream until EOF hPutChar Handle gt Char gt I0 Puts a character to an output handle hPutStr Handle String I0 Puts a string to an output handle hPutStrLn Handle gt String gt 10 Puts a string with a newline to an output handle 123 hPrint Handle a gt 10 Converts a term into a string and puts it to an output handle hIsReadable Handle gt 10 Bool Is the handle readable hIsWritable Handle I0 Bool Is the handle writable hIsTerminalDevice Handle 10 Bool Is the handle connected to a terminal A 2 33 Library IOExts Library with some useful extensions to the IO monad Exported types data IDRef Mutable variables containing values of some type The values are not evaluated when they are assigned to an IORef Exported constructors Exported functions execCmd String IO Handle Handle Handle Executes a command with a new default shell process The standard I O streams of the new process stdin stdout stderr are returned as handles so that they can be explicitly manipulated They should be closed with I0 hClose since they are not closed automatically when the process terminates evalCmd String gt Stri
52. only a strict version of findall is supported and concurrent threads are not executed in a fair manner 309 Prag curry Typechecker Y FlatCurry Printe prog fcy y Curry2Prolog Compiler Y prog pl Y Curry2Prolog Runtime System y Results Figure 3 Overview of PAKCS Goals gt 310 D Auxiliary Files During the translation and execution of a Curry program with PAKCS various intermediate repre sentations of the source program are created and stored in different files which are shortly explained in this section If you use PAKCS it is not necessary to know about these auxiliary files because they are automatically generated and updated You should only remember the command for delet ing all auxiliary files cleancurry see Section 1 1 to clean up your directories The various components of PAKCS create the following auxiliary files prog fcy This file contains the Curry program in the so called FlatCurry representation where all functions are global i e lambda lifting has been performed and pattern matching is translated into explicit case or expressions compare Appendix A 1 4 This representation might be useful for other back ends and compilers for Curry and is the basis doing meta programming in Curry This file is implicitly generated when a program is compiled with PAKCS It can be also explicitly generated by the Curry front end cymake flat ipakcshome li
53. reducible demanded subexpressions are printed This is useful to see failed reductions due to partially defined functions or failed unifications Inside encapsulated search e g inside evaluations of findall and findfirst failures are not printed since they are a typical programming technique there Note that this option causes some overhead in execution time and memory so that it could not be used in larger applications allfails If this option is set all failures i e also failures on backtracking and failures of enclosing functions that fail due to the failure of an argument evaluation are printed if the option printfail is set Otherwise only the first failure i e the first non reducible subexpression is printed consfail Print constructor failures If this option is set failures due to application of functions with non exhaustive pattern matching or failures during unification application of are shown Inside encapsulated search e g inside evaluations of findall and findfirst failures are not printed since they are a typical programming technique there In contrast to the option printfail this option creates only a small overhead in execution time and memory use consfail all Similarly to consfail but the complete trace of all active and just failed function calls from the main function to the failed function are shown consfail file f Sim
54. set functions 8 setO 166 set1 166 set2 166 set3 166 set4 166 set5 166 set6 166 set7 166 setAssoc 125 setConfig 116 setCurrentDirectory 83 setEnviron 170 setExtended 88 setFullPath 88 setHtmlDir 88 setIndentWith 253 setInsertEquivalence 188 setLayoutChoice 253 setLogfile 88 setModName 253 setOverlapWarn 88 setPageWith 253 setQualification 253 setQuiet 87 SetRBT 189 setRBT2list 190 setSpaced 152 setSpecials 88 setValue 117 showAFCSubst 300 showAnyExpression 175 showAnyQExpression 175 showAnyQTerm 174 showAnyTerm 174 showCProg 253 showCSV 78 showCurryExpr 280 showCurryld 280 showCurryType 280 showCurryVar 280 showEscape 286 332 showFlatFunc 280 showFlatProg 280 showFlatType 280 showFM 181 showGraph 187 showHtmlExp 207 showHtmlExps 207 showHtmlPage 208 showJSExp 128 showJSFDecl 128 showJSStat 128 showLatexDoc 209 showLatexDocs 209 showLatexDocsWithPackages 209 showLatexDocWithPackages 209 showLatexExp 209 showLatexExps 208 showMemInfo 160 showPlClause 162 showPlGoal 162 showPlGoals 162 showP1Prog 162 showPlTerm 162 showQNameInModule 261 showQTerm 164 showSubst 195 showTerm 164 showTError 80 134 showTestCase 58 showTestCompileError 58 showTestEnd 58 showTestMod 58 showXmlDoc 231 showXmlDocWithParams 232 simpleRule 250 simplify 76 sin 101 single 15 singleton variables 7 sinh 102 sizedSubset 76 sizeF
55. text tp test text let lt gt align vcat map ptype types Which is layed out as let empty Doc nest Int gt Doc gt Doc linebreak Doc Note that fill is not guaranteed to be linear time bounded since it has to compute the width of a document before pretty printing it fillBreak Int Doc Doc The document fillBreak i d first renders document d It than appends spaces until the width is equal to i If the width of d is already larger than i the nesting level is increased by i and a line is appended When we redefine ptype in the previous example to use fillBreak we get a useful variation of the previous output ptype name tp fillBreak 6 text name lt gt text lt gt text tp The output will now be let empty Doc nest Int gt Doc gt Doc linebreak Doc Note that fillBreak is not guaranteed to be linear time bounded since it has to com pute the width of a document before pretty printing it bold Doc Doc 156 The document bold d displays document d with bold text faint Doc Doc The document faint d displays document d with faint text blinkSlow Doc Doc The document blinkSlow d displays document d with slowly blinking text rarely supported blinkRapid Doc gt Doc The document blinkRapid d displays document d with rapidly blinking text rarely supported italic Doc gt Doc The document italic d displays document
56. varsOfLDecl CLocalDecl gt Int String Returns list of all variables occurring in a local declaration Each occurrence corresponds to one element i e the list might contain multiple elements varsOfFDecl CFuncDecl gt Int String 248 Returns list of all variables occurring in a function declaration Each occurrence corre sponds to one element i e the list might contain multiple elements varsOfRule CRule gt Int String Returns list of all variables occurring in a rule Each occurrence corresponds to one element i e the list might contain multiple elements funcNamesOfLDecl CLocalDecl gt String String funcNamesOfFDecl CFuncDecl String String funcNamesOfStat CStatement String String ldeclsOfRule CRule gt CLocalDecl1 isPrelude String Bool Tests whether a module name is the prelude A 5 4 Library AbstractCurry Build This library provides some useful operations to write programs that generate AbstractCurry pro grams in a more compact and readable way Exported functions gt CTypeExpr gt CTypeExpr gt CTypeExpr A function type baseType String String CTypeExpr A base type listType CTypeExpr CTypeExpr Constructs a list type from an element type tupleType CTypeExpr CTypeExpr Constructs a tuple type from list of component types ioType CTypeExpr CTypeExpr Constructs an IO type from a type
57. words i e if the text inside quotes has not the syntax of an identifier the escaping can be omitted as in This isn t a reference The following example text shows a Curry program with some documentation comments This is an example module author Michael Hanus version 0 1 module Example where The function conc concatenates two lists param xs the first list param ys the second list return a list containing all elements of xs and ys conc ys ys conc x xs ys X conc xs ys this comment will not be included in the documentation The function last computes the last element of a given list It is based on the operation conc to concatenate two lists param xs the given input list return last element of the input list last xs conc ys x xs x where x ys free This data type defines _polymorphic_ trees cons Leaf a leaf of the tree cons Node an inner node of the tree data Tree a Leaf a Node Tree a To generate the documentation execute the command currydoc Example currydoc is a command usually stored in pakcshome bin where pakcshome is the installation directory of PAKCS see Section 1 1 This command creates the directory DOC_Example if it does not exist and puts all HTML documentation files for the main program module Example and all its imported modules in this directory togeth
58. 00 Octal Ox Hexadecimal OX Hexadecimal Float Decimal Decimal Exponent Decimal Exponent Exponent e E Decimal Decimal Digit Decimal Binary Binit Binary Octal Octit Octal Hexadecimal Hexit Hexadecimal Digit 0o 1i 2 3 4 5 6 7 8 9 Bint z O 1 Octit 0 1 2 3 4 5 6 7 Hexit 0 1 2 3 4 5 6 7 8 Jo A B C D E F a b c dl e f Char gt Graphic y Space Escape gy String Graphic m Space Escape Gap 21 Escape NX CharEsc Ascii Decimal o Octal x Hexadecimal CharEsc a b f n r tiv x gt Ascii Cntrl NUL SOH STX ETX EOT ENQ ACK BEL BS HT LF VT FF CR SO SI DLE DC1 DC2 DC3 DC4 NAK SYN ETB CAN EM SUB ESC FS GS RS US SP DEL Cntrl AsciiLarge L N 1 7 _ AsctiLarge A Z Gap NX WhiteChar 4 WhiteChar 4 3 Layout Similarly to Haskell a Curry programmer can use layout information to define the structure of blocks For this purpose we define the indentation of a symbol as the column number indicating the start of this symbol The indentation of a line is the indentation of its first symbol The layout or off side rule applies to lists of syntactic entities after the keywords let where do or of In the subsequent context free syntax these lists are enclosed with curly brackets and the single entities are separated by semicolons Instead
59. 11 Library FlatCurry Show This library contains operations to transform FlatCurry programs into string representations either in a FlatCurry format or in a Curry like syntax This library contains e show functions for a string representation of FlatCurry programs showFlatProg showFlatType showFlatFunc e functions for showing FlatCurry type expressions in almost Curry syntax showCurryType showCurryExpr 279 Exported functions showFlatProg Prog String Shows a FlatCurry program term as a string with some pretty printing showFlatType TypeDecl gt String showFlatFunc FuncDecl String showCurryType String String gt String gt Bool gt TypeExpr String Shows a FlatCurry type in Curry syntax showCurryExpr String String gt String gt Bool gt Int Expr gt String Shows a FlatCurry expressions in almost Curry syntax showCurryVar a gt String showCurryld String String Shows an identifier in Curry form Thus operators are enclosed in brackets A 5 12 Library FlatCurry XML 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 Exported functions flatCurry2XmlFile Prog gt String gt I0
60. 4 11 Library XmlConv Provides type based combinators to construct XML converters Arbitrary XML data can be rep resented as algebraic datatypes and vice versa See here for a description of this library Exported types type XmlReads a String String XmlExp gt a String String Xml1Exp Type of functions that consume some XML data to compute a result type XmlShows a a gt String String XmlExp gt String String Xm1Exp Type of functions that extend XML data corresponding to a given value type XElemConv a XmlConv Repeatable Elem a Type of converters for XML elements type XAttrConv a XmlConv NotRepeatable NoElem a Type of converters for attributes type XPrimConv a XmlConv NotRepeatable NoElem a nttp www ps informatik uni kiel de sebf projects xmlconv 232 Type of converters for primitive values type XOptConv a XmlConv NotRepeatable NoElem a Type of converters for optional values type XRepConv a XmlConv NotRepeatable NoElem a Type of converters for repetitions Exported functions xmlReads XmlConv abc gt String String XmlExp gt c String String XmlExp Takes an XML converter and returns a function that consumes XML data and returns the remaining data along with the result xmlShows XmlConv a b c gt c gt String String XmlExp gt String String Xm1Exp Takes an XML converter and returns a function that extends XML d
61. 62 compose 149 computeCompactFlatCurry 283 concatMapES 93 ConfCollection 112 ConfigButton 118 ConfItem 109 connectPort 53 145 connectPortRepeat 144 connectPortWait 144 connectToCommand 124 connectToSocket 142 169 connectToSocketRepeat 141 connectToSocketWait 142 319 cons 177 consArgs 266 290 consArity 265 290 ConsDecl 256 consfail 13 consName 247 265 290 constF 251 Constraint 69 constructors 247 consVis 247 consVisibility 265 290 Context 182 context 184 Context 182 cookieForm 201 CookieParam 199 coordinates 208 COpDec1 241 copyFile 84 cos 101 cosh 102 count 68 73 75 CPattern 243 cpnsAlive 78 cpnsShow 77 cpnsStart 77 cpnsStop 78 cpvar 252 createDirectory 83 createDirectoryIfMissing 83 CRhs 242 crossout 157 CRule 242 CStatement 244 ctDay 171 ctHour 171 ctMin 171 ctMonth 171 ctSec 171 ctIZ 171 ctvar 252 CTVarIName 239 ctYear 171 CTypeDecl 240 CTypeExpr 241 currentModule 276 Curry mode 16 Curry preprocessor 35 Curry2Prolog 309 curryCompiler 85 curryCompilerMajorVersion 85 curryCompilerMinorVersion 85 CurryDoc 28 currydoc 29 CURRYPATH 8 14 44 CurryProg 240 curryRuntime 85 curryRuntimeMajorVersion 86 curryRuntimeMinorVersion 86 currySubdir 87 CurryTest 33 currytest 33 cvar 252 CVarIName 239 CVisibility 240 cyan 158 cycle 139 cyclic structure 17 cymake 311 database programming 4
62. ArgOrder Exported constructors e RequireOrder ArgOrder a e Permute ArgOrder a e ReturnInOrder String a gt ArgUrder a data OptDescr Exported constructors e Option String String ArgDescr a String gt OptDescr a data ArgDescr 104 Exported constructors e NoArg a ArgDescr a e RegArg String gt a String ArgDescr a e OptArg Maybe String gt a String ArgDescr a Exported functions usageInfo String OptDescr a gt String getOpt ArgOrder a OptDescr a gt String a String String getOpt ArgOrder a gt OptDescr a String gt lal String String String A 2 28 Library 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 Currently it is still experimental so that its interface might be slightly changed in the future A global entity g with an initial value v of type t must be declared by g Global t g global v spec Here the type t must not contain type variables and spec specifies the storage mechanism for the global entity see type GlobalSpec Exported types data Global The type of a global entity Exported constructors data GlobalSpec T
63. Context lab a Int Int b a Int b The label in a Context labNode a Int Int b a Int gt Int b The LNode from a Context neighbors a Int Int b a Int gt Int All Nodes linked to or from in a Context suc a Int Int b a Int gt Int All Nodes linked to in a Context pre a Int Int b a Int gt Int All Nodes linked from in a Context 185 Ipre a Int Int b a Int gt Int a All Nodes linked from in a Context and the label of the links lsuc a Int Int b a Int Int a All Nodes linked from in a Context and the label of the links out a Int Int b a Int gt Int Int a All outward directed LEdges in a Context inn a Int Int b a Int gt nt Int a All inward directed LEdges in a Context outdeg a Int Int b a Int 1 gt Int The outward degree of a Context indeg a Int Int b a Int 1 gt Int The inward degree of a Context deg a Int Int b a Int 1 gt Int The degree of a Context labNodes Graph a b gt Int a A list of all LNodes in the Graph labEdges Graph a b gt Int Int b A list of all LEdges in the Graph nodes Graph a b gt Int List all Nodes in the Graph edges Graph a b gt Int Int List all Edges in the Graph newNodes Int gt Graph a b gt Int List N available Nodes ie Nodes that are not use
64. Extensions PAKCS supports some extensions in Curry programs that are not yet part of the definition of Curry These extensions are described below 3 1 Recursive Variable Bindings Local variable declarations introduced by let or where can be mutually recursive in PAKCS For instance the declaration ones5 let ones 1 ones in take 5 ones introduces the local variable ones which is bound to a cyclic structure representing an infinite list of 1 s Similarly the definition onetwo n take n one2 where one2 1 twol twol 2 one2 introduces a local variables one2 that represents an infinite list of alternating 1 s and 2 s so that the expression onetwo 6 evaluates to 1 2 1 2 1 2 3 2 Functional Patterns Functional patterns 6 are a useful extension to code operations in a more readable way Fur thermore defining operations with functional patterns avoids problems caused by strict equality and leads to programs that are potentially more efficient Consider the definition of an operation to compute the last element of a list xs based on the prelude operation for list concatenation last xs _ y xs y where y free E Since the equality constrain evaluates both sides to a constructor term all elements of the list xs are fully evaluated in order to satisfy the constraint Functional patterns can help to improve this computational behavior A functional pattern is a funct
65. FM a b Maybe a b Retrieves the greatest key element pair in the finite map according to the basic key ordering fmToList FM a b gt a b Builds a list of key element pairs The list is ordered by the initially given irreflexive order predicate on keys keysFM FM a b gt a Retrieves a list of keys contained in finite map The list is ordered by the initially given irreflexive order predicate on keys eltsFM FM a b b Retrieves a list of elements contained in finite map The list is ordered by the initially given irreflexive order predicate on keys fmToListPreOrder FM a b gt a b Retrieves list of key element pairs in preorder of the internal tree Useful for lists that will be retransformed into a tree or to match any elements regardless of basic order fmSortBy a gt a Bool gt a gt a Sorts a given list by inserting and retrieving from finite map Duplicates are deleted 180 showFM FM a b gt String Transforms a finite map into a string For efficiency reasons the tree structure is shown which is valid for reading only if one uses the same ordering predicate readFM a a Bool gt String gt FM ab Transforms a string representation of a finite map into a finite map One has two provide the same ordering predicate as used in the original finite map A 3 4 Library GraphInductive Library for inductive graphs port of a Haskell library by Marti
66. Float gt Bool Comparing two floating point numbers with the greater than or equal relation 50 i2f Int gt Float Converting an integer number into a floating point number As an example consider a constraint mortgage which relates the principal p the lifetime of the mortgage in months t the monthly interest rate ir the monthly repayment r and the outstanding balance at the end of the lifetime b The financial calculations can be defined by the following two rules in Curry the second rule describes the repeated accumulation of the interest import CLPR mortgage pt irr b t gt 0 0 amp t lt 1 0 lifetime not more than 1 month b i p 1 0 t ir tx r mortgage pt irrb t gt 1 0 lifetime more than 1 month mortgage p 1 0 ir r t 1 0 ir r b Then we can calculate the monthly payment for paying back a loan of 100 000 in 15 years with a monthly interest rate of 1 by solving the goal mortgage 100000 0 180 0 0 01 r 0 0 which yields the solution r 1200 17 Note that only linear arithmetic equalities or inequalities are solved by the constraint solver Non 4 linear constraints like x x 4 0 are suspended until they become linear A 1 2 Finite Domain Constraints Finite domain constraints are constraints where all variables can only take a finite number of possible values For simplicity the domain of finite domain variables are identified with a subset of the integ
67. Technical Problems Bibliography A Libraries of the PAKCS Distribution A 1 Constraints Ports Meta PrograMmmMiag e A 1 1 Arithmetic Constraints 02002 eee eee eee A 1 2 Finite Domain Constraints 0 A 1 3 Ports Distributed Programming in Curry 2 A 1 4 AbstractCurry and FlatCurry Meta Programming in Curry A 2 General Libraries lt so a ccsa a adoa eo daok Ea oia esas esas os A21 Library Alonso e a o ee a wwe O eS AQ Library Asserti n s rripa dramak a a pah ea RS AZS Library CRF oe eo ee a a ee a aa aa a ee E 2 Lib CHR eaa cae i eS Me a ER eG ew pe aa A 2 5 Library CHReompiled 2 0 2 0 684 eae eee eee eee 8 AJD Library CLP Pe oc cn a h I eo EA RRA AAA AT Liber ELPED socorro tie eh he ee ee be ee Ree aS Poor Tales OLER nd cs ere oot pot eice Oy Wee OO At hoe we ee A oe a i A20 Library LLP on bows cb e A eRe RR ai A 2 10 Library Combinatorial s o ee ee we ee ee ee 211 Library Onsite se ee eRe Eee Re Bas Poole Laie RPS e eo i eh e ote cee rte wh De Ge ee A ee Se to dee A218 Library CSV o ee ee ae AED EM Ge EEE eee eR Re we ES A 214 Library Database an dp Pe tra a Sew baw Mb le Pe Hae aS A2 19 Library Debe osas ica RG be GRR aS A216 Library Directory e eA ee a he a ee eS A 2 17 Library Distribution e Poole Lib RADO oe do ade ek da OE Ewe Oe A219 Library Either ok qhipa ee ee h ank ee i e ee pu a A 220 Library Errorotale o ecce sa
68. The messages to comunicate between the cgi script and the server program CgiSubmit env cgienv nextpage pass the environment and show next page where env are the values of the environment variables of the web script e g QUERYSTRING REMOTEHOST REMOTE_ADDR cgienv are the values in the current form submitted by the client and nextpage is the answer text to be shown in the next web page Exported constructors CgiSubmit String String String String CgiServerMsg GetLoad CgiServerMsg GetLoad get info about the current load of the server process SketchStatus CgiServerMsg SketchStatus get a sketch of the status of the server SketchHandlers CgiServerMsg SketchHandlers get a sketch of all event handlers of the server ShowStatus CgiServerMsg ShowStatus show the status of the server with all event handlers CleanServer CgiServerMsg CleanServer clean up the server with possible termination StopCgiServer CgiServerMsg StopCgiServer stop the server 210 Exported functions readCgiServerMsg Handle gt IO Maybe CgiServerMsg Reads a line from a handle and check whether it is a syntactically correct cgi server message submitForm 10 runCgiServerCmd String CgiServerMsg gt I0 Executes a specific command for a cgi server noHandlerPage String String String cgiServerRegistry String The name of the file to regi
69. a a A A de we A da TE A 2 21 Library FileGoodies ee ee 40 42 43 44 45 AT 48 A3 222 Library FilePath o osas aci a Bey A 94 E A eo eB Ge Oe we ce Bek Oe ee 98 A224 Libtary Float ooo be RAG a ea Gok Re Se ae eS oS 100 A 225 Library FUMCHOO s e eee isa e a Re Re ee es 102 A 2 26 Library FunctionInversion o o ce acs eos aaa ea edo a aa ee ee 103 Amer labrar GA OP e pia bo de a E ee os AUE e 104 A228 Library Global 2 4 4 4 4 22 be db ea a a eae e DO 105 A 2 29 Library GlobalVariable c si cc scera ew ee ee ee ee 106 A280 Library GUI sos ee eR eR Ss ica a EGE be a wea 107 22 31 Library Uateger usarla aa a PR ERE ee ES 119 220 Library IO cs ace rr a Re a a 121 A 239 Library IES o cada a a OE ES o died E a a 124 4 234 Library Javascript gt ripe aca aa aaa 125 2 236 Library KevDatabass oc dond ac don a a haori da ee 128 A 2 36 Library KeyDatabaseSQLite e 129 Aao Libra KevDB ociosa ar a a o Ses 134 A Library List 2 se as cs caime Hee we Dee ee Ge Re we Be a 135 2 23 39 Library Maybe cscop a a a A ee ee a 139 A 2 40 Library NamedSocket e 141 24 241 Library Parser o ca we be hha ee Ge ae Sa RRA Se HS 142 Alda Library FOr s cea be ha we eo ek be ee we EO RO A e 143 62 43 Library Pretty ede hae a aca SR kie A 145 Pod labrar y PORE gt or a te ie oe ee ee ee Bk EO a a 158 A245 Library Prolog 2 44 cee iscam d ROM AG OEE Ee wae EEE ea DS 161 A 246 Library Property Fi
70. a constraint in Curry Note due to limi tations of the CHR Prolog implementation no warning is issued if residual constraints remain after the evaluation warnSuspendedConstraints Bool Bool Primitive operation that issues a warning if there are some suspended constraints in the CHR constraint store If the argument is true then all suspended constraints are shown otherwise only the first one 63 A 2 6 Library CLP FD Library for finite domain constraint solving An FD problem is specified as an expression of type FDConstr using the constraints and expressions offered in this library FD variables are created by the operation domain An FD problem is solved by calling solveFD with labeling options the FD variables whose values should be included in the output and a constraint Hence the typical program structure to solve an FD problem is as follows main Int main let fdvars take n domain u o fdmodel description of FD problem in solveFD options fdvars fdmodel where n are the number of variables and u o is the range of their possible values Exported types data FDRel Possible relations between FD values Exported constructors e Equ FDRel Equ Equal e Neq FDRel Neq Not equal e Lt FDRel Lt Less than e Leg FDRel Leq Less than or equal e Gt FDRel Gt Greater than 64 Geq FDRel Geq Greater than or equal data Opti
71. an input element described by the first argument with a cgi reference e HtmlEvent HtmlExp gt CgiRef gt String gt I0 HtmlForm gt HtmlExp HtmlEvent h hdlr an input element first arg with an associated event handler tpyically a submit button data HtmlForm The data type for representing HTML forms active web pages and return values of HTML forms Exported constructors 197 HtmlForm String gt FormParam gt HtmlExp HtmlForm HtmlForm t ps hs an HTML form with title t optional parameters e g cookies ps and contents hs HtmlAnswer String String HtmlForm HtmlAnswer t c an answer in an arbitrary format where t is the content type e g text plain and c is the contents data FormParam The possible parameters of an HTML form The parameters of a cookie FormCookie are its name and value and optional parameters expiration date domain path e g the path makes the cookie valid for all documents on the server security which are collected in a list Exported constructors FormCookie String gt String gt CookieParam FormParam FormCookie name value params a cookie to be sent to the clients browser FormCSS String FormParam FormCSS s a URL for a CSS file for this form FormJScript String FormParam FormJScript s a URL for a Javascript file for this form FormOnSubmit String
72. angles x encloses document x in angles lt and gt braces Doc Doc Document braces x encloses document x in braces and brackets Doc Doc Document brackets x encloses document x in square brackets and char Char Doc The document char c contains the literal character c The character should not be a newline n the function line should be used for line breaks string String Doc 153 The document string s concatenates all characters in s using line for newline characters and char for all other characters It is used instead of text whenever the text contains newline characters int Int Doc The document int i shows the literal integer i using text float Float Doc The document float f shows the literal float f using text lparen Doc The document lparen contains a left parenthesis rparen Doc The document rparen contains a right parenthesis langle Doc The document langle contains a left angle lt rangle Doc The document rangle contains a right angle gt lbrace Doc The document lbrace contains a left brace rbrace Doc The document rbrace contains a right brace lbracket Doc The document lbracket contains a left square bracket rbracket Doc The document rbracket contains a right square bracket squote Doc The document squote contains a single quote dquote Doc The docume
73. are described in 8 Default rules If this feature is used one can add a default rule to operations defined in a Curry module This provides a similar power than sequential rules but with a better operational behavior The idea of default rules are described in 10 The preprocessor is an executable named currypp which is stored in the directory pakcshome bin In order to apply the preprocessor when loading a Curry source program into PAKCS one has to add an option line at the beginning of the source program For instance in order to use default rules in a Curry program one has to put the line OPTIONS_CYMAKE F pgmF currypp optF defaultrules at the beginning of the program This option tells the PAKCS front end to process the Curry source program with currypp before actually parsing the source text The option defaultrules has to be replaced by seqrules if the sequential rule matching should be replaced To support integrated code one has to set the option foreigncode which can also be combined with either defaultrules or seqrules If one wants to see the result of the 144 transformation one can also set the option o This has the effect that the transformed source program is stored in the file Prog curry CURRYPP if the name of the original program is Prog curry For instance in order to use integrated code and default rules in a module and store the transformed program one
74. as some useful auxiliary functions for FlatCurry data terms Most of the provided functions are based on general trans formation 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 trans formations on FlatCurry terms so the provided functions can be used to implement specific trans formations 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 287 Exported types type Update ab b gt b gt a gt a Exported functions trProg String String TypeDec1 AFuncDecl a gt OpDecl gt b gt AProg a gt b transform program progName AProg a String get name from program progImports AProg a gt String get imports from program progTypes AProg a gt TypeDec1 get type declarations from program progFuncs AProg a gt AFuncDecl a get functions from program progOps AProg a OpDec1 get infix operators from program updProg String gt String gt String String TypeDecl gt TypeDecl AFuncDecl a gt AFuncDecl al OpDec1 OpDec1 AProg a AProg a update program updProgName String String AProg a gt A
75. by gt and web links of the form lt http gt or link text http If the Markdown syntax should not be used one could run CurryDoc with the parameter nomarkdown The comments can also contain markups in HTML format so that special characters like lt must be quoted e g amp lt However header tags like lt h1 gt should not be used since the struc turing is generated by CurryDoc In addition to Markdown or HTML markups one can also mark references to names of operations or data types in Curry programs which are translated into links The documentation tool recognizes this association from the first identifier in a program line If one wants to add a documentation comment to the definition of a function which is an infix operator the first line of the operator definition should be a type definition otherwise the documentation comment is not recognized 28 inside the generated HTML documentation Such references have to be enclosed in single quotes For instance the text conc refers to the Curry operation conc inside the current module whereas the text Prelude reverse refers to the operation reverse of the module Prelude If one wants to write single quotes without this specific meaning one can escape them with a backslash This is a comment without a reference To simplify the writing of documentation comments such escaping is only necessary for single
76. connection is returned as a pair consisting of a string identifying the client the format of this string is implementation dependent and a handle to a stream communication with the client sClose Socket gt I0 Closes a server socket connectToSocket String Int I0 Handle Creates a new connection to a Unix socket A 2 52 Library System Library to access parts of the system environment Exported functions getCPUTime IO Int Returns the current cpu time of the process in milliseconds getElapsedTime IO Int 169 Returns the current elapsed time of the process in milliseconds This operation is not supported in KiCS2 there it always returns 0 but only included for compatibility reasons getArgs IO String Returns the list of the program s command line arguments The program name is not included getEnviron String IO String Returns the value of an environment variable The empty string is returned for unde fined environment variables setEnviron String gt String gt 10 Set an environment variable to a value The new value will be passed to subsequent shell commands see system and visible to subsequent calls to getEnviron but it is not visible in the environment of the process that started the program execution unsetEnviron String gt 10 Removes an environment variable that has been set by setEnviron getHostname 10 String Returns the hostname of the ma
77. d with italicized text rarely supported underline Doc Doc The document underline d displays document d with underlined text crossout Doc Doc The document crossout d displays document d with crossed out text inverse Doc Doc The document inverse d displays document d with inversed coloring i e use text color of d as background color and background color of d as text color black Doc Doc The document black d displays document d with black text color red Doc Doc The document red d displays document d with red text color green Doc Doc The document green d displays document d with green text color yellow Doc Doc The document yellow d displays document d with yellow text color blue Doc Doc The document blue d displays document d with blue text color magenta Doc Doc 157 The document magenta d displays document d with magenta text color cyan Doc gt Doc The document cyan d displays document d with cyan text color white Doc Doc The document white d displays document d with white text color bgBlack Doc Doc The document bgBlack d displays document d with black background color bgRed Doc Doc The document bgRed d displays document d with red background color bgGreen Doc Doc The document bgGreen d displays document d with green background color bgYellow Doc Doc The document bgYellow d displays document
78. d with yellow background color bgBlue Doc Doc The document bgBlue d displays document d with blue background color bgMagenta Doc Doc The document bgMagenta d displays document d with magenta background color bgCyan Doc Doc The document bgCyan d displays document d with cyan background color bgWhite Doc Doc The document bgWhite d displays document d with white background color pretty Int Doc String pretty w d pretty prints document d with a page width of w characters A 2 44 Library Profile Preliminary library to support profiling 158 Exported types data ProcessInfo The data type for representing information about the state of a Curry process Exported constructors RunTime ProcessInfo RunTime the run time in milliseconds ElapsedTime ProcessInfo ElapsedTime the elapsed time in milliseconds Memory ProcessInfo Memory the total memory in bytes Code ProcessInfo Code the size of the code area in bytes Stack ProcessInfo Stack the size of the local stack for recursive functions in bytes Heap ProcessInfo Heap the size of the heap to store term structures in bytes Choices ProcessInfo Choices the size of the choicepoint stack GarbageCollections ProcessInfo GarbageCollections the number of garbage collections performed 159 Exported functions getProcessInfos I0 ProcessInfo In
79. deprecated use Prelude lt lt code gt lt lt code gt cmpChar Char Char Ordering 190 Comparison of characters deprecated use Prelude compare leqCharIgnoreCase Char Char Bool Less or equal on characters ignoring case considerations legString String String Bool Less or equal on strings deprecated use Prelude lt lt code gt lt lt code gt cmpString String String Ordering Comparison of strings deprecated use Prelude compare leqStringIgnoreCase String String Bool Less or equal on strings ignoring case considerations leqLexGerman String String Bool Lexicographical ordering on German strings Thus upper lowercase are not distin guished and Umlauts are sorted as vocals A 3 10 Library 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 Exported types type TableRBT a b RedBlackTree a b Exported functions emptyTableRBT a gt a Bool RedBlackTree a b Returns an empty table i e an empty red black tree isEmptyTable RedBlackTree a b gt Bool tests whether a given table is empty lookupRBT a gt RedBlackTree a b Maybe b Looks up an
80. document text s contains the literal string s The string shouldn t contain any newline n characters If the string contains newline characters the function string should be used linesep String Doc The document linesep s advances to the next line and indents to the current nesting level Document linesep s behaves like text s if the line break is undone by group hardline Doc The document hardline advances to the next line and indents to the current nesting level hardline cannot be undone by group line Doc The document line advances to the next line and indents to the current nesting level Document line behaves like text if the line break is undone by group linebreak Doc The document linebreak advances to the next line and indents to the current nesting level Document linebreak behaves like text if the line break is undone by group softline Doc The document softline behaves like space if the resulting output fits the page oth erwise it behaves like line softline group line softbreak Doc The document softbreak behaves like text if the resulting output fits the page otherwise it behaves like line softbreak group linebreak group Doc Doc The combinator group is used to specify alternative layouts The document group x undoes all line breaks in document x The resulting line is added to the current line if that fits the page Otherwise the document x
81. e o soos 640 we Gop h ea ee ae ee a 196 A 4 1 Library CategorizedHtmlList aooaa 2 ee 196 ALF Libery HEMD irris rra ew bw go R E a a 196 AAS Library Hama sessions ica eee be SR eae ea 209 Add Library Himal Parser s se sd ei ses a e i oa d Berde ERR a a E 211 AAS Library Mail sesca sore p ae eea e RR A ee we eS 211 AAD Library Marido baca ek al o aa nad e poe i i es 212 AALT Library URL ss sod don gee Gr ee k kio ae a E Ba ie a Ge aS 215 AAC Library WUL z s ee he a RA e are a HE ee a ea a Pe es 215 AAS Library WUS o satses eraic nonne a DREN AR a 222 AATO Library E 230 AAI Library AMICON cia a BE O RA a 232 A 5 Libraries for Meta Programming saoao a 239 A 5 1 Library AbstractCurry Types e 239 A 5 2 Library AbstractCurry Files e e e 245 A 5 3 Library AbstractCurry Select d e e 246 ADA Library AbstraciCuey Build e cg o Ree aaa RS 249 ADS Library Abstract amy Pretiy co ee h oea ee a 252 A 5 6 Library FlatCurry Types 2 00 cataria ee ee 255 ADT Library FlatCurry Files eos 4 Poe kG Ae Cw hwnd Bb le Pe BaP a 262 A 5 8 Library FlatCurry Goodies 0 0000 eee eee eee 263 AS Library Plat Curry Piet ss ra oa oe te de ee bo wee eS 275 A 5 10 Library FlatCurry Read c e cacc reog toei raa bbh dasi 279 7 5 1 Library PlatCurryShow s s 6 ci ee ar we RR a eee 279 A b 12 Library PlatCurre XML oo a Re wR 280 4 513 Library FlatCurry FlexRigid gt s c ee ect a
82. entry in a table updateRBT a gt b RedBlackTree a b gt RedBlackTree a b Inserts or updates an element in a table tableRBT2list RedBlackTree a b gt a b Transforms the nodes of red black tree into a list deleteRBT a RedBlackTree a b RedBlackTree a b 191 A 3 11 Library Traversal Library to support lightweight generic traversals through tree structured data See here for a description of the library Exported types type Traversable ab a gt b b gt a A datatype is Traversable if it defines a function that can decompose a value into a list of children of the same type and recombine new children to a new value of the original type Exported functions noChildren a gt b b gt a Traversal function for constructors without children children a gt b b a gt a gt b Yields the children of a value replaceChildren a gt b b gt a gt a gt bl gt a Replaces the children of a value mapChildren a gt b b gt a gt b gt bd OS ana Applies the given function to each child of a value family a gt lal lal gt a gt a gt a Computes a list of the given value its children those children etc childFamilies a gt b b gt a gt b gt b b gt DD gt a gt b Computes a list of family members of the children of a value The value and its children can have
83. f arity n gt for functions f with arity n that are declared in module Mod but should be ignored for code generation e g since they are never called w r t to the current implementation of external functions For instance this is useful when functions that can be defined in Curry should be usually more efficiently are implemented as external functions Note that the arguments are passed in their current possibly unevaluated form Thus if the external function requires the arguments to be evaluated in a particular form this must be done before calling the external function For instance the external function for adding two integers requires that both arguments must be evaluated to non variable head normal form which is identical to the ground constructor normal form Therefore the function is specified in the prelude by Int Int gt Int x y prim_Int_plus y x prim_Int_plus Int Int gt Int prim_Int_plus external where prim_Int_plus is the actual external function implementing the addition on integers Consequently the specification file Prelude prim_c2p has an entry of the form lt primitive name prim_Int_plus arity 2 gt lt library gt prim_standard lt library gt lt entry gt prim_Int_plus lt entry gt lt primitive gt where the Prolog library prim_standard pl1 contains the Prolog code implementing this func tion 2 For most external functions a standard interface i
84. for constructors of arity 11 The first argument is the ternary con structor The further arguments are the WUI specifications for the argument types wCons11JS Maybe JSExp gt JSExp gt la gt b gt c gt d gt e gt fl gt 8g gt h gt i gt j gt kx gt 1 gt WuiSpec a gt WuiSpec b gt WuiSpec c gt WuiSpec d gt WuiSpec e gt WuiSpec f WuiSpec g gt WuiSpec h WuiSpec i gt WuiSpec j WuiSpec k gt WuiSpec 1 wi2Tuple WuiSpec a WuiSpec b WuiSpec c gt WuiSpec d WuiSpec e gt WuiSpec f WuiSpec g gt WuiSpec h gt WuiSpec i WuiSpec j WuiSpec k gt WuiSpec 1 gt WuiSpec a b c d e f g h i j k 1 WUI combinator for tuples of arity 12 wCons12 la lt b gt c gt d gt e gt fl gt g gt h gt i gt j gt k gt 1l gt m gt WuiSpec a WuiSpec b WuiSpec c WuiSpec d WuiSpec e WuiSpec f gt WuiSpec g WuiSpec h WuiSpec i gt WuiSpec j WuiSpec k WuiSpec 1 gt WuiSpec m WUI combinator for constructors of arity 12 The first argument is the ternary con structor The further arguments are the WUI specifications for the argument types wCons12JS Maybe JSExp gt JSExp gt a bc defo g h gt i gt j gt k gt 1 gt m gt WuiSpec a gt WuiSpec b gt WuiSpec c gt WuiSpec d gt WuiSpec e gt WuiSpec f WuiSpec g WuiSpec h WuiSpec i WuiSpec j gt WuiSpec k Wui
85. for the simple text layout A 4 2 Library HTML Library for HTML and CGI programming This paper contains a description of the basic ideas behind this library The installation of a cgi script written with this library can be done by the command makecurrycgi m initialForm o home joe public_html prog cgi prog where prog is the name of the Curry program with the cgi script home joe public_html prog cgi is the desired location of the compiled cgi script and initialForm is the Curry expression of type IO HtmlForm computing the HTML form where makecurrycgi is a shell script stored in pakcshome bin 196 Exported types type CgiEnv CgiRef String The type for representing cgi environments i e mappings from cgi references to the corresponding values of the input elements type HtmlHandler CgiRef String gt I0 HtmlForm The type of event handlers in HTML forms data CgiRef The abstract data type for representing references to input elements in HTML forms Exported constructors data HtmlExp The data type for representing HTML expressions Exported constructors e HtmlText String HtmlExp HtmlText s a text string without any further structure e HtmlStruct String gt String String HtmlExp HtmlExp HtmlStruct t as hs a structure with a tag attributes and HTML expressions inside the structure e HtmlCRef HtmlExp CgiRef HtmlExp HtmlCRef h ref
86. for tuples of arity 8 wCons8 la lt b gt c gt d gt e gt gt g gt h gt i gt WuiSpec a gt WuiSpec b gt WuiSpec c gt WuiSpec d gt WuiSpec e WuiSpec f WuiSpec g gt WuiSpec h gt WuiSpec i WUI combinator for constructors of arity 8 The first argument is the ternary construc tor The further arguments are the WUI specifications for the argument types wCons8JS Maybe JSExp JSExp gt a gt b gt c gt d gt e gt f gt 8g gt h gt i gt WuiSpec a WuiSpec b WuiSpec c WuiSpec d WuiSpec e WuiSpec f gt WuiSpec g WuiSpec h WuiSpec i w9Tuple WuiSpec a WuiSpec b WuiSpec c WuiSpec d WuiSpec e gt WuiSpec f gt WuiSpec g WuiSpec h gt WuiSpec i gt WuiSpec a b c d e f g h i WUI combinator for tuples of arity 9 wCons9 la gt b gt c gt d gt e gt f gt g gt h gt i j WuiSpec a gt WuiSpec b gt WuiSpec c gt WuiSpec d WuiSpec e gt WuiSpec f WuiSpec g WuiSpec h gt WuiSpec i WuiSpec j WUI combinator for constructors of arity 9 The first argument is the ternary construc tor The further arguments are the WUI specifications for the argument types wCons9JS Maybe JSExp JSExp gt a gt b gt c gt d gt e gt f gt g gt h gt i gt j gt WuiSpec a gt WuiSpec b gt WuiSpec c WuiSpec d WuiSpec e WuiSpec f gt WuiSpec g WuiSpec h WuiSpec i
87. function must be bijective and operationally invertible i e the inverse must be computable by narrowing Otherwise use transformWSpec wHidden WuiSpec a A hidden widget for a value that is not shown in the WUI Usually this is used in components of larger structures e g internal identifiers data base keys wConstant a HtmlExp WuiSpec a A widget for values that are shown but cannot be modified The first argument is a mapping of the value into a HTML expression to show this value wInt WuiSpec Int A widget for editing integer values wString WuiSpec String A widget for editing string values wStringSize Int WuiSpec String A widget for editing string values with a size attribute wRequiredString WuiSpec String A widget for editing string values that are required to be non empty 216 wRequiredStringSize Int WuiSpec String A widget with a size attribute for editing string values that are required to be non empty wTextArea Int Int WuiSpec String A widget for editing string values in a text area The argument specifies the height and width of the text area wSelect a String a WuiSpec a A widget to select a value from a given list of values The current value should be contained in the value list and is preselected The first argument is a mapping from values into strings to be shown in the selection widget wSelectInt Int gt WuiSpec Int A wi
88. getArgs count number of program lines in a file countCLines String 10 Int countCLines f readFile f gt gt return length filter not isEmptyLine map stripSpaces lines where stripSpaces reverse dropWhile isSpace reverse dropWhile isSpace isEmptyLine True isEmptyLine _ False isEmptyLine cl c2 _ cl amp amp c2 The main program reads Curry file names from arguments main do args lt getArgs maplO_ f do ls lt countCLines f putStrLn Stripped lines of file f show 1s args If this script is stored in the executable file codelines sh we can count the code lines of the file Prog curry by the shell command gt codelines sh Prog curry When this command is executed the command runcurry compiles the program and evaluates the expression main Since the compilation might take some time in more complex scripts one can also save the result of the compilation in a binary file To obtain this behavior one has to insert the line jit in the script file e g in the second line With this option a binary of the compiled program is saved in the same directory as the script Now when the same script is executed the next time the stored binary file is executed provided that it is still newer than the script file itself otherwise it will be recompiled This feature combines easy scripting with Curry together with fast execution Al
89. given part of code is at the beginning of a line or in the middle The state scanner organizes the code in such a way that every string categorized as Code always starts in the middle of a line plainCode Token String Yields the program code without comments but with the line breaks for small com ments unscan Token String Inverse function of scan i e unscan scan x x unscan is used to yield a program after changing the list of tokens readScan String I0 Token return tokens for given filename testScan String gt I0 test whether unscan scan is identity 304 B Markdown Syntax This document describes the syntax of texts containing markdown elements The markdown syntax is intended to simplify the writing of texts whose source is readable and can be easily formatted e g as part of a web document It is a subset of the original markdown syntax basically only internal links and pictures are missing supported by the Curry library Markdown B 1 Paragraphs and Basic Formatting Paragraphs are separated by at least one line which is empty or does contain only blanks Inside a paragraph one can emphasize text or also strongly emphasize text This is done by wrapping it with one or two _ or characters _emphasize_ emphasize __strong__ strong Furthermore one can also mark program code text by backtick quotes The function fib computes Fibonacci numbers
90. gt b gt WuiSpec a gt WuiSpec b Adapt a WUI specification to a new type For this purpose the first argument must be a transformation mapping values from the old type to the new type This function must be bijective and operationally invertible i e the inverse must be computable by narrowing Otherwise use transformWSpec wHidden WuiSpec a A hidden widget for a value that is not shown in the WUI Usually this is used in components of larger structures e g internal identifiers data base keys wConstant a HtmlExp WuiSpec a A widget for values that are shown but cannot be modified The first argument is a mapping of the value into a HTML expression to show this value WuiSpec Int A widget for editing integer values wString WuiSpec String A widget for editing string values 223 wStringSize Int WuiSpec String A widget for editing string values with a size attribute wRequiredString WuiSpec String A widget for editing string values that are required to be non empty wRequiredStringSize Int WuiSpec String A widget with a size attribute for editing string values that are required to be non empty wTextArea Int Int gt WuiSpec String A widget for editing string values in a text area The argument specifies the height and width of the text area wSelect a String a WuiSpec a A widget to select a value from a given list of values The current
91. has to put the line OPTIONS_CYMAKE F pgmF currypp optF foreigncode optF defaultrules optF o at the beginning of the program 9 1 Integrated Code Integrated code is enclosed in at least two back ticks and ticks in a Curry program The number of starting back ticks and ending ticks must be always identical After the initial back ticks there must be an identifier specifying the kind of integrated code e g regexp or html see below For instance if one uses regular expressions see below for more details the following expressions are valid in source programs 35 s regex al bc ccece s regex abaxc The Curry preprocessor transforms these code pieces into regular Curry expressions The next sections describe the currently supported foreign languages 9 1 1 Regular Expressions In order to match strings against regular expressions i e to check whether a string is contained in the language generated by a regular expression one can specify regular expression similar to POSIX The foreign regular expression code must be marked by regexp Since this code is transformed into operations of the PAKCS library RegExp this library must be imported For instance the following module defines a predicate to check whether a string is a valid identifier OPTIONS_CYMAKE F pgmF currypp optF foreigncode import RegExp isID String Bool isID s s regex a zA Z la z
92. installed it is used by PAKCS if called on a terminal If it should not be used e g because it is executed in an editor with readline functionality one can call PAKCS with the parameter noreadline 2 6 Customization In order to customize the behavior of PAKCS to your own preferences there is a configuration file which is read by PAKCS when it is invoked When you start PAKCS for the first time a standard 6 version of this configuration file is copied with the name pakcsrc into your home directory The file contains definitions of various settings e g about showing warnings progress messages etc After you have started PAKCS for the first time look into this file and adapt it to your own preferences 2 7 Emacs Interface Emacs is a powerful programmable editor suitable for program development It is freely available for many platforms see http www emacs org The distribution of PAKCS contains also a special Curry mode that supports the development of Curry programs in the Emacs environment This mode includes support for syntax highlighting finding declarations in the current buffer and loading Curry programs into PAKCS in an Emacs shell The Curry mode has been adapted from a similar mode for Haskell programs Its installation is described in the file README in directory pakcshome tools emacs which also contains the sources of the Curry mode and a short description about the use of this mode 16 3
93. is parameterized over the kind of function e TermCons a gt Term a gt Term a TermCons name args The constructor with constructor name and argument terms args A 3 13 Library Rewriting Substitution Library for representation of substitutions on first order terms Exported types type Subst a FM Int Term a The abstract data type for substitutions 194 Exported functions showSubst FM Int Term a gt String Pretty string representation of a substitution emptySubst FM Int Term a The empty substitution extendSubst FM Int Term a gt Int Term a gt FM Int Term a Extend the substitution with the given mapping lookupSubst FM Int Term a gt Int Maybe Term a Searches the substitution for a mapping from the given variable index to a term applySubst FM Int Term a Term a Term a Applies a substitution to a single term A 3 14 Library Rewriting Unification Library for unification on first order terms This library implements a unification algorithm using reference tables Exported functions unl e erm a lerm a gt ither nificationError a nt erm a ify CT T Either UnificationE FM Int T Unifies the given equations A 3 15 Library Rewriting UnificationSpec Library for specifying the unification on first order terms This library implements a general unification algorithm Because the algorithm is easy to under stand but rather slow it serves as a
94. is rendered without any changes nest Int Doc Doc The document nest i d renders document d with the current indentation level in creased by i See also hang align and indent 146 hang nest 2 text hello text world text I outputs as hello world Int Doc Doc The combinator hang implements hanging indentation The document hang i d renders document d with a nesting level set to the current column plus i The following example uses hanging indentation for some text test hang 4 fillSep map text words the hang combinator indents these words Which lays out on a page with a width of 20 characters as the hang combinator indents these words The hang combinator is implemented as hang ix align nest i x align Doc Doc The document align d renders document d with the nesting level set to the current column It is used for example to implement hang As an example we will put a document right above another one regardless of the current nesting level x y align x y test text hi lt gt text nice text world which will be layed out as hi nice world 147 indent Int Doc Doc The document indent i d indents document d with i spaces test indent 4 fillSep map text words the indent combinator indents these words Which lays out with a page width of 20 as the indent combinator indents thes
95. is stored in the file prog profile where prog is the current main program The profile mode has no effect outside the debug mode suspend Suspend mode initially it is off If the suspend mode is on all suspended expressions if there are any are shown in their internal representation at the end of a computation time Time mode If the time mode is on the cpu time and the elapsed time of the computation is always printed together with the result of an evaluation verbose Verbose mode initially it is off If the verbose mode is on the initial expression of a computation is printed before it is evaluated If the verbose mode is on and the verbosity level see below is non zero the type of the initial expression is also printed and the output of the evaluation is more detailed warn Parser warnings If the parser warnings are turned on default the parser will print warnings about variables that occur only once in a program rule see Section 1 2 or locally declared names that shadow the definition of globally declared names If the parser warnings are switched off these warnings are not printed during the reading of a Curry program path path Set the additional search path for loading modules to path Note that this search path is only used for loading modules inside this invocation of PAKCS i e the environment variable CURRYPATH se
96. isTupleld String String Bool Check whether an identifier represents a tuple indent Options gt Doc gt Doc Indentation A 5 10 Library FlatCurry Read This library defines operations to read a FlatCurry programs or interfaces together with all its imported modules in the current load path Exported functions readFlatCurryWithImports String I0 Prog Reads a FlatCurry program together with all its imported modules The argument is the name of the main module possibly with a directory prefix readFlatCurryWithImportsInPath String String 10 Prog Reads a FlatCurry program together with all its imported modules in a given load path The arguments are a load path and the name of the main module readFlatCurryIntWithImports String gt I0 Prog Reads a FlatCurry interface together with all its imported module interfaces The argument is the name of the main module possibly with a directory prefix If there is no interface file but a FlatCurry file suffix fcy the FlatCurry file is read instead of the interface readFlatCurryIntWithImportsInPath String gt String gt 10 Prog Reads a FlatCurry interface together with all its imported module interfaces in a given load path The arguments are a load path and the name of the main module If there is no interface file but a FlatCurry file suffix fey the FlatCurry file is read instead of the interface A 5
97. left to right 46 15 Technical Problems Due to the fact that Curry is intended to implement distributed systems see Appendix A 1 3 it might be possible that some technical problems arise due to the use of sockets for implementing these features Therefore this section gives some information about the technical requirements of PAKCS and how to solve problems due to these requirements There is one fixed port that is used by the implementation of PAKCS Port 8766 This port is used by the Curry Port Name Server CPNS to implement symbolic names for ports in Curry see Appendix A 1 3 If some other process uses this port on the machine the distribution facilities defined in the module Ports see Appendix A 1 3 cannot be used If these features do not work you can try to find out whether this port is in use by the shell command netstat a fgrep 8766 or similar The CPNS is implemented as a demon listening on its port 8766 in order to serve requests about registering a new symbolic name for a Curry port or asking the physical port number of a Curry port The demon will be automatically started for the first time on a machine when a user compiles a program using Curry ports It can also be manually started and terminated by the scripts pakcshome cpns start and pakcshome cpns stop If the demon is already running the command pakcshome cpns start does nothing so it can be always executed before invoking a Curry program using po
98. might suspend the implementation must follow the structure of the PAKCS run time system by using the raw interface In this case the name of the external entry must be suffixed by raw in the prim_c2p file For instance if we want to use the raw interface for the external function prim_Int_plus the specification file Prelude prim_c2p must have an entry of the form lt primitive name prim_Int_plus arity 2 gt lt library gt prim_standard lt library gt lt entry gt prim_Int_plus raw lt entry gt lt primitive gt In the raw interface the actual implementation of an n ary external function consists of the definition of an n 3 ary predicate pred The first n arguments are the corresponding actual arguments The n 1 th argument is a free variable which must be instantiated to the result of the function call after successful execution The last two arguments control the suspension behavior of the function see 5 for more details The code for the predicate pred should only be executed when the n 2 th argument is not free i e this predicate has always the SICStus Prolog block declaration block pred 7 In addition typical external functions should suspend until the actual arguments are instan tiated This can be ensured by a call to ensureNotFree or before calling the external function Finally the last argument which is a free variable at call time must be unified with the n 2 th arg
99. modes for positioning with hSeek in a file Exported constructors e AbsoluteSeek SeekMode e RelativeSeek SeekMode e SeekFromEnd SeekMode 121 Exported functions stdin Handle Standard input stream stdout Handle Standard output stream stderr Handle Standard error stream openFile String IOMode 10 Handle Opens a file in specified mode and returns a handle to it hClose Handle gt 10 Closes a file handle and flushes the buffer in case of output file hFlush Handle gt 10 Flushes the buffer associated to handle in case of output file hIsEOF Handle 10 Bool Is handle at end of file isEOF 10 Bool Is standard input at end of file hSeek Handle gt SeekMode gt Int gt 10 Set the position of a handle to a seekable stream e g a file Tf the second argument is AbsoluteSeek SeekFromEnd or RelativeSeek the position is set relative to the beginning of the file to the end of the file or to the current position respectively hWaitForInput Handle Int gt 10 Bool Waits until input is available on the given handle If no input is available within t milliseconds it returns False otherwise it returns True hWaitForInputs Handle gt Int gt IO Int Waits until input is available on some of the given handles If no input is available within t milliseconds it returns 1 otherwise it returns the index of the corresponding handle with the availabl
100. new GUI window in passive mode i e ignore all GUI events runGUI String gt Widget gt 10 IO action to run a Widget in a new window runGUIwithParams String gt String Widget I0 IO action to run a Widget in a new window runInitGUI String Widget GuiPort I0 ReconfigureItem gt 10 IO action to run a Widget in a new window The GUI events are processed after executing an initial action on the GUI runInitGUIwithParams String String Widget GuiPort gt I0 ReconfigureItem gt I0 O 115 IO action to run a Widget in a new window The GUI events are processed after executing an initial action on the GUI runControlledGUI String gt Widget String GuiPort I0 Handle gt I0 O Runs a Widget in a new GUI window and process GUI events In addition an event handler is provided that process messages received from an external stream identified by a handle third argument This operation is useful to run a GUI that should react on user events as well as messages written to the given handle runConfigControlledGUI String gt Widget String GuiPort gt I0 Reconfigureltem gt Handle gt 10 Runs a Widget in a new GUI window and process GUI events In addition an event handler is provided that process messages received from an external stream identified by a handle third argument This operation is useful to run a GUI that sho
101. of a multiset of values by applying a binary operation This is similarly to fold on lists but the binary operation must be commutative so that the result is independent of the order of applying this operation to all elements in the multiset foldValues a gt a gt a gt a gt Values a gt a Accumulates all elements of a multiset of values by applying a binary operation This is similarly to fold on lists but the binary operation must be commutative so that the result is independent of the order of applying this operation to all elements in the multiset minValue a gt a gt Bool gt Values a gt a Returns the minimal element of a non empty multiset of values with respect to a given total ordering on the elements maxValue a gt a gt Bool gt Values a gt a Returns the maximal element of a non empty multiset of value with respect to a given total ordering on the elements values2list Values a gt I0 la Puts all elements of a multiset of values in a list Since the order of the elements in the list might depend on the time of the computation this operation is an I O action printValues Values a gt 10 Prints all elements of a multiset of values sortValues Values a gt la Transforms a multiset of values into a list sorted by the standard term ordering As a consequence the multiset of values is completely evaluated sortValuesBy a gt a Bool Values a gt a T
102. option Do not use input line editing see Sec tion 2 5 Dname val these options must come before any PAKCS command Overwrite values defined in the configuration file pakcsrc see Section 2 6 where name is a property defined in the configuration file and val its new value q or quiet With this option PAKCS works silently i e the initial banner and the in put prompt are not shown The output of other information is determined by the options verbose and vn see Section 2 3 2 2 Commands of PAKCS The most important commands of PAKCS are it is sufficient to type a unique prefix of a 199 command if it is unique e g one can type r instead of reload help Show a list of all available commands load prog Compile and load the program stored in prog curry together with all its imported modules If this file does not exist the system looks for a FlatCurry file prog fcy and compiles from this intermediate representation If the file prog fcy does not exists too the system looks for a file prog_flat xml1 containing a FlatCurry program in XML representation compare command xm1 translates this into a FlatCurry file prog fcy and compiles from this intermediate representation reload Recompile all currently loaded modules add m1 mMn Add modules m1 Mn to the set of currently load
103. programming concurrent evaluation of constraints with synchronization on logical variables Moreover the PAKCS im plementation of Curry also supports constraint programming over various constraint domains the high level implementation of distributed applications graphical user interfaces and web services as described in more detail in 15 16 17 Since PAKCS compiles Curry programs into Prolog programs the availability of some of these features might depend on the underlying Prolog system We assume familiarity with the ideas and features of Curry as described in the Curry language definition 23 Therefore this document only explains the use of the different components of PAKCS and the differences and restrictions of PAKCS see Section 1 2 compared with the language Curry Version 0 9 0 Acknowledgements This work has been supported in part by the DAAD NSF grant INT 9981317 the NSF grants CCR 0110496 and CCR 0218224 the Acci n Integrada hispano alemana HA1997 0073 and the DFG grants Ha 2457 1 2 Ha 2457 5 1 and Ha 2457 5 2 Many thanks to the users of PAKCS for bug reports bug fixes and improvements in particular to Marco Comini Sebastian Fischer Massimo Forni Carsten Heine Stefan Junge Frank Huch Parissa Sadeghi 1 Overview of PAKCS 1 1 General Use This version of PAKCS has been tested on Sun Solaris Linux and Mac OS X systems In principle it should be also executable on other platforms on which a Prolog sy
104. radio buttons respectively wPair WuiSpec a gt WuiSpec b WuiSpec a b WUI combinator for pairs 217 wCons2 a gt b gt c gt WuiSpec a WuiSpec b WuiSpec c WUI combinator for constructors of arity 2 The first argument is the binary con structor The second and third arguments are the WUI specifications for the argument types wTriple WuiSpec a WuiSpec b WuiSpec c WuiSpec a b c WUI combinator for triples wCons3 a b c gt d WuiSpec a gt WuiSpec b WuiSpec c WuiSpec d WUI combinator for constructors of arity 3 The first argument is the ternary construc tor The further arguments are the WUI specifications for the argument types w4Tuple WuiSpec a WuiSpec b WuiSpec c WuiSpec d WuiSpec a b c d WUI combinator for tuples of arity 4 wCons4 a gt b gt c d e gt WuiSpec a gt WuiSpec b gt WuiSpec c gt WuiSpec d WuiSpec e WUI combinator for constructors of arity 4 The first argument is the ternary construc tor The further arguments are the WUI specifications for the argument types woTuple WuiSpec a WuiSpec b WuiSpec c WuiSpec d WuiSpec e gt WuiSpec a b c d e WUI combinator for tuples of arity 5 wConsb a gt b gt c d gt e gt f gt WuiSpec a gt WuiSpec b WuiSpec c gt WuiSpec d WuiSpec e gt WuiSpec f WUI combinator for constructors of
105. searchPathSeparator Char isSearchPathSeparator Char Bool extSeparator Char isExtSeparator Char Bool splitSearchPath String gt String getSearchPath 10 String splitExtension String String String takeExtension String gt String replaceExtension String String String lt gt String gt String gt String dropExtension String gt String addExtension String String String hasExtension String gt Bool 95 splitExtensions String gt String String dropExtensions String String takeExtensions String String splitDrive String gt String String joinDrive String String String takeDrive String String dropDrive String String hasDrive String Bool isDrive String Bool splitFileName String gt String String replaceFileName String String String dropFileName String gt String takeFileName String gt String takeBaseName String String 96 replaceBaseName String String String hasTrailingPathSeparator String Bool addTrailingPathSeparator String String dropTrailingPathSeparator String String takeDirectory String gt String replaceDirectory String String String combine String String String lt gt String gt String gt String splitPath String
106. spy point break point on the function f In the single mode you can leap from spy point to spy point see the options shown in the single mode spy Turn on off spy mode for debugging If the spy mode is on the single mode is automati cally activated when a spy point is reached 2 4 Using PAKCS in Batch Mode Although PAKCS is primarily designed as an interactive system it can also be used to process data in batch mode For example consider a Curry program say myprocessor that reads argument strings from the command line and processes them Suppose the entry point is a function called just_doit that takes no arguments Such a processor can be invoked from the shell as follows 15 gt pakcs set args stringi string2 load myprocessor curry eval just_doit quit The quit directive in necessary to avoid PAKCS going into interactive mode after the excution of the expression being evaluated The actual run time arguments string1 string2 are defined by setting the option args see above Here is an example to use PAKCS in this way gt pakcs set args Hello World add System eval getArgs gt gt putStrLn unwords quit Hello World gt 2 5 Command Line Editing In order to have support for line editing or history functionality in the command line of PAKCS as often supported by the readline library you should have the Unix command rlwrap installed on your local machine If rlwrap is
107. start with a hexadecimal number token Nothing is returned otherwise the result is Just v s where v is the value of the number and s is the remaing string without the number token readOct String Maybe Int String Read an octal number as a first token in a string The string might contain leadings blanks and the number is read up to the first non octal digit If the string does not start with an octal number token Nothing is returned otherwise the result is Just v s where v is the value of the number and s is the remaing string without the number token 163 A 2 49 Library ReadShowTerm Library for converting ground terms to strings and vice versa Exported functions showTerm a String Transforms a ground term into a string representation in standard prefix notation Thus showTerm suspends until its argument is ground This function is similar to the prelude function show but can read the string back with readUnqualifiedTerm provided that the constructor names are unique without the module qualifier showQTerm a gt String Transforms a ground term into a string representation in standard prefix notation Thus showTerm suspends until its argument is ground Note that this function differs from the prelude function show since it prefixes constructors with their module name in order to read them back with readQTerm readsUnqualifiedTerm String gt String gt a String Transform a
108. string containing a term in standard prefix notation without module qual ifiers into the corresponding data term The first argument is a non empty list of module qualifiers that are tried to prefix the constructor in the string in order to get the qualified constructors that must be defined in the current program In case of a successful parse the result is a one element list containing a pair of the data term and the remaining unparsed string readUnqualifiedTerm String String gt a Transforms a string containing a term in standard prefix notation without module qualifiers into the corresponding data term The first argument is a non empty list of module qualifiers that are tried to prefix the constructor in the string in order to get the qualified constructors that must be defined in the current program Example readUnqualifiedTerm Prelude Just 3 evaluates to Just 3 readsTerm String gt a String For backward compatibility Should not be used since their use can be problematic in case of constructors with identical names in different modules readTerm String gt a For backward compatibility Should not be used since their use can be problematic in case of constructors with identical names in different modules readsQTerm String gt a String 164 Transforms a string containing a term in standard prefix notation with qualified con structor names into the corresponding data term In case
109. tag htm1 i e the use of the layout rule avoids closing tags and Curry expressions evaluating to strings String and XML expressions Xm1Exp can be included by enclosing them in curly and double curly brackets respectively The following example program shows its use OPTIONS_CYMAKE F pgmF currypp optF foreigncode import HTML import XML main 10 main putStrLn showXmlDoc head xml lt contact gt lt entry gt lt phone gt 49 431 8807271 lt name gt Hanus lt first gt Michael lt email gt mh informatik uni kiel de lt email gt hanus email uni kiel de lt entry gt lt name gt Smith lt first gt Bill lt phone gt 1 987 742 9388 a 9 2 Sequential Rules If the Curry preprocessor is called with the option seqrules then all rules in the Curry module are interpreted in a sequential manner i e a rule is applied only if all previous rules defining the same operation are not applicable either because the left hand side s pattern does not match or the condition is not satisfiable The idea and detailed semantics of sequential rules are described in 8 Sequential rules are useful and preferable over rules with multiple guards if the patterns are non trivial e g functional patterns or the condition involve complex constraints As a simple example the following module defines a lookup operation in association lists by a functional pattern Due to the sequential rule strategy the seco
110. 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 allValues a gt al Returns 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 Note that this operation is not purely declarative since the ordering of the computed values depends on the ordering of the program rules 98 someValue a a Returns some value for an expression currently via an incomplete depth first strat egy If the expression has no value 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 Note that this operation is not purely declarative since the computed value depends on the ordering of the program rules Thus this operation should be used only if the expression has a single value allSolutions a gt Bool la Returns all values satisfying a predicate i e all arguments such that the predicate applied to the argument can be evaluated to True currently via
111. transaction to persistent predicates are ignored and Nothing is returned In general a transaction should terminate and all failures inside a transaction should be handled execept for abortTransaction If a transaction is externally interrupted e g by killing the process some locks might never be removed However they can be explicitly removed by deleting the corresponding lock files reported at startup time Nested transactions are not supported and lead to a failure transactionWithErrorCatch 10 a gt 10 Either a IOError Perform an action usually containing updates of various dynamic predicates as a single transaction This is similar to transaction but an execution error is caught and returned instead of printing it abortTransaction IO a Aborts the current transaction If a transaction is aborted the remaining actions of the transaction are not executed and all changes to persistent dynamic predicates made in this transaction are ignored abortTransaction should only be used in a transaction Although the execution of abortTransaction always fails basically it writes an abort record in log files unlock them and then fails the failure is handled inside transaction A 2 19 Library Either Library with some useful operations for the Either data type Exported functions lefts Either a b gt la Extracts from a list of Either all the Left elements in order rights Either a b gt b Extracts fro
112. 1 m c XmlConv n o d gt XmlConv p q e gt XmlConv r s f XmlConv NotRepeatable NoElem g Creates an XML converter representing a sequence of arbitrary XML data The se quence must not be used in repetitions and does not represent an XML element repSeq6 a gt b gt c gt d gt e gt f gt g gt XmlConv Repeatable h a gt XmlConv Repeatable i b XmlConv Repeatable j c XmlConv Repeatable k d gt XmlConv Repeatable 1 e XmlConv Repeatable m f XmlConv NotRepeatable NoElem g Creates an XML converter that represents a repetition of a sequence of repeatable XML data The repetition may be used in other repetitions and does not represent an XML element This combinator is provided because converters for repeatable sequences cannot be constructed by the seq combinators eSeq6 String a gt b gt c gt d gt e gt f gt g gt XmlConv h ia gt XmlConv j k b gt XmlConv 1 m c gt XmlConv n o d XmlConv p q e gt XmlConv r s f XmlConv Repeatable Elem g 238 Creates an XML converter for compound values represented as an XML element with children that correspond to the values components The element can be used in repe titions eRepSeg6 String gt a gt b gt c gt d gt e gt f gt g gt XmlConv Repeatable h a XmlConv Repeatable i b XmlConv Repeatable j c XmlConv Repeatable k d gt XmlConv Repeatable 1 e gt X
113. 12 220 228 wCons12JS 228 wCons2 218 225 wCons2JS 225 wCons3 218 225 wCons3JS 225 wCons4 218 225 wCons4JS 225 wCons5 218 226 wCons5JS 226 wCons6 218 226 wCons6JS 226 wCons7 219 226 wCons7JS 226 wCons8 219 227 wCons8JS 227 wCons9 219 227 wCons9JS 227 wConstant 216 223 wEither 221 229 where 17 wHidden 216 223 white 158 wHList 220 228 Widget 107 WidgetRef 113 wInt 216 223 withCondition 216 223 withConditionJS 223 withConditionJSName 223 withError 216 223 withRendering 216 223 wJoinTuple 220 225 wList 220 228 wListWithHeadings 220 228 wMatrix 220 229 wMaybe 220 229 wMultiCheckSelect 217 224 wPair 217 225 wRadioBool 217 224 wRadioMaybe 221 229 wRadioSelect 217 224 wRequiredString 216 224 wRequiredStringSize 217 224 writeAbstractCurryFile 246 writeAssertResult 58 writeCSVFile 78 writeFCY 262 writeGlobal 106 writeGVar 107 writel0Ref 125 writeQTermFile 165 writeQTermListFile 165 writeXmlFile 231 writeXmlFileWithParams 231 wSelect 217 224 wSelectBool 217 224 wSelectInt 217 224 wString 216 223 wStringSize 216 224 wTextArea 217 224 WTree 215 222 wTree 221 229 wTriple 218 225 wui2html 221 230 WuiHandler 215 222 wuiHandler2button 216 223 wuilnForm 221 230 337 WuiSpec 215 222 wuiWithErrorForm 221 230 XAttrConv 232 XElemConv 232 xml 231 xml2FlatCurry 280 XmlDocParanms 230 Xml1Exp 230 xm
114. 2 TypeExpr 257 typeName 247 264 289 typeParams 264 289 types 247 typeSyn 265 289 typeVis 247 typeVisibility 264 289 UContext 182 UDecomp 182 UEdge 181 ufold 186 UGr 182 ulist 204 unAnnExpr 300 unAnnFuncDecl 300 unAnnPattern 300 unAnnProg 300 unAnnRule 300 underline 157 unfoldr 139 UnificationError 195 unify 195 196 union 136 unionBy 136 unionRBT 190 unitFM 178 unitType 250 UNode 181 unpack 100 unregisterCgiServer 211 unregisterPort 78 unsafePerforml0 173 unscan 304 unsetEnviron 170 untypedAbstractCurryFileName 246 UPath 182 Update 263 288 update 176 188 updateDBEntry 129 134 135 updateFile 125 updatePropertyFile 162 updateRBT 191 updateValue 117 updateXmlFile 232 335 updBranch 274 299 updBranches 273 298 updBranchExpr 274 299 updBranchPattern 274 299 updCases 273 298 updCombs 272 297 updCons 266 290 updConsArgs 266 291 updConsArity 266 291 updConsName 266 290 updConsVisibility 266 291 updFM 179 updFrees 273 297 updFunc 268 293 updFuncArgs 269 294 updFuncArity 268 293 updFuncBody 269 294 updFuncName 268 293 updFuncRule 269 293 updFuncType 269 293 updFuncTypes 267 292 updFuncVisibility 269 293 updLets 273 297 updLiterals 272 297 updOp 268 292 updOpFixity 268 292 updOpName 268 292 updOpPrecedence 268 293 updOrs 273 297 updPatArgs 274 299 updPatCons 274 299 updPatLiteral 27
115. 2 dateType 250 daysOfMonth 173 debug 12 15 debug mode 12 15 debugTcl 115 Decomp 182 defaultEncoding 200 defaultOptions 253 276 defaultParams 87 defaultRequired 282 deg 185 deg 186 delEdge 183 delEdges 184 delete 136 188 deleteBy 136 deleteDB 81 320 deleteDBEntries 129 134 deleteDBEntry 129 134 135 deleteRBT 190 191 delFromFM 178 delListFromFM 179 delNode 183 delNodes 184 deqHead 177 deqInit 177 deqLast 177 deqLength 177 deqReverse 177 deqTail 177 deqToList 177 digitToInt 59 dirName 93 dlist 204 Doc 145 documentation comment 28 documentation generator 28 doesDirectoryExist 83 doesFileExist 83 domain 67 71 266 291 doneT 81 132 doSend 53 144 dot 155 doubleArrow 155 doubleColon 155 dquote 154 dquotes 153 dropDrive 96 dropExtension 95 dropExtensions 96 dropFileName 96 dropTrailingPathSeparator 97 Dynamic 89 130 dynamic 89 dynamicExists 80 eBool 235 eChar 235 Edge 181 edges 186 eEmpty 235 eFloat 235 eInt 235 element 234 elemFM 180 elemIndex 136 elemIndices 136 elemRBT 189 elemsOf 231 eltsFM 180 Emacs 16 emap 187 emphasize 203 empty 142 145 177 183 188 234 emptyAFCSubst 300 emptyDefaultArray 176 emptyErrorArray 176 emptyFM 178 emptySetRBT 189 emptySubst 195 emptyTableRBT 191 encapsulated search 8 enclose 153 encloseSep 151 encloseSepSpaced 151 Encoding 230 entity re
116. 2 3 4 may give 1 3 4 2 sizedSubset Int gt a gt a Compute any sublist of fixed length of a list Similar to subset but the length of the result is fixed partition a a Compute any partition of a list The output is a list of non empty lists such that their concatenation is a permutation of the input list No guarantee is made on the order of the arguments in the output For example 1 2 3 4 may give 4 2 3 1 and 1 2 3 gives 1 2 31 2 3 U1 111 31 20 18111 2 or 13 2J 01J 76 A 2 11 Library Constraint Some useful operations for constraint programming Exported functions lt a gt a gt Bool Less than on ground data terms as a constraint gt a a gt Bool Greater than on ground data terms as a constraint lt a a Bool Less or equal on ground data terms as a constraint gt a a gt Bool Greater or equal on ground data terms as a constraint andC Bool gt Bool Evaluates the conjunction of a list of constraints orC Bool Bool Evaluates the disjunction of a list of constraints allC a Bool gt a gt Bool Is a given constraint abstraction satisfied by all elements in a list anyC a Bool gt a Bool Is there an element in a list satisfying a given constraint A 2 12 Library CPNS Implementation of a Curry Port Name Server based on raw sockets It is used to implement the li
117. 3 4 1 2 3 4 test2 assertTrue ali all lt 5 1 2 3 4 test3 assertSolutions prefix x gt xt _ 1 2 LEJ 1 1 213 For instance test1 asserts that the result of evaluating the expression 1 2 3 4 is equal to 1 2 3 4 We can execute a test suite by the command currytest TestList currytest is a program stored in pakcshome bin where pakcshome is the installation directory of PAKCS see Section 1 1 In our example TestList curry is the program containing the definition of all assertions This has the effect that all exported top level functions of type Assertion are 33 o A BE Test cases 38 Failures fod Status jtesting Run test Add test module Clear test modules Exit Failed test cases Modules to be tested testCombinatorial testDynamic testInteger testList gt testSort y Compilation messages Test protocol ae malit Loading module testDynamic OK PIETA Exported top level test functions ES testl test2 test3 test4 test5 test6 test test8 test9 test10 OK bitand ae Fite Loading module testInteger OK bitx Exported top level test functions OK an testPow testIlog testIsqrt testAbs testFactorial testBinomia OK Loading module testList A Exported top level test functions ae nodule testList testl test2 test3 OK all OK prefix Loading module testSort f AAA y A A Figure 2 Snapshot of CurryTest
118. 4 299 updPattern 274 299 updProg 263 288 updProgExps 264 289 updProgFuncs 264 288 updProgImports 264 288 updProgName 263 288 updProgOps 264 289 updProgTypes 264 288 updQNames 273 298 updQNamesInConsDecl 266 291 updQNamesInFunc 269 294 updQNamesInProg 264 289 updQNamesInRule 270 295 updQNamesInType 265 290 updQNamesInTypeExpr 267 292 updRule 270 295 updRuleArgs 270 295 updRuleBody 270 295 updRuleExtDecl 270 295 updTCons 267 292 updTVars 267 291 updType 265 289 updTypeConsDecls 265 290 updTypeds 273 298 updTypeName 265 290 updTypeParams 265 290 updTypeSynonym 265 290 updTypeVisibility 265 290 updVars 272 297 urlencoded2string 208 usagelnfo 105 user interface 44 v 14 validDate 173 valueOf 167 Values 166 values2list 168 variables singleton 7 Varldx 194 VarIndex 255 varNr 271 295 varsOfExp 248 varsOfFDecl 248 varsOfLDecl 248 varsOfPat 248 varsOfRhs 248 varsOfRule 249 varsOfStat 248 vcat 150 verbatim 204 verbosity 14 version 245 Visibility 256 vsep 149 336 vsepBlank 150 w10Tuple 219 227 wiiTuple 219 228 wi2Tuple 220 228 w4Tuple 218 225 w5Tuple 218 226 w6Tuple 218 226 w7Tuple 218 226 w8Tuple 219 226 w9Tuple 219 227 waitForSocketAccept 141 169 warn 14 warnSuspendedConstraints 63 wCheckBool 217 224 wCheckMaybe 220 229 wCons10 219 227 wCons10JS 227 wCons11 219 228 wCons11JS 228 wCons
119. 47 isIOReturnType CTypeExpr Bool Returns true if the type expression is IO t with t and t is not functional argTypes CTypeExpr CTypeExpr Returns all argument types from a functional type resultType CTypeExpr CTypeExpr Return the result type from a nested functional type tvarsOfType CTypeExpr gt Int String Returns all type variables occurring in a type expression mods0f Type CTypeExpr String Returns all modules used in the given type funcName CFuncDecl gt String String Returns the name of a given function declaration funcVis CFuncDecl gt CVisibility Returns the visibility of a given function declaration varsOfPat CPattern gt Int String Returns list of all variables occurring in a pattern Each occurrence corresponds to one element i e the list might contain multiple elements varsOfExp CExpr gt Int String Returns list of all variables occurring in an expression Each occurrence corresponds to one element i e the list might contain multiple elements varsOfRhs CRhs gt Int String Returns list of all variables occurring in a right hand side Each occurrence corresponds to one element i e the list might contain multiple elements varsOfStat CStatement gt Int String Returns list of all variables occurring in a statement Each occurrence corresponds to one element i e the list might contain multiple elements
120. 96 takeDirectory 97 takeDrive 96 takeExtension 95 takeExtensions 96 takeFileName 96 tan 102 tanh 102 tConsArgs 266 291 tConsName 266 291 teletype 204 Term 194 TermEq 194 TermEgs 194 terminal 142 TError 79 130 TErrorKind 79 130 testing programs 33 testScan 304 text 146 textarea 206 TextEditScroll 118 textfield 206 textOf 231 textOfXml 231 textstyle 205 tilde 155 time 14 timeoutOnStream 144 toCalendarTime 172 toClockTime 172 toDayString 172 toGoal1 61 toGoal2 61 toGoal3 61 toGoal4 61 toGoal5 61 toGoal6 61 Token 303 Tokens 303 toLower 59 toTimeString 172 toUpper 59 toUTCTime 172 toVar 252 334 trace 15 82 173 traceld 82 tracel0 83 traceShow 82 traceShowld 82 Transaction 80 130 transaction 90 transactionWithErrorCatch 91 transformQ 80 131 transformWSpec 216 223 transpose 137 Traversable 192 trBranch 274 298 trCombType 270 295 trCons 265 290 tree2list 188 trExpr 272 297 trFunc 268 293 trOp 267 292 trPattern 274 299 trProg 263 288 trRule 269 294 trType 264 289 trTypeExpr 266 291 true 60 63 68 75 truncate 101 try 99 tryParse 245 tryReadACYFile 246 tryReadCurryFile 245 tryReadCurryWithImports 245 tupled 152 tupledSpaced 152 tupleExpr 251 tuplePattern 251 tupleType 249 TVarIndex 255 tVarIndex 266 291 tvars0Of Type 248 typeCons 247 typeConsDecls 264 289 TypeDecl 256 TypeEnv 30
121. A Z0 9_ x 9 1 2 Format Specifications In order to format numerical and other data as strings one can specify the desired format with foreign code marked by format In this case one can write a format specification similarly to the printf statement of C followed by a comma separated list of arguments This format specification is transformed into operations of the PAKCS library Format so that it must be imported For instance the following program defines an operation that formats a string an integer with leading sign and zeros and a float with leading sign and precision 3 OPTIONS_CYMAKE F pgmF currypp optF foreigncode import Format showSIF String Int gt Float String showSIF s i f format Name s 5i 6 3f s i f main putStrLn showSIF Curry 42 3 14159 Thus the execution of main will print the line Name Curry 00042 3 142 Instead of format one can also write a format specification with printf In this case the formatted string is printed with putStr Hence we can rewrite our previous definitions as follows showSIF String gt Int gt Float gt 10 showSIF s i f printf Name s 5i 6 3fIn s i f 36 main showSIF Curry 42 3 14159 9 1 3 HTML Code The foreign language tag htm1 introduces a notation for HTML expressions see PAKCS library HTML with the standard HTML syntax extended by a layout rule
122. A selection button with a reference and a list of name value pairs The names are shown in the selection and the value is returned for the selected name selectionInitial CgiRef gt String String Int HtmlExp A selection button with a reference a list of name value pairs and a preselected item in this list The names are shown in the selection and the value is returned for the selected name multipleSelection CgiRef gt String String Bool HtmlExp A selection button with a reference and a list of name value flag pairs The names are shown in the selection and the value is returned if the corresponding name is selected If flag is True the corresonding name is initially selected If more than one name has been selected all values are returned in one string where the values are separated by newline lt code gt n lt code gt characters hiddenfield String String HtmlExp A hidden field to pass a value referenced by a fixed name This function should be used with care since it may cause conflicts with the CGI based implementation of this library htmlQuote String String Quotes special characters lt gt amp umlauts in a string as HTML special characters htmlIsoUmlauts String String Translates umlauts in iso 8859 1 encoding into HTML special characters addAttr HtmlExp gt String String HtmlExp Adds an attribute name value pair to an HTML element addAttrs
123. AExpr a Bool is expression fully evaluated allVars AExpr a gt Int get all variables also pattern variables in expression rnmAllVars Int gt Int gt AExpr a gt AExpr a rename all variables also in patterns in expression updQNames String String gt String String AExpr a gt AExpr a update all qualified names in expression trBranch APattern a gt AExpr a gt b ABranchExpr a gt b transform branch expression branchPattern ABranchExpr a APattern a get pattern from branch expression branchExpr ABranchExpr a gt AExpr a get expression from branch expression 298 updBranch APattern a gt APattern a gt AExpr a gt AExpr a gt ABranchExpr a gt ABranchExpr a update branch expression updBranchPattern APattern a APattern a ABranchExpr a gt ABranchExpr a update pattern of branch expression updBranchExpr AExpr a AExpr a ABranchExpr a gt ABranchExpr a update expression of branch expression trPattern a gt String String a gt Int a gt b gt a gt Literal gt b APattern a gt b transform pattern patCons APattern a gt String String get name from constructor pattern patArgs APattern a gt Int a get arguments from constructor pattern patLiteral APattern a Literal get literal from literal pattern isConsPattern APattern a Bool is pattern a constructor pattern
124. Any which takes a graph and yields a graph decompostion According to the main idea matchAny amp should be an identity empty Graph a b An empty Graph mkGraph Int a gt Int Int b Graph a b Create a Graph from the list of LNodes and LEdges buildGr a Int Int b a Int Graph b a Build a Graph from a list of Contexts mkUGraph Int gt Int Int gt Graph O O Build a quasi unlabeled Graph from the list of Nodes and Edges insNode Int a Graph a b Graph a b Insert a LNode into the Graph insEdge Int Int a Graph b a gt Graph b a Insert a LEdge into the Graph delNode Int Graph a b Graph a b Remove a Node from the Graph delEdge Int Int Graph a b Graph a b Remove an Edge from the Graph insNodes Int a Graph a b gt Graph a b 183 Insert multiple LNodes into the Graph insEdges Int Int a Graph b a gt Graph b a Insert multiple LEdges into the Graph delNodes Int Graph a b gt Graph a b Remove multiple Nodes from the Graph delEdges Int Int gt Graph a b Graph a b Remove multiple Edges from the Graph isEmpty Graph a b Bool test if the given Graph is empty match Int gt Graph a b gt Maybe b Int Int a b Int Graph a b match is the complement side of amp decomposing a Graph into the MContext found for the given node and the remaining Graph noNodes Graph a b
125. Exp String Included for backward compatibility better use textOf xtxt String XmlExp Basic text maybe containing special XML chars xml String XmlExp gt XmlExp XML element without attributes writeXmlFile String gt XmlExp gt 10 Writes a file with a given XML document writeXmlFileWithParams String XmlDocParams XmlExp gt I0 Writes a file with a given XML document and XML parameters showXmlDoc XmlExp String Show an XML document in indented format as a string 231 showXmlDocWithParams XmlDocParams gt XmlExp String readXmlFile String 10 XmlExp Reads a file with an XML document and returns the corresponding XML expression readUnsafeXmlFile String I0 Maybe XmlExp Tries to read a file with an XML document and returns the corresponding XML expres sion if possible If file or parse errors occur Nothing is returned readFileWithXmlDocs String I0 XmlExp Reads a file with an arbitrary sequence of XML documents and returns the list of corresponding XML expressions parseXmlString String gt XmlExp Transforms an XML string into a list of XML expressions If the XML string is a well structured document the list of XML expressions should contain exactly one element updateXmlFile XmlExp gt XmlExp String I0 An action that updates the contents of an XML file by some transformation on the XML document A
126. Exported constructors e JSAssign JSExp JSExp JSStat JSAssign assignment e JSIf JSExp gt JSStat gt JSStat JSStat JSIf conditional e JSSwitch JSExp gt JSBranch gt JSStat JSSwitch switch statement e JSPCall String gt JSExp JSStat JSPCall procedure call e JSReturn JSExp JSStat JSReturn return statement e JSVarDecl Int gt JSStat JSVarDecl local variable declaration data JSBranch Exported constructors e JSCase String gt JSStat gt JSBranch JSCase case branch e JSDefault JSStat JSBranch JSDefault default branch data JSFDecl 127 Exported constructors e JSFDecl String gt Int gt JSStat gt JSFDecl Exported functions showJSExp JSExp String Shows a JavaScript expression as a string in JavaScript syntax showJSStat Int gt JSStat String Shows a JavaScript statement as a string in JavaScript syntax with indenting showJSFDecl JSFDecl String Shows a JavaScript function declaration as a string in JavaScript syntax jsConsTerm String gt JSExp gt JSExp Representation of constructor terms in JavaScript A 2 35 Library 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 A
127. Float Bool Greater than constraint on floats lt Float gt Float gt Bool Less than or equal constraint on floats gt Float gt Float gt Bool Greater than or equal constraint on floats i2f Int Float Conversion function from integers to floats Rigid in the first argument i e suspends until the first argument is ground minimumFor a Bool gt a gt Float gt a Computes the minimum with respect to a given constraint minimumFor g f evaluates to x if g x is satisfied and f x is minimal The evaluation fails if such a minimal value does not exist The evaluation suspends if it contains unbound non local variables minimize a Bool gt a gt Float gt a gt Bool Minimization constraint minimize g f x is satisfied if g x is satisfied and f x is minimal The evaluation suspends if it contains unbound non local variables maximumFor a Bool gt a gt Float gt a Computes the maximum with respect to a given constraint maximumFor g f evaluates to x if g x is satisfied and f x is maximal The evaluation fails if such a maximal value does not exist The evaluation suspends if it contains unbound non local variables maximize a Bool gt a gt Float gt a gt Bool Maximization constraint maximize g f x is satisfied if g x is satisfied and f x is maximal The evaluation suspends if it contains unbound
128. ForInputsOrMsg 123 i2f 74 101 identicalVar 174 idOfCgiRef 200 ilog 119 image 205 imageButton 206 imports 246 inCurrySubdir 87 inCurrySubdirModule 87 indeg 185 indeg 186 indent 148 279 287 indentWidth 276 index 128 135 indomain 73 inferExpr 302 inferFunction 302 inferFunctionEnv 302 324 inferNewFunctions 302 inferProg 302 inferProgEnv 302 inferProgFromProgEnv 302 init 138 inits 138 inject 99 inline 205 inn 185 inn 186 insEdge 183 insEdges 184 insertBy 138 insertMultiRBT 189 insertRBT 189 insNode 183 insNodes 183 installDir 86 int 154 233 interactive 13 intercalate 137 intersect 136 intersectBy 137 intersectFM 179 intersectFM_C 179 intersectRBT 190 intersperse 137 intForm 209 intFormMain 209 intToDigit 59 intType 250 inverse 157 invf1 103 invf2 103 invf3 103 invf4 103 invf5 103 IOMode 121 IORef 124 ioType 249 isAbsolute 93 98 isAlpha 59 isAlphaNum 59 isAscii 58 isAsciiLower 58 isAsciiUpper 58 isBaseType 247 isBigComment 304 isBinDigit 59 isCase 272 297 isCode 304 isComb 272 297 isCombTypeConsCall 270 295 isCombTypeConsPartCall 271 295 isCombTypeFuncCall 270 295 isCombTypeFuncPartCall 270 295 isComment 304 isConsCall 273 298 isConsId 278 isConsPartCall 273 298 isConsPattern 274 299 isControl 59 isDigit 59 isDrive 96 isEmpty 146 167 177 184 188 isEmptyFM 180 isEmpt
129. Item e CText Int Int String gt String gt CanvasItem data WidgetRef The hidden data type of references to a widget in a GUI window Note that the constructor WRefLabel will not be exported so that values can only be created inside this module Exported constructors data Style The data type of possible text styles Exported constructors 113 data Bold Style Bold text in bold font Italic Style Italic text in italic font Underline Style Underline underline text Fg Color Style Fg foreground color i e color of the text font Bg Color gt Style Bg background color of the text Color The data type of possible colors Exported constructors Black Color Blue Color Brown Color Cyan Color Gold Color Gray Color Green Color Magenta Color Navy Color Orange Color 114 e Pink Color e Purple Color e Red Color e Tomato Color e Turquoise Color e Violet Color e White Color e Yellow Color Exported functions row Widget Widget Horizontal alignment of widgets col Widget Widget Vertical alignment of widgets matrix Widget Widget Matrix alignment of widgets debugTcl Widget gt I0 Prints the generated Tcl commands of a main widget useful for debugging runPassiveGUI String Widget IO GuiPort IO action to show a Widget in a
130. M 179 sleep 170 snoc 177 Socket 141 169 socketAccept 141 169 socketName 141 softbreak 146 softline 146 solve 72 solveAll 99 solveCHR 62 63 solveFD 68 some 143 someDBInfos 133 someDBKeyInfos 133 someDBKeyProjections 133 someDBKeys 133 someSolution 99 someValue 99 sort 188 sortBy 138 sortByIndex 129 135 sortRBT 190 sortValues 168 sortValuesBy 168 SP_Msg 143 space 155 spawnConstraint 173 specials 88 spiceup 43 Spicey 43 split 137 splitBaseName 94 splitDirectories 97 splitDirectoryBaseName 94 splitDrive 96 splitExtension 95 splitExtensions 96 splitFileName 96 splitFM 179 splitModuleFileName 86 splitModuleIdentifiers 86 splitOn 137 splitPath 94 97 splitSearchPath 95 splitSet 76 spy 15 333 sqrt 101 squote 154 squotes 153 standardForm 201 standardPage 202 star 143 stderr 122 stdin 122 stdout 122 string 153 233 string2ac 252 string2urlencoded 208 stringList2ItemList 196 stringPattern 251 stringType 250 stripCurrySuffix 86 stripSuffix 94 strong 203 Style 113 style 205 styleSheet 205 submitForm 211 subset 76 Subst 194 subst 301 substBranch 301 substExpr 301 substFunc 301 substPattern 301 substRule 301 substSnd 301 suc 184 suc 185 suffixSeparatorChar 93 sum 68 73 138 system 170 table 205 TableRBT 191 tableRBT21list 191 tabulator stops 7 tag0f 231 tails 138 takeBaseName
131. M a b gt a gt b gt FMab Throws away any previous binding and stores the new one given addListToFM FM a b gt a b gt FMa b Throws away any previous bindings and stores the new ones given The items are added starting with the first one in the list addToFM_C a a a FM b a b gt a gt Mba Instead of throwing away the old binding addToFM_C combines the new element with the old one addListToFM_C a gt a gt a FM ba gt b a Mba Combine with a list of tuples key element cf addToFM_C delFromFM FMab a FM ab Deletes key from finite map Deletion doesn t complain if you try to delete something which isn t there 178 delListFromFM FM a b gt la gt FM ab Deletes a list of keys from finite map Deletion doesn t complain if you try to delete something which isn t there updFM FM a b gt a gt b gt b gt Mab Applies a function to element bound to given key splitFM FM a b gt a Maybe FM a b a b Combines delFrom and lookup plusFM FM a b gt FM a b gt FMa b Efficiently add key element mappings of two maps into a single one Bindings in right argument shadow those in the left plusFMC a gt a a gt FM b a gt Mba Mba Efficiently combine key element mappings of two maps into a single one cf addToFM_C minusFM FM a b gt FMa b gt FMab minusFM a1 a2 deletes from al any bindings which are b
132. PathForModule 87 getLocalTime 172 getModificationTime 83 getOneSolution 56 getOneValue 56 getOpenFile 119 getOpenFileWithTypes 119 getOpt 105 getOpt 105 getPID 170 getPortInfo 78 getProcessInfos 160 getProgName 170 getRandomSeed 187 getRcVar 86 getRcVars 86 gets 93 getSaveFile 119 getSaveFileWithTypes 119 getSearchPath 95 getSearchTree 56 getSomeValue 98 getTemporaryDirectory 84 323 getTypeEnv 303 getTypeEnvFromProgEnv 303 getUrlParameter 208 getValue 117 Global 105 global 106 GlobalSpec 105 gmap 186 Goal 60 63 Graph 182 green 157 ground 62 group 137 146 groupBy 137 groupByIndex 129 135 guardedRule 250 GuiPort 107 GVar 106 gvar 107 h1 203 h2 203 h3 203 h4 203 h5 203 Handle 121 hang 147 hardline 146 hasDrive 96 hasExtension 95 hasTrailingPathSeparator 97 hcat 150 hClose 122 headedTable 205 header 203 hempty 202 hEncloseSep 151 hFlush 122 hGetChar 123 hGetContents 123 hGetLine 123 hiddenfield 207 hIsEOF 122 hIsReadable 124 hIsTerminalDevice 124 hIsWritable 124 hPrint 124 hPutChar 123 hPutStr 123 hPutStrLn 123 hReady 123 href 204 hrule 205 hSeek 122 hsep 149 htmldir 88 HtmlExp 197 HtmlForm 197 HtmlHandler 197 htmlIsoUmlauts 207 HtmlPage 199 htmlQuote 207 htmlSpecialChars2tex 209 htxt 202 htxts 202 hWaitForInput 122 hWaitForInputOrMsg 122 hWaitForInputs 122 hWait
133. Prog a update name of program updProgImports String Stringl AProg a AProg a update imports of program updProgTypes TypeDecl TypeDecl gt AProg a gt AProg a update type declarations of program updProgFuncs AFuncDecl a AFuncDecl al AProg a gt AProg a update functions of program 288 updProgOps OpDec1 gt OpDecl AProg a gt AProg a update infix operators of program allVarsInProg AProg a Int get all program variables also from patterns updProgExps AExpr a AExpr a AProg a gt AProg a lift transformation on expressions to program rnmAllVarsInProg Int Int AProg a gt AProg a rename programs variables updQNamesInProg String String gt String String AProg a gt AProg a update all qualified names in program rnmProg String AProg a AProg a rename program update name of and all qualified names in program trType String String gt Visibility Int gt ConsDec1 gt a gt String String Visibility Int TypeExpr a TypeDecl gt a transform type declaration typeName TypeDecl gt String String get name of type declaration typeVisibility TypeDecl Visibility get visibility of type declaration typeParams TypeDecl gt Int get type parameters of type declaration typeConsDecls TypeDecl gt ConsDec1 get constructor declarations from type de
134. Rule 0 Comb FuncCall Prelude cond Comb FuncCall Prelude Var 0 Lit Intc 2 Comb FuncCall Prelude True Exported constructors e Var Int Expr Var variable represented by unique index e Lit Literal Expr Lit literal Int Float Char constant e Comb CombType gt String String Expr Expr Comb application f el en of function constructor f with n lt arity f e Let Int Expr gt Expr gt Expr Let introduction of local variables via recursive let declarations e Free Int gt Expr Expr Free introduction of free local variables e Or Expr Expr Expr Or disjunction of two expressions used to translate rules with overlapping left hand sides e Case CaseType Expr gt BranchExpr Expr Case case distinction rigid or flex e Typed Expr TypeExpr Expr Typed typed expression to represent an expression with a type declaration 260 data BranchExpr Data type for representing branches in a case expression Branches m c x1 xn gt e in case expressions are represented as Branch Pattern m c il in e where each ij is the index of the pattern variable xj or as Branch LPattern Intc i e for integers as branch patterns similarly for other literals like float or character con stants Exported constructors e Branch Pattern Ex
135. Spec 1 WuiSpec m wList WuiSpec a WuiSpec a WUI combinator for list structures where the list elements are vertically aligned in a table wListWithHeadings String WuiSpec a WuiSpec a Add headings to a standard WUI for list structures wHList WuiSpec a WuiSpec a 228 WUI combinator for list structures where the list elements are horizontally aligned in a table wMatrix WuiSpec a gt WuiSpec a WUI for matrices i e list of list of elements visualized as a matrix wMaybe WuiSpec Bool WuiSpec a a WuiSpec Maybe a WUI for Maybe values It is constructed from a WUI for Booleans and a WUI for the potential values Nothing corresponds to a selection of False in the Boolean WUI The value WUI is shown after the Boolean WUI wCheckMaybe WuiSpec a gt HtmlExp a WuiSpec Maybe a A WUI for Maybe values where a check box is used to select Just The value WUI is shown after the check box wRadioMaybe WuiSpec a gt HtmlExp HtmlExp a WuiSpec Maybe a A WUI for Maybe values where radio buttons are used to switch between Nothing and Just The value WUI is shown after the radio button WUI wEither WuiSpec a WuiSpec b WuiSpec Either a b WUI for union types Here we provide only the implementation for Either types since other types with more alternatives can be easily reduced to this case wTree WuiSpec a gt WuiSpec WTr
136. UI for showing test of a module Used by the currytest tool showTestCase Int String Bool gt IO String Bool Sends message to GUI for showing result of executing a test case Used by the currytest tool showTestEnd Int gt 10 Sends message to GUI for showing end of module test Used by the currytest tool showTestCompileError Int gt 10 Sends message to GUI for showing compilation errors in a module test Used by the currytest tool A 2 3 Library Char Library with some useful functions on characters Exported functions isAscii Char Bool Returns true if the argument is an ASCII character isLatini Char Bool Returns true if the argument is an Latin 1 character isAsciiLower Char Bool Returns true if the argument is an ASCII lowercase letter isAsciiUpper Char Bool Returns true if the argument is an ASCII uppercase letter 58 isControl Char Bool Returns true if the argument is a control character isUpper Char Bool Returns true if the argument is an uppercase letter isLower Char Bool Returns true if the argument is an lowercase letter isAlpha Char Bool Returns true if the argument is a letter isDigit Char Bool Returns true if the argument is a decimal digit isAlphaNum Char Bool Returns true if the argument is a letter or digit isBinDigit Char Bool Returns true if the argument is a binary digit isOctDigit
137. a RA HE ee we Ee A Sa Onder of Patter Matching sos ee ewe ee A OR A ee ee a Recognized Syntax of Curry 4 1 Notational Conventions cio 4 204 54 4404 eae bw eS be ews AD WSOC oosa nepale ee a Ge HOG A Re Am AL 2 we Go 421 TACO Made esce 2 ae Se a a REE ee aA 4 2 2 Identifiers and Keywords 0 000 eee inaa A COOS ws a A eB a ae 4 2 4 Numeric and Character Literals 0 0 0 0 0 a 000 4 AS Layon e eden cave bee ke Shae Ree Boe a eee we ee 4 4 Context Free Grammar 25 6 6 sw ee ba bk eee ee Optimization of Curry Programs CurryDoc A Documentation Generator for Curry Programs CurryBrowser A Tool for Analyzing and Browsing Curry Programs CurryTest A Tool for Testing Curry Programs CurryPP A Preprocessor for Curry Programs Ol Tntesroted Code as ek ek a be Ee he ee AR aS 9 1 1 Regular Expressions 2 0 54 sacs 5 eae eee ee eee a 91 2 Formal Speciicatiene lt o sp raca we EA Pe ee ek ae 9 1 3 HTML Codo c sg 2 28 e644 80444524445 245 ER Se eee RES 12 15 16 16 16 17 17 17 19 20 20 20 20 20 21 21 22 23 27 28 31 33 9 14 AML Expressing osos siena ee OS Oe Ba ge BE ws Ol Bequentlal Rules do fe e Oe ee ee die a 93 Default Rules 444545 454846504424 de ea a a a 10 runcurry Running Curry Programs 11 ERD2Curry A Tool to Generate Programs from ER Specifications 12 Spicey An ER based Web Framework 13 Ul Declarative Programming of User Interfaces 14 Preprocessing FlatCurry Files 15
138. a corresponding list of handles to input streams Thus if the i th handle has some data available the i th event handler is executed with the i th handle as a parameter This operation is useful to run a GUI that should react on inputs provided by other processes e g via sockets setConfig WidgetRef gt ConfItem gt GuiPort gt I0 Changes the current configuration of a widget deprecated operation only included for backward compatibility Warning does not work for Command options 116 exitGUI GuiPort gt I0 An event handler for terminating the GUI getValue WidgetRef GuiPort 10 String Gets the String value of a variable in a GUI setValue WidgetRef String gt GuiPort 10 Sets the String value of a variable in a GUI updateValue String String WidgetRef GuiPort gt 10 Updates the String value of a variable w r t to an update function appendValue WidgetRef String GuiPort I0 Appends a String value to the contents of a TextEdit widget and adjust the view to the end of the TextEdit widget appendStyledValue WidgetRef String Style gt GuiPort gt I0 Appends a String value with style tags to the contents of a TextEdit widget and adjust the view to the end of the TextEdit widget Different styles can be combined e g to get bold blue text on a red background If Bold Italic and Underline are combined currently all
139. a side effect and behaves as identity on the second argument spawnConstraint Bool gt a gt a Spawns a constraint and returns the second argument This function can be consid ered as defined by spawnConstraint c x c x However the evaluation of the constraint and the right hand side are performed concurrently i e a suspension of the constraint does not imply a blocking of the right hand side and the right hand side might be evaluated before the constraint is successfully solved Thus a computation might return a result even if some of the spawned constraints are suspended use the PAKCS option suspend to show such suspended goals isVar a Bool 173 Tests whether the first argument evaluates to a currently unbound variable use with care identicalVar a gt a Bool Tests whether both arguments evaluate to the identical currently unbound variable use with care For instance identicalVar id x fst x 1 evaluates to True whereas identicalVar x y and let x 1 in identicalVar x x evaluate to False isGround a Bool Tests whether the argument evaluates to a ground value use with care compareAnyTerm a gt a Ordering Comparison of any data terms possibly containing variables Data constructors are compared in the order of their definition in the datatype declarations and recursively in the arguments Variables are compared in some internal order showAnyTerm a gt String Transf
140. aint on FD variables Int gt Int gt Constraint Reifyable inequality constraint on FD variables lt Int gt Int gt Constraint Reifyable less than constraint on FD variables lt Int gt Int gt Constraint Reifyable less than or equal constraint on FD variables gt Int gt Int gt Constraint Reifyable greater than constraint on FD variables gt Int Int gt Constraint Reifyable greater than or equal constraint on FD variables neg Constraint Constraint The resulting constraint is satisfied if both argument constraints are satisfied Constraint Constraint Constraint The resulting constraint is satisfied if both argument constraints are satisfied Constraint Constraint Constraint The resulting constraint is satisfied if both argument constraints are satisfied gt Constraint Constraint Constraint The resulting constraint is satisfied if the first argument constraint do not hold or both argument constraints are satisfied lt gt Constraint Constraint Constraint The resulting constraint is satisfied if both argument constraint are either satisfied and do not hold solve Constraint Bool Solves a reified constraint 72 sum Int Int gt Int gt Bool gt Int Bool Relates the sum of FD variables with some integer of FD variable scalarProduct Int
141. al 10 fork 12 help 10 interface 11 load 10 modules 11 peval 12 programs 11 quit 10 reload 10 save 12 set 11 set path 8 show 11 source 11 type 10 usedimports 11 xml 10 12 gt 60 67 71 18 author 28 cons 28 param 28 return 28 version 28 72 72 72 gt 72 lt 72 lt gt 72 lt 72 gt 72 gt 72 72 148 amp amp amp 103 PAKCS 9 lt gt 92 142 lt gt 148 ay T9 lt gt 95 316 lt gt 149 lt gt 97 148 Lis TT lt 74 lt 77 lt 67 71 lt gt 60 lt 67 71 lt lt gt 149 lt gt 148 lt gt 149 lt gt 92 lt gt 89 148 gt 92 gt 92 gt 74 Sas gt 74 gt 77 gt 68 72 gt 68 71 gt gt 140 gt gt gt 142 gt 249 60 136 119 e UN aBool 235 abortTransaction 91 ABranchExpr 284 abs 120 AbstractCurry 54 abstractCurryFileName 246 aChar 234 acos 102 acosh 102 adapt 234 adaptWSpec 216 223 addAttr 207 addAttrs 207 addCanvas 118 addClass 207 addCookies 201 addCurrySubdir 87 addDays 172 addDB 80 addExtension 95 addFormParam 201 addHeadings 205 addHours 172 addListToFM 178 addListToFM_C 178 addMinutes 172 addMonths 172 addPageParam 202 addRegionStyle 117 address 204 addSeconds 172 addSound 201 addToFM 178 addToFM_C 178 a
142. al form and return the normal form and print the time needed for this evaluation on standard error Included for backward compatibility only use profileTime evalSpace a gt a Evaluates the argument to normal form and return the normal form and print the time and space needed for this evaluation on standard error During the evaluation the garbage collector is turned off Included for backward compatibility only use pro fileSpace 160 A 2 45 Library 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 Exported types data PlClause A Prolog clause is either a program clause consisting of a head and a body or a directive or a query without a head Exported constructors e PlClause String PlTerm PlGoal PlClause e PlDirective PlGoall gt PlClause e PlQuery PlGoal gt PlClause data PlGoal A Prolog goal is a literal a negated goal or a conditional Exported constructors e PlLit String gt PlTerm gt PlGoal e PlNeg PlGoal gt PlGoal e PlCond PlGoal1 P1Goal P1Goal PlGoal data PlTerm A Prolog term is a variable atom number or structure Exported constructors e PlVar String PlTerm e PlAtom String PlTerm e PliInt Int gt PlTerm e PlFloat Float PlTer
143. an equality Hence the transformation can be efficiently performed without any complex anal ysis full Perform a complete required values analysis of the program see 9 and use this informa tion to optimize programs In most cases this does not yield better results so that the fast mode is sufficient Hence to turn off this optimization one can either modify the flag bindingoptimization in the configuration file pakcsrc or dynamically pass this change to the invocation of PAKCS by Dbindingoptimization no 27 6 CurryDoc A Documentation Generator for Curry Programs CurryDoc is a tool in the PAKCS distribution that generates the documentation for a Curry program i e the main module and all its imported modules in HTML format The generated HTML pages contain information about all data types and functions exported by a module as well as links between the different entities Furthermore some information about the definitional status of functions like rigid flexible external complete or overlapping definitions are provided and combined with documentation comments provided by the programmer A documentation comment starts at the beginning of a line with also in literate pro grams All documentation comments immediately before a definition of a datatype or top level function are kept together The documentation comments for the complete module occur before the first module or import lin
144. an external function and adding an implementation of this function in the run time system Therefore the following items must be added in the PAKCS compiler system 1 If the Curry module Mod contains external functions there must be a file named Mod prim_c2p containing the specification of these external functions The contents of this file is in XML format and has the following general structure lt primitives gt specification of external function f specification of external function fn lt primitives gt The specification of an external function f with arity n has the form lt primitive name f arity n gt lt library gt lib lt library gt lt entry gt pred lt entry gt lt primitive gt where lib is the Prolog library stored in the directory of the Curry module or in the global directory pakcshome curry2prolog lib_src containing the code implementing this function and pred is a predicate name in this library implementing this function Note that the function f must be declared in module Mod either as an external function or defined in http www informatik uni kiel de pakcs primitives dtd contains a DTD describing the exact structure of these files 312 Curry by equations In the latter case the Curry definition is not translated but calls to this function are redirected to the Prolog code specified above Furthermore the list of specifications can also contain entries of the form lt ignore name
145. an incomplete depth first strategy The evaluation suspends as long as the predicate expression contains unbound variables Note that this operation is not purely declarative since the ordering of the computed values depends on the ordering of the program rules someSolution a Bool gt a Returns some values satisfying a predicate i e some argument such that the predicate applied to the argument can be evaluated to True currently via an incomplete depth first strategy If there is no value satisfying the predicate the computation fails Note that this operation is not purely declarative since the ordering of the computed values depends on the ordering of the program rules Thus this operation should be used only if the predicate has a single solution try a gt Bool gt a gt Bool Basic search control operator inject a gt Bool gt a Bool gt a gt Bool 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 solveAll a gt Bool gt la gt Bool Computes all solutions via a a depth first strategy once a Bool gt a gt Bool Gets the first solution via a depth first strategy best a gt Bool gt a gt a gt Bool gt la gt Bool 99 Gets the best solution via a depth first strategy according to a specifie
146. and an external port Note that the implementation of choiceSPEP works only with Sicstus Prolog 3 8 5 or higher due to a bug in previous versions of Sicstus Prolog newObject a gt b Bool gt a gt Port b gt Bool Creates a new object of type State gt msg gt Bool with an initial state and a port to which messages for this object can be sent newNamedObject a gt b Bool gt a gt String gt I0 Creates a new object of type State gt msg gt Bool with a symbolic port name to which messages for this object can be sent runNamedServer la 10 b gt String gt IO b Runs a new server of type msg gt 10 a on a named port to which messages can be sent A 2 43 Library 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 ANSlIescapecode Exported types data Doc The abstract data type Doc represents pretty documents Exported constructors Exported functions pPrint Doc String Standard printing with a column length of 80 empty Doc The empty document 145 isEmpty Doc Bool Is the document empty text String Doc The
147. and looks in the system library directory of PAKCS for a module with this name e g the command interface FlatCurry shows the interface of the system module FlatCurry for meta programming see Appendix A 1 4 usedimports Show all calls to imported functions in the currently loaded module This might be useful to see which import declarations are really necessary modules Show the list of all currently loaded modules programs Show the list of all Curry programs that are available in the load path set option Set or turn on off a specific option of the PAKCS environment see 2 3 for a de un scription of all options Options are turned on by the prefix and off by the prefix Options that can only be set e g printdepth must not contain a prefix set Show a help text on the possible options together with the current values of all options show Show the source text of the currently loaded Curry program If the variable showcommand is set in the configuration file pakcsrc see Section 2 6 its value is used as a command to show the source text otherwise the environment variable PAGER or the standard command cat is used If the source text is not available since the program has been directly compiled from a FlatCurry or XML file the loaded program is decompiled and the decompiled Curry program text is shown show m Sh
148. anges are read and made visible to the currently running program getDynamicSolutions a gt Dynamic 10 a Returns all answers to an abstraction on a dynamic expression If other processes made changes to persistent predicates these changes are read and made visible to the currently running program getDynamicSolution a Dynamic IO Maybe a Returns an answer to an abstraction on a dynamic expression Returns Nothing if no answer exists If other processes made changes to persistent predicates these changes are read and made visible to the currently running program isKnown Dynamic gt 10 Bool Returns True if there exists the argument facts without free variables and False otherwise transaction IO a gt I0 Maybe a Perform an action usually containing updates of various dynamic predicates as a single transaction This is the preferred way to execute any changes to persistent dynamic predicates if there might be more than one process that may modify the definition of such predicates in parallel 90 Before the transaction is executed the access to all persistent predicates is locked i e no other process can perform a transaction in parallel After the successful transac tion the access is unlocked so that the updates performed in this transaction become persistent and visible to other processes Otherwise i e in case of a failure or abort of the transaction the changes of the
149. aph in a markdown document e HRule MarkdownElem HRule a hoirzontal rule in a markdown document e Header Int String MarkdownElem Header 1 s a level 1 header with title s in a markdown document Exported functions fromMarkdownText String MarkdownElem Parse markdown document from its textual representation removeEscapes String String Remove the backlash of escaped markdown characters in a string markdownEscapeChars String Escape characters supported by markdown markdownText2HTML String HtmlExpl Translate a markdown text into a partial HTML document markdownText2CompleteHTML String String String Translate a markdown text into a complete HTML text that can be viewed as a stan dalone document by a browser The first argument is the title of the document markdownText2LaTeX String String Translate a markdown text into a partial LaTeX document All characters with a special meaning in LaTeX like dollar or ampersand signs are quoted markdownText2LaTeXWithFormat String String String String Translate a markdown text into a partial LaTeX document where the first argument is a function to translate the basic text occurring in markdown elements to a LaTeX string For instance one can use a translation operation that supports passing mathematical formulas in LaTeX style instead of quoting all special characters markdownText2CompleteLaT
150. ariables Object variables occurring in expressions are represented by Var i where i is a variable index data CVisibility Data type to specify the visibility of various entities Exported constructors e Public CVisibility e Private CVisibility data CurryProg Data type for representing a Curry module in the intermediate form A value of this data type has the form CProg modname imports typedecls functions opdecls where modname name of this module imports list of modules names that are im ported typedecls Type declarations functions Function declarations opdecls Opera tor precedence declarations Exported constructors e CurryProg String String CTypeDec1 CFuncDec1 COpDec1 gt CurryProg data CTypeDecl Data type for representing definitions of algebraic data types and type synonyms A data type definition of the form data t x1 xn c t1 tkc is represented by the Curry term CType t v il in CCons c kc v t1 tkc where each ij is the index of the type variable xj Note the type variable indices are unique inside each type declaration and are usually numbered from 0 Thus a data type declaration consists of the name of the data type a list of type parameters and a list of constructor declarations Exported constructors 240 e CType String String CVisibility Int String CConsDecl gt CTypeDecl e CTypeSyn Strin
151. arity 5 The first argument is the ternary construc tor The further arguments are the WUI specifications for the argument types w6Tuple WuiSpec a WuiSpec b WuiSpec c WuiSpec d WuiSpec e gt WuiSpec f gt WuiSpec a b c d e f WUI combinator for tuples of arity 6 wCons6 la gt b gt c gt d gt e gt f g gt WuiSpec a gt WuiSpec b WuiSpec c gt WuiSpec d WuiSpec e gt WuiSpec f WuiSpec g WUI combinator for constructors of arity 6 The first argument is the ternary construc tor The further arguments are the WUI specifications for the argument types w Tuple WuiSpec a gt WuiSpec b gt WuiSpec c WuiSpec d gt WuiSpec e gt WuiSpec f gt WuiSpec g gt WuiSpec a b c d e f g WUI combinator for tuples of arity 7 218 wCons7 a gt b gt c gt d gt e gt f g h gt WuiSpec a gt WuiSpec b gt WuiSpec c WuiSpec d WuiSpec e WuiSpec f WuiSpec g WuiSpec h WUI combinator for constructors of arity 7 The first argument is the ternary construc tor The further arguments are the WUI specifications for the argument types w8Tuple WuiSpec a WuiSpec b WuiSpec c WuiSpec d WuiSpec e gt WuiSpec f WuiSpec g WuiSpec h WuiSpec a b c d e f g h WUI combinator for tuples of arity 8 wCons8 a gt b gt c gt def g gt h gt i gt WuiSpec a gt WuiSp
152. ase expression n gt 0 do expression n gt 0 function application variable anonymous free variable qualified function general constructor parenthesized expression tuple n gt 1 finite list n gt 0 arithmetic sequence left section right section list comprehension n gt 1 labeled construction n gt 0 function qualified function Variable DataConstr QDataConstr QFunOp ConsOp QOp QConsOp GConSym VariableID InficOpID DataConstrID InfirOpID QDataConstrID QConsOp QInficOpID GFunctionID InficOpID DataConstrID QFunOp QConsOp GConSym QDataConstrID QInfizOpID 26 variable constructor qualified constructor qualified function operator constructor operator qualified operator qualified constructor operator general constructor symbol 5 Optimization of Curry Programs After the invocation of the Curry front end which parses a Curry program and translates it into the intermediate FlatCurry representation PAKCS applies a transformation to optimize Boolean equalities occurring in the Curry program The ideas and details of this optimization are described in 9 Therefore we sketch only some basic ideas and options to influence this optimization Consider the following definition of the operation last to extract the last element in list last xs xs _ x x where x free
153. ase predicates to use the function persistentSQLite instead of dynamic or persistent This module redefines the types Dynamic Query and Transaction and although both implementations can be used in the same program by importing modules qualified they cannot be mixed Compared with the interface of KeyDatabase this module lacks definitions for index sortByIndex groupByIndex and runTNA and adds the functions deleteDBEntries and closeDBHandles Exported types type Key Int type KeyPred a Int gt a Dynamic data Query Queries can read but not write to the database Exported constructors data Transaction Transactions can modify the database and are executed atomically Exported constructors data Dynamic Result type of database predicates Exported constructors data ColVal Abstract type for value restrictions Exported constructors data TError The type of errors that might occur during a transaction Exported constructors e TError TErrorKind String TError data TErrorKind The various kinds of transaction errors 130 Exported constructors e KeyNotExistsError TErrorKind e NoRelationshipError TErrorKind e DuplicateKeyError TErrorKind e KeyRequiredError TErrorKind e UniqueError TErrorKind e MinError TErrorKind e MaxError TErrorKind e UserDefinedError TErrorKind e ExecutionError TErrorKind Exported functions runQ Query a gt IO a Runs a database query
154. assertEqual s el e2 asserts with name s that el and e2 must be equal w r t assertValues String gt a a Assertion a assertValues s e vs asserts with name s that vs is the multiset of all values of e All values of e are compared with the elements in vs w r t assertSolutions String gt a Bool gt a Assertion a assertSolutions s c vs asserts with name s that constraint abstraction c has the multiset of solutions vs The solutions of c are compared with the elements in vs w r t assertIO String IO a gt a Assertion a assertlI0 s a r asserts with name s that I O action a yields the result value r assertEquall0 String 10 a gt IO a gt Assertion a assertEqualIO s al a2 asserts with name s that I O actions al and a2 yield equal w r t results 57 seqStrActions IO String Bool IO String Bool gt IO String Bool Combines two actions and combines their results Used by the currytest tool checkAssertion String String Bool gt I0 String Bool Assertion a gt IO String Bool Executes and checks an assertion and process the result by an I O action Used by the currytest tool writeAssertResult String Bool IO Int Prints the results of assertion checking If failures occurred the return code is positive Used by the currytest tool showTestMod Int String gt I0 Sends message to G
155. ata with the representation of a given value xmlRead XmlConv a Elem b gt XmlExp gt b Takes an XML converter and an XML expression and returns a corresponding Curry value xmlShow XmlConv a Elem b gt b XmlExp Takes an XML converter and a value and returns a corresponding XML expression int XmlConv NotRepeatable NoElem Int Creates an XML converter for integer values Integer values must not be used in repe titions and do not represent XML elements float XmlConv NotRepeatable NoElem Float Creates an XML converter for float values Float values must not be used in repetitions and do not represent XML elements char XmlConv NotRepeatable NoElem Char Creates an XML converter for character values Character values must not be used in repetitions and do not represent XML elements string XmlConv NotRepeatable NoElem String Creates an XML converter for string values String values must not be used in repeti tions and do not represent XML elements 233 XmlConv a b c gt XmlConv a b c gt XmlConv ab c Parallel composition of XML converters element String XmlConv a b c XmlConv Repeatable Elem c Takes an arbitrary XML converter and returns a converter representing an XML element that contains the corresponding data XML elements may be used in repetitions empty a XmlConv NotRepeatable NoElem a Takes a value and returns an XML converter for this value which is not rep
156. b prog The FlatCurry representation of a Curry program is usually generated by the front end after parsing type checking and eliminating local declarations If the Curry module M is stored in the directory dir the corresponding FlatCurry pro gram is stored in the directory dir curry This is also the case for hierarchical module names if the module D1 D2 M is stored in the directory dir i e the module is actu ally stored in dir D1 D2 M curry then the corresponding FlatCurry program is stored in dir curry D1 D2 M fcy prog fint This file contains the interface of the program in the so called FlatCurry represen tation i e it is similar to prog fcy but contains only exported entities and the bodies of all functions omitted i e external This representation is useful for providing a fast access to module interfaces This file is implicitly generated when a program is compiled with PAKCS and stored in the same directory as prog fcy prog pl This file contains a Prolog program as the result of translating the Curry program with PAKCS If the Curry module M is stored in the directory dir the corresponding Prolog program is stored in the directory dir curry pakcs This is also the case for hierarchical module names if the module D1 D2 M is stored in the directory dir i e the module is actu ally stored in dir D1 D2 M curry then the corresponding Prolog program is stored in dir curry pakc
157. brary Ports for distributed programming with ports Exported functions cpnsStart 10 O Starts the Curry Port Name Server CPNS running on the local machine The CPNS is responsible to resolve symbolic names for ports into physical socket numbers so that a port can be reached under its symbolic name from any machine in the world cpnsShow I0 Shows all registered ports at the local CPNS demon in its logfile 77 cpnsStop I0 Terminates the local CPNS demon registerPort String gt Int gt Int gt I0 Registers a symbolic port at the local host getPortInfo String gt String gt I0 Int Int Gets the information about a symbolic port at some host unregisterPort String 10 Unregisters a symbolic port at the local host cpnsAlive Int String 10 Bool Tests whether the CPNS demon at a host is alive main 10 O Main function for CPNS demon Check arguments and execute command A 2 13 Library 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 Exported functions writeCSVFile String String gt 10 O Writes a list of records where each record is a list of strings into a file in CSV format showCSV String String Shows a list of records where each record is a list of strings as a string in CSV format readCSVFile String
158. but one of these are ignored This is an experimental function and might be changed in the future addRegionStyle WidgetRef gt Int Int gt Int Int Style gt GuiPort gt 10 Adds a style value in a region of a TextEdit widget The region is specified a start and end position similarly to getCursorPosition Different styles can be combined e g to get bold blue text on a red background If Bold Italic and Underline are combined currently all but one of these are ignored This is an experimental function and might be changed in the future removeRegionStyle WidgetRef Int Int gt Int Int Style GuiPort gt I0 O Removes a style value in a region of a TextEdit widget The region is specified a start and end position similarly to getCursorPosition This is an experimental function and might be changed in the future getCursorPosition WidgetRef GuiPort I0 Int Int Get the position line column of the insertion cursor in a TextEdit widget Lines are numbered from 1 and columns are numbered from 0 seeText WidgetRef gt Int Int GuiPort gt 10 Adjust the view of a TextEdit widget so that the specified line column character is visible Lines are numbered from 1 and columns are numbered from 0 117 focusInput WidgetRef gt GuiPort I0 Sets the input focus of this GUI to the widget referred by the first argument This is useful for automatically se
159. chine running this process getPID 10 Int Returns the process identifier of the current Curry process getProgName 10 String Returns the name of the current program i e the name of the main module currently executed system String IO Int Executes a shell command and return with the exit code of the command An exit status of zero means successful execution exitWith Int gt IO a Terminates the execution of the current Curry program and returns the exit code given by the argument An exit code of zero means successful execution sleep Int gt 10 The evaluation of the action sleep n puts the Curry process asleep for n seconds isPosix Bool Is the underlying operating system a POSIX system unix MacOS isWindows Bool Is the underlying operating system a Windows system 170 A 2 53 Library Time Library for handling date and time information Exported types data ClockTime ClockTime represents a clock time in some internal representation Exported constructors data CalendarTime A calendar time is presented in the following form CalendarTime year month day hour minute second timezone where timezone is an integer representing the timezone as a difference to UTC time in seconds Exported constructors e CalendarTime Int gt Int gt Int gt Int gt Int gt Int Int CalendarTime Exported functions ctYear CalendarTime Int The year of a calendar ti
160. cl gt FuncDecl update type of function updFuncRule Rule Rule gt FuncDecl gt FuncDecl update rule of function isExternal FuncDecl Bool is function externally defined allVarsInFunc FuncDecl gt Int get variable names in a function declaration funcArgs FuncDecl gt Int get arguments of function if not externally defined funcBody FuncDecl Expr get body of function if not externally defined funcRHS FuncDecl Expr rnmAllVarsInFunc Int Int gt FuncDecl gt FuncDecl rename all variables in function updQNamesInFunc String String String String FuncDecl gt FuncDecl update all qualified names in function updFuncArgs Int Int FuncDecl gt FuncDecl update arguments of function if not externally defined updFuncBody Expr Expr FuncDecl gt FuncDecl update body of function if not externally defined trRule Int gt Expr gt a gt String gt a gt Rule gt a transform rule ruleArgs Rule gt Int 269 get rules arguments if it s not external ruleBody Rule Expr get rules body if it s not external ruleExtDecl Rule gt String get rules external declaration isRuleExternal Rule Bool is rule external updRule Int gt Int gt Expr gt Expr gt String String Rule gt Rule update rule updRuleArgs Int gt Int Rule Rule update rules argume
161. claration freeVars Expr Int get variable indices from declaration of free variables freeExpr Expr Expr get expression from declaration of free variables orExps Expr Expr get expressions from or expression caseType Expr CaseType 271 get case type of case expression caseExpr Expr Expr get scrutinee of case expression caseBranches Expr BranchExpr get branch expressions from case expression isVar Expr Bool is expression a variable isLit Expr Bool is expression a literal expression isComb Expr Bool is expression combined isLet Expr Bool is expression a let expression isFree Expr Bool is expression a declaration of free variables isOr Expr Bool is expression an or expression isCase Expr Bool is expression a case expression trExpr Int gt a gt Literal gt a gt CombType gt String String a gt a gt Int aJ gt a gt a gt Intl gt a gt a gt a lt a gt a gt CaseType gt a gt b a gt Pattern gt a gt b gt a gt TypeExpr gt a gt Expr gt a transform expression updVars Int Expr Expr Expr update all variables in given expression updLiterals Literal gt Expr Expr Expr update all literals in given expression updCombs CombType gt String String Expr gt Expr Expr Expr update all c
162. claration typeSyn TypeDecl TypeExpr get synonym of type declaration isTypeSyn TypeDecl Bool is type declaration a type synonym updType String String gt String String Visibility gt Visibility gt Int gt Int ConsDec1 gt ConsDecl TypeExpr TypeExpr gt TypeDecl TypeDecl 289 update type declaration updTypeName String String gt String String TypeDecl TypeDecl update name of type declaration updTypeVisibility Visibility gt Visibility TypeDecl gt TypeDecl update visibility of type declaration updTypeParams Int Int gt TypeDecl gt TypeDecl update type parameters of type declaration updTypeConsDecls ConsDecl gt ConsDecl TypeDecl TypeDecl update constructor declarations of type declaration updTypeSynonym TypeExpr TypeExpr gt TypeDecl gt TypeDecl update synonym of type declaration updQNamesInType String String String String TypeDecl gt TypeDecl update all qualified names in type declaration trCons String String gt Int gt Visibility gt TypeExpr gt a gt ConsDecl gt a transform constructor declaration consName ConsDecl String String get name of constructor declaration consArity ConsDecl Int get arity of constructor declaration consVisibility ConsDecl Visibility get visibility of construc
163. cmd prog should perform a transformation on the FlatCurry file prog fcy i e it re places the FlatCurry file by a new one 2 Setting the environment variable FCYPP For instance setting FCYPP by export FCYPP fpopt will apply the functional pattern optimization if programs are compiled and loaded in the PAKCS programming environment 3 Putting options into the source code If the source code contains a line with a comment of the form the comment must start at the beginning of the line PAKCS_OPTION_FCYPP lt options gt then the transformations specified by lt options gt are applied after translating the source code into FlatCurry code For instance the functional pattern optimization can be set by the comment PAKCS_OPTION_FCYPP fpopt in the source code Note that this comment must be in a single line of the source program If there are multiple lines containing such comments only the first one will be considered 45 Multiple options Note that an arbitrary number of transformations can be specified by the methods described above If several specifications for preprocessing FlatCurry files are used they are executed in the following order 1 all transformations specified by the environemnt variable FCYPP from left to right 2 all transformations specified as command line options of fcypp from left to right 3 all transformations specified by a comment line in the source code from
164. cted module to analyze all functions of the currently selected module at once This is useful to spot some functions of a module that could be problematic in some application contexts like functions that are impure i e the result depends on the evaluation time or partially defined i e not evaluable on all ground terms If such an analysis is selected the names of all functions are shown in the lower list box of the left column the function list with prefixes indicating the properties of the individual functions The function list box can be also filled with functions via the menu Select functions For instance all functions or only the exported functions defined in the currently selected module can be shown there or all functions from different modules that are directly or indirectly called from a currently selected function This list box is central to focus on a function in the source code of some module or to analyze some function i e showing their properties In order to focus on a function it is sufficient to check the focus on code button To analyze an individually selected function one can select an analysis from the list of available program analyses through the menu Select analysis In this case the analysis results are either shown in the text box below the main text area or visualized by separate tools e g by a graph drawing tool for visualizing call graphs Some 3 Although CurryBrowser is
165. d environments like a computation service in a web page where PAKCS could be invoked by pakcs set safe parser opts Define additional options passed to the PAKCS front end i e the parser program pakcshome bin cymake For instance setting the option set parser F pgmF transcurry has the effect that each Curry module to be compiled is transformed by the preprocessor command transcurry into a new Curry program which is actually compiled args arguments Define run time arguments for the evaluation of the main expression For in stance setting the option set args first second has the effect that the I O operation getArgs see library System Section A 2 52 returns the value first second PAKCS can also execute programs in the debug mode The debug mode is switched on by setting the debug option with the command set debug In order to switch back to normal evaluation of the program one has to execute the command set debug In the debug mode PAKCS offers the following additional options single Turn on off single mode for debugging If the single mode is on the evaluation of an expression is stopped after each step and the user is asked how to proceed see the options there trace Turn on off trace mode for debugging If the trace mode is on all intermediate expres sions occurring during the evaluation of an expressions are shown spy f Set a
166. d in the Graph ufold a Int 1 Int b a Int 1 gt c gt c gt c gt Graph ba gt c Fold a function over the graph gmap a Int Int b a Int gt c Int Int d c Int gt Graph ba gt Graph dc Map a function over the graph 186 nmap a b gt Graph a c Graph b c Map a function over the Node labels in a graph emap a gt b gt Graph c a gt Graph c b Map a function over the Edge labels in a graph labUEdges a b gt a b 0 add label to list of edges node node labUNodes a gt a 0 add label to list of nodes showGraph Graph a b gt String Represent Graph as String A 3 5 Library Random Library for pseudo random number generation in Curry This library provides operations for generating pseudo random number sequences For any given seed the sequences generated by the operations in this module should be identical to the sequences generated by the java util Random package The algorithm is a linear congruential pseudo random number generator described in Donald E Knuth The Art of Computer Programming Volume 2 Seminumerical Algorithms section 3 2 1 Exported functions nextInt Int gt Int Returns a sequence of pseudorandom uniformly distributed 32 bits integer values All 992 possible integer values are produced with approximately equal probability nextIntRange Int gt Int gt Int Returns a pseudorandom un
167. d operator that can always take a decision which of two solutions is better In general the comparison operation should be rigid in its arguments findall a gt Bool gt al Gets all solutions via a depth first strategy and unpack the values from the lambda abstractions Similar to Prolog s findall findfirst a Bool gt a Gets the first solution via a depth first strategy and unpack the values from the search goals browse a gt Bool gt 10 Shows the solution of a solved constraint browseList a gt Bool gt 10 Unpacks solutions from a list of lambda abstractions and write them to the screen unpack a Bool gt a Unpacks a solution s value from a solved search goal rewriteAll a gt la Gets all values computable by term rewriting In contrast to findall this operation does not wait until all outside variables are bound to values but it returns all values computable by term rewriting and ignores all computations that requires bindings for outside variables rewriteSome a Maybe a Similarly to rewriteA11 but returns only some value computable by term rewriting Returns Nothing if there is no such value A 2 24 Library Float A collection of operations on floating point numbers Exported functions pi Float The number pi Float gt Float gt Float Addition on floats Float gt Float gt Float 100 Subtraction on floats
168. database query that returns True if there exists the argument facts without free variables and False otherwise transform a gt b gt Query a gt Query b Transforms a database query from one result type to another according to a given mapping runQ Query a gt IO a Executes a database query on the current state of dynamic predicates If other processes made changes to persistent predicates these changes are read and made visible to the currently running program showTError TError String Transforms a transaction error into a string addDB Dynamic gt Transaction 80 Adds new facts without free variables about dynamic predicates Conditional dy namics are added only if the condition holds deleteDB Dynamic Transaction Deletes facts without free variables about dynamic predicates Conditional dynamics are deleted only if the condition holds getDB Query a Transaction a Returns the result of a database query in a transaction returnT a Transaction a The empty transaction that directly returns its argument doneT Transaction The empty transaction that returns nothing errorT TError Transaction a Abort a transaction with a specific transaction error failT String Transaction a Abort a transaction with a general error message gt gt Transaction a gt a Transaction b gt Transaction b Sequential composition of transactions gt
169. ddTrailingPathSeparator 97 addYears 173 AExpr 283 AFCSubst 300 aFloat 234 AFuncDecl 283 alnt 234 align 147 all_different 73 allC 68 77 al1CHR 61 63 allDBInfos 128 133 allDBKeyInfos 128 133 allDBKeys 128 133 135 allDifferent 68 73 allfails 13 allSolutions 99 allValues 98 allVars 273 298 allVarsInFunc 269 294 allVarsInProg 264 289 allVarsInRule 270 295 alwaysRequired 282 anchor 204 317 andC 68 77 andCHR 61 63 angles 153 annExpr 300 annPattern 300 annRule 300 answerEncText 201 answerText 201 anyC 77 anyPrim 62 APattern 284 appendStyledValue 117 appendValue 117 applyAt 176 applyE 251 applyF 250 applyJust 251 applyMaybe 251 applySubst 195 applyV 251 AProg 283 ArgDescr 104 ArgOrder 104 args 15 argTypes 248 267 292 Arity 239 283 Array 175 ARule 283 as pattern 18 asin 102 asinh 102 assert 83 90 assertEqual 57 assertEquall0 57 assertI0 57 83 Assertion 57 assertSolutions 57 assertTrue 57 assertValues 57 aString 234 at 155 atan 102 atanh 102 attr 234 backslash 155 bar 155 baseName 94 baseType 249 best 99 bgBlack 158 bgBlue 158 bgCyan 158 bgGreen 158 bgMagenta 158 bgRed 158 bgWhite 158 bgYellow 158 binomial 120 bitAnd 120 bitNot 120 bitOr 120 bitTrunc 120 bitXor 121 black 157 blink 204 blinkRapid 157 blinkSlow 157 block 205 blockstyle 205 blue 157 bold 156 203 Bool
170. dget to select a value from a given list of integers provided as the argument The current value should be contained in the value list and is preselected wSelectBool String String WuiSpec Bool A widget to select a Boolean value via a selection box The arguments are the strings that are shown for the values True and False in the selection box respectively wCheckBool HtmlExp gt WuiSpec Bool A widget to select a Boolean value via a check box The first argument are HTML expressions that are shown after the check box The result is True if the box is checked wMultiCheckSelect a gt HtmlExp a gt WuiSpec a A widget to select a list of values from a given list of values via check boxes The current values should be contained in the value list and are preselected The first argument is a mapping from values into HTML expressions that are shown for each item after the check box wRadioSelect a HtmlExp a gt WuiSpec a A widget to select a value from a given list of values via a radio button The current value should be contained in the value list and is preselected The first argument is a mapping from values into HTML expressions that are shown for each item after the radio button wRadioBool HtmlExp gt HtmlExp WuiSpec Bool A widget to select a Boolean value via a radio button The arguments are the lists of HTML expressions that are shown after the True and False
171. different types mapFamily a gt a a gt a gt aa SG aa Applies the given function to each member of the family of a value Proceeds bottom up mapChildFamilies a gt b b gt a gt b gt b b gt b gt b gt b gt a gt a Applies the given function to each member of the families of the children of a value The value and its children can have different types Proceeds bottom up evalFamily a gt a a gt a gt a gt Maybe a gt a gt a 9http www ps informatik uni kiel de sebf projects traversal html 192 Applies the given function to each member of the family of a value as long as possible On each member of the family of the result the given function will yield Nothing Proceeds bottom up evalChildFamilies a gt b b gt a gt b gt b b gt b gt b gt Maybe b ara Applies the given function to each member of the families of the children of a value as long as possible Similar to evalFamily fold a gt a a a gt a gt b gt b gt a gt b Implements a traversal similar to a fold with possible default cases foldChildren a gt b b gt ad gt b gt C b b gt b gt a gt c gt d gt b gt cl lt c gt a gt d Fold the children and combine the results replaceChildrenl0 a gt b b gt a gt a gt 10 b ID a IO version of rep
172. dinates where the user clicked within the image runFormServerWithKey String String IO HtmlForm gt 10 The server implementing an HTML form possibly containing input fields It receives a message containing the environment of the client s web browser translates the HTML form w r t this environment into a string representation of the complete HTML doc ument and sends the string representation back to the client s browser by binding the corresponding message argument runFormServerWithKeyAndFormParams String String FormParam gt I0 HtmlForm gt I0 The server implementing an HTML form possibly containing input fields It receives a message containing the environment of the client s web browser translates the HTML form w r t this environment into a string representation of the complete HTML doc ument and sends the string representation back to the client s browser by binding the corresponding message argument showLatexExps HtmlExp gt String Transforms HTML expressions into LaTeX string representation 208 showLatexExp HtmlExp String Transforms an HTML expression into LaTeX string representation htmlSpecialChars2tex String String Convert special HTML characters into their LaTeX representation if necessary showLatexDoc HtmlExp gt String Transforms HTML expressions into a string representation of a complete LaTeX docu ment showLatexDocWithPackages
173. ding set function set1 a gt b gt a gt Values b Combinator to transform a unary function into a corresponding set function set2 la gt b gt lt c gt a gt b gt Values c Combinator to transform a binary function into a corresponding set function set3 la b gt c gt d a b c Values d Combinator to transform a function of arity 3 into a corresponding set function set4 a gt b gt c gt d e a b c d Values e Combinator to transform a function of arity 4 into a corresponding set function set5 a gt b gt c gt d gt e gt f gt a gt b gt c gt d e Values f Combinator to transform a function of arity 5 into a corresponding set function set6 a gt b gt c gt d gt e gt f gt g gt a gt b gt c gt d e f Values 8 Combinator to transform a function of arity 6 into a corresponding set function set7 la lt b gt c gt d gt e gt gt g8g gt h gt a gt b gt c gt d gt e gt gt g8 gt Values h Combinator to transform a function of arity 7 into a corresponding set function 166 isEmpty Values a Bool Is a multiset of values empty notEmpty Values a Bool Is a multiset of values not empty valueOf a gt Values a Bool Is some value an element of a multiset of values choose Values a gt a Values a Chooses non deterministically some value in a mul
174. dle Creates a new connection to an existing Unix socket with a symbolic name If the symbolic name is not registered an error is reported A 2 41 Library Parser Library with functional logic parser combinators Adapted from Rafael Caballero and Francisco J Lopez Fraguas A Functional Logic Perspective of Parsing In Proc FLOPS 99 Springer LNCS 1722 pp 85 99 1999 Exported types type Parser a a gt a type ParserRep a b a gt b gt b Exported functions lt I gt Glal gt a gt a gt a gt a gt a Combines two parsers without representation in an alternative manner lt Il gt a gt b gt b gt a gt b b 5 a gt b gt b Combines two parsers with representation in an alternative manner lt gt a gt a gt a gt a gt a gt a Combines two parsers with or without representation in a sequential manner gt gt gt a gt a gt b gt b gt a gt a Attaches a representation to a parser without representation empty a a The empty parser which recognizes the empty word terminal a gt a gt a A parser recognizing a particular terminal symbol 142 satisfy a gt Bool gt a gt a gt la A parser with representation recognizing a terminal satisfying a given predicate star a gt b gt b gt a gt b gt b A star co
175. e words combine Doc Doc Doc gt Doc The document combine c d1 d2 combines document di and d2 with document c in between using lt gt with identity empty Thus the following equations hold combine c dl empty d1 combine c empty d2 d2 combine c dl d2 dl lt gt c lt gt d2 if neither di nor d2 are empty lt gt Doc gt Doc gt Doc The document x lt gt y concatenates document x and document y It is an associative operation having empty as a left and right unit lt gt Doc Doc gt Doc The document x lt gt y concatenates document x and y with a space in between with identity empty Doc Doc Doc The document x y concatenates document x and y with a line in between with identity empty lt gt Doc Doc Doc The document x lt gt y concatenates document x and y with a blank line in between with identity empty lt gt Doc Doc gt Doc The document x lt gt y concatenates document x and y with a softline in between with identity empty This effectively puts x and y either next to each other with a space in between or underneath each other 148 lt gt Doc gt Doc gt Doc The document x lt gt y concatenates document x and y with a linebreak in be tween with identity empty lt gt Doc gt Doc gt Doc The document x lt gt y concatenates document x and y wit
176. e also Section 1 3 is set to path in this invocation of PAKCS ae The path is a list of directories separated by The prefix is replaced by the home directory as in the following example set path aux tests Relative directory names are replaced by absolute ones so that the path is independent of later changes of the current working directory printdepth n Set the depth for printing terms to the value n initially 0 In this case subterms with a depth greater than n are abbreviated by dots when they are printed as a result of a computation or during debugging A value of 0 means infinite depth so that the complete terms are printed vn Set the verbosity level to n The following values are allowed for n n 0 Do not show any messages except for errors n 1 Show only messages of the front end like loading of modules n 2 Show also messages of the back end like loading intermediate files or generating Prolog target files n 3 Show also messages related to loading Prolog files and libraries into the run time systems and other intermediate messages and results 14 safe Turn on the safe execution mode In the safe execution mode the initial goal is not allowed to be of type IO and the program should not import the module Unsafe Furthermore the allowed commands are eval load quit and reload This mode is useful to use PAKCS in uncontrolle
177. e data hWaitForInputOrMsg Handle gt a IO Either Handle a 122 Waits until input is available on a given handles or a message in the message stream Usually the message stream comes from an external port Thus this operation im plements a committed choice over receiving input from an IO handle or an external port Note that the implementation of this operation works only with Sicstus Prolog 3 8 5 or higher due to a bug in previous versions of Sicstus Prolog hWaitForInputsOrMsg Handle gt a gt I0 Either Int a Waits until input is available on some of the given handles or a message in the message stream Usually the message stream comes from an external port Thus this operation implements a committed choice over receiving input from IO handles or an external port Note that the implementation of this operation works only with Sicstus Prolog 3 8 5 or higher due to a bug in previous versions of Sicstus Prolog hReady Handle 10 Bool Checks whether an input is available on a given handle hGetChar Handle 10 Char Reads a character from an input handle and returns it Throws an error if the end of file has been reached hGetLine Handle 10 String Reads a line from an input handle and returns it Throws an error if the end of file has been reached while reading the first character If the end of file is reached later in the line it ist treated as a line terminator and the partial
178. e g September 23 2006 toTimeString CalendarTime String Transforms a calendar time into a string containing the time addSeconds Int ClockTime ClockTime Adds seconds to a given time addMinutes Int ClockTime ClockTime Adds minutes to a given time addHours Int ClockTime ClockTime Adds hours to a given time addDays Int ClockTime ClockTime Adds days to a given time addMonths Int ClockTime ClockTime 172 Adds months to a given time addYears Int ClockTime ClockTime Adds years to a given time daysOfMonth Int gt Int gt Int Gets the days of a month in a year validDate Int gt Int gt Int Bool Is a date consisting of year month day valid compareDate CalendarTime gt CalendarTime Ordering Compares two dates don t use it just for backward compatibility compareCalendarTime CalendarTime CalendarTime Ordering Compares two calendar times compareClockTime ClockTime ClockTime Ordering Compares two clock times A 2 54 Library 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 Exported functions unsafePerforml0 IO a gt a Performs and hides an I O action in a computation use with care trace String gt a gt a Prints the first argument as
179. e given key is not present getDBInfos Int gt a gt Dynamic gt Int Query Maybe a Queries the information stored under the given keys Yields Nothing if a given key is not present deleteDBEntry Int gt a Dynamic Int gt Transaction Deletes the information stored under the given key If the given key does not exist this transaction is silently ignored and no error is raised deleteDBEntries Int gt a Dynamic Int gt Transaction Deletes the information stored under the given keys No error is raised if some of the keys do not exist updateDBEntry Int gt a Dynamic Int gt a Transaction Updates the information stored under the given key The transaction is aborted with a KeyNotExistsError if the given key is not present in the database newDBEntry Int gt a gt Dynamic gt a gt Transaction Int Stores new information in the database and yields the newly generated key newDBKeyEntry Int gt a Dynamic Int gt a Transaction Stores a new entry in the database under a given key The transaction fails if the key already exists cleanDB Int gt a Dynamic gt Transaction Deletes all entries from the database associated with a predicate closeDBHandles 10 Closes all database connections Should be called when no more database access will be necessary showTError TErro
180. e in the module The comments can also contain several special tags These tags must be the first thing on its line in the documentation comment and continues until the next tag is encountered or until the end of the comment The following tags are recognized author comment Specifies the author of a module only reasonable in module comments version comment Specifies the version of a module only reasonable in module comments cons id comment A comment for the constructor id of a datatype only reasonable in datatype comments Cparam id comment A comment for function parameter id only reasonable in function comments Due to pattern matching this need not be the name of a parameter given in the declaration of the function but all parameters for this functions must be commented in left to right order if they are commented at all return comment A comment for the return value of a function only reasonable in function comments The comment of a documented entity can be any string in Markdown s syntax the currently sup ported set of elements is described in detail in the appendix For instance it can contain Markdown annotations for emphasizing elements e g _verb_ strong elements e g important code elements e g 3 4 code blocks lines prefixed by four blanks unordered lists lines prefixed by ordered lists lines prefixed by blanks followed by a digit and a dot quotations lines prefixed
181. eExpr AFuncDecl TypeExpr AFuncDecl TypeExpr Applies a substitution to a function substRule FM Int TypeExpr ARule TypeExpr ARule TypeExpr Applies a substitution to a type expression substExpr FM Int TypeExpr AExpr TypeExpr AExpr TypeExpr Applies a substitution to a type expression substSnd FM Int TypeExpr a TypeExpr gt a TypeExpr substBranch FM Int TypeExpr ABranchExpr TypeExpr gt ABranchExpr TypeExpr Applies a substitution to a branch expression substPattern FM Int TypeExpr APattern TypeExpr APattern TypeExpr Applies a substitution to a pattern subst FM Int TypeExpr TypeExpr TypeExpr Looks up a type in a substitution and converts the resulting Term to a TypeExpr Returns a given default value if the lookup fails A 5 19 Library FlatCurry Annotated Typelnference Library to annotate the expressions of a FlatCurry program with type information It can be used by any other Curry program which processes or transforms FlatCurry programs The main operation to use is inferProg Prog gt 10 Either String AProg TypeExpr which annotates a FlatCurry program with type information The type inference works in several steps 1 For each known function and constructor either imported or defined in the module itself the respective type is inserted into a type environment type assumption 2 Every subexpression is annotated with a fresh type variable whe
182. eExpr e TCons String String TypeExpr TypeExpr data OpDecl Data type for operator declarations An operator declaration fix p n in Curry corre sponds to the FlatCurry term Op n fix p Exported constructors e Op String String gt Fixity gt Int gt OpDecl data Fixity Data types for the different choices for the fixity of an operator Exported constructors e InfixOp Fixity e InfixlOp Fixity e InfixrOp Fixity data FuncDecl Data type for representing function declarations A function declaration in FlatCurry is a term of the form Func name k type Rule i1 ik e and represents the function name with definition 257 name type name xi xk e where each ij is the index of the variable xj Note the variable indices are unique inside each function declaration and are usually numbered from 0 External functions are represented as Func name arity type External s where s is the external name associated to this function Thus a function declaration consists of the name arity type and rule Exported constructors e Func String String Int Visibility TypeExpr Rule FuncDecl data Rule A rule is either a list of formal parameters together with an expression or an External tag Exported constructors e Rule Int gt Expr gt Rule e External String Rule data CaseType Data type for classifying case expressions Case expression
183. eFD Option gt FDExpr FDConstr gt Int Computes non deterministically a solution for the FD variables second argument w r t constraint third argument The first argument contains options to control the labeling instantiation of FD variables 68 A 2 7 Library CLPFD Library for finite domain constraint solving The general structure of a specification of an FD problem is as follows domainconstraint amp fdconstraint amp labeling where domain_constraint specifies the possible range of the FD variables see constraint domain fd_constraint specifies the constraint to be satisfied by a valid solution see constraints allDifferent etc below labeling is a labeling function to search for a concrete solution Note This library is based on the corresponding library of Sicstus Prolog but does not implement the complete functionality of the Sicstus Prolog library However using the PAKCS interface for external functions it is relatively easy to provide the complete functionality Exported types data Constraint A datatype to represent reifyable constraints Exported constructors data LabelingOption This datatype contains all options to control the instantiated of FD variables with the enumeration constraint labeling Exported constructors e LeftMost LabelingOption LeftMost The leftmost variable is selected for instantiation default e FirstFail LabelingOption FirstFail
184. eOpt String XmlConv a b c XmlConv Repeatable Elem Maybe c Creates an XML converter that represents an element containing optional XML data The created element may be used in repetitions eRep String gt XmlConv Repeatable a b XmlConv Repeatable Elem b Creates an XML converter that represents an element containing repeated XML data The created element may be used in repetitions seq1 a gt b gt XmlConv c d a gt XmlConv c NoElem b Creates an XML converter representing a sequence of arbitrary XML data The se quence must not be used in repetitions and does not represent an XML element repSeq1 a gt b gt XmlConv Repeatable c a XmlConv NotRepeatable NoElem b 235 Creates an XML converter that represents a repetition of a sequence of repeatable XML data The repetition may be used in other repetitions but does not represent an XML element This combinator is provided because converters for repeatable sequences cannot be constructed by the seq combinators eSeqi String gt a gt b XmlConv c d a XmlConv Repeatable Elem b Creates an XML converter for compound values represented as an XML element with children that correspond to the values components The element can be used in repe titions eRepSeql String gt a gt b XmlConv Repeatable c a XmlConv Repeatable Elem b Creates an XML converter for repetitions of sequences represented as a
185. eX String String Translate a markdown text into a complete LaTeX document that can be formatted as a standalone document formatMarkdownInputAsPDF I0 Format the standard input containing markdown text as PDF formatMarkdownFileAsPDF String gt 10 Format a file containing markdown text as PDF 214 A 4 7 Library URL Library for dealing with URLs Uniform Resource Locators Exported functions getContentsOfUrl String 10 String Reads the contents of a document located by a URL This action requires that the program wget is in your path otherwise the implementation must be adapted to the local installation A 4 8 Library WUI A library to support the type oriented construction of Web User Interfaces WUIs The ideas behind the application and implementation of WUls are described in a paper that is available via this web page Exported types type Rendering HtmlExp gt HtmlExp A rendering is a function that combines the visualization of components of a data structure into some HTML expression data WuiHandler A handler for a WUI is an event handler for HTML forms possibly with some specific code attached for future extensions Exported constructors data WuiSpec The type of WUI specifications The first component are parameters specifying the behavior of this WUI type rendering error message and constraints on inputs The second component is a show function re
186. eal numbers and finite domain constraints etc The compilation process and the execution of compiled programs is fairly efficient if a good Prolog implementation like SICStus Prolog is used 2 1 Invoking PAKCS To start PAKCS execute the command pakcs this is a shell script stored in pakcshome bin where pakcshome is the installation directory of PAKCS When the system is ready i e when the prompt Prelude gt occurs the prelude pakcshome 1ib Prelude curry is already loaded i e all definitions in the prelude are accessible Now you can type various commands see next section or an expression to be evaluated One can also invoke PAKCS with parameters These parameters are usual a sequence of com mands see next section that are executed before the user interaction starts For instance the invocation pakcs load Mod add List starts PAKCS loads the main module Mod and adds the additional module List The invocation pakcs load Mod eval config starts PAKCS loads the main module Mod and evaluates the operation config before the user interaction starts As a final example the invocation pakcs load Mod save quit starts PAKCS loads the main module Mod creates an executable and terminates PAKCS This invocation could be useful in make files for systems implemented in Curry There are also some additional options that can be used when invoking PAKCS noreadline if used this must be the first
187. ean 74 boolType 250 both 103 bound 76 bquotes 153 braces 153 brackets 153 BranchExpr 261 branchExpr 274 298 branchPattern 274 298 breakline 205 browse 100 browseList 100 buildGr 183 Button 118 button 206 318 CalendarTime 171 calendarTimeToString 172 callFrontend 89 callFrontendWithParams 89 CanvasItem 113 CanvasScroll 118 caseBranches 272 296 caseExpr 272 296 CaseType 258 caseType 271 296 cat 150 categorizeByltemKey 196 catMaybes 140 cBranch 251 CCaseType 244 cChar 252 CConsDecl 241 center 204 CExpr 243 CField 239 CFieldDecl 241 CFixity 242 cfunc 250 CFuncDecl 242 CgiEnv 197 CgiRef 197 CgiServerMsg 210 cgiServerRegistry 211 char 153 233 check 76 checkAssertion 58 checkbox 206 checkedbox 206 childFamilies 192 children 192 choiceSPEP 145 choose 167 chooseColor 119 chooseValue 167 CHR 60 chr2curry 62 chrsToGoal 61 cleancurry 7 cleanDB 129 134 135 CLiteral 244 CLocalDecl 243 ClockTime 171 clockTimeToInt 172 closeDBHandles 134 Cmd 118 cmpChar 190 cmpList 190 cmpString 191 cmtfunc 250 code 204 col 115 colon 155 Color 114 ColVal 130 combArgs 271 296 combine 97 148 176 combineSimilar 176 combName 271 296 CombType 258 combType 271 296 comma 155 Command 118 comment documentation 28 compact 13 compareAnyTerm 174 compareCalendarTime 173 compareClockTime 173 compareDate 173 compileCHR
188. ear 2005 S Antoy and M Hanus Set functions for functional logic programming In Proceedings of the 11th ACM SIGPLAN International Conference on Principles and Practice of Declarative Programming PPDP 09 pages 73 82 ACM Press 2009 S Antoy and M Hanus Curry without Success In Proc of the 23rd International Workshop on Functional and Constraint Logic Programming WFLP 2014 volume 1335 of CEUR Workshop Proceedings pages 140 154 CEUR WS org 2014 S Antoy and M Hanus From boolean equalities to constraints In Proceedings of the 25th International Symposium on Logic based Program Synthesis and Transformation LOPSTR 2015 Springer LNCS to appear 2015 S Antoy and M Hanus Default rules for Curry In Proc of the 18th International Symposium on Practical Aspects of Declarative Languages PADL 2016 Springer LNCS to appear 2016 B Brafel O Chitil M Hanus and F Huch Observing functional logic computations In Proc of the Sixth International Symposium on Practical Aspects of Declarative Languages PADL 04 pages 193 208 Springer LNCS 3057 2004 B Bra el M Hanus and F Huch Encapsulating non determinism in functional logic com putations Journal of Functional and Logic Programming 2004 6 2004 B Bra el M Hanus and M M ller High level database programming in Curry In Proc of the Tenth International Symposium on Practical Aspects of Declarative Languages PADL 08 pages 316 332 Sprin
189. ec b gt WuiSpec c gt WuiSpec d WuiSpec e WuiSpec f WuiSpec g WuiSpec h gt WuiSpec i WUI combinator for constructors of arity 8 The first argument is the ternary construc tor The further arguments are the WUI specifications for the argument types w9Tuple WuiSpec a gt WuiSpec b WuiSpec c WuiSpec d WuiSpec e gt WuiSpec f gt WuiSpec g gt WuiSpec h gt WuiSpec i gt WuiSpec a b c d e f g h i WUI combinator for tuples of arity 9 wCons9 a gt b gt c gt d gt e gt f gt g gt h gt i j WuiSpec a gt WuiSpec b gt WuiSpec c gt WuiSpec d gt WuiSpec e gt WuiSpec f WuiSpec g WuiSpec h gt WuiSpec i WuiSpec j WUI combinator for constructors of arity 9 The first argument is the ternary construc tor The further arguments are the WUI specifications for the argument types wi0Tuple WuiSpec a gt WuiSpec b WuiSpec c gt WuiSpec d WuiSpec e gt WuiSpec f WuiSpec g gt WuiSpec h WuiSpec i WuiSpec j gt WuiSpec a b c d e f g h i j WUI combinator for tuples of arity 10 wCons10 la lt b gt c gt d gt e gt f gt g gt h gt iw gt j gt k gt WuiSpec a gt WuiSpec b WuiSpec c WuiSpec d gt WuiSpec e WuiSpec f WuiSpec g gt WuiSpec h gt WuiSpec i WuiSpec j WuiSpec k WUI combinator for constructors of arity 10 The first argument is the
190. eclaration consName ConsDecl gt String String get name of constructor declaration consArity ConsDecl Int get arity of constructor declaration consVisibility ConsDecl Visibility 265 get visibility of constructor declaration consArgs ConsDecl gt TypeExpr get arguments of constructor declaration updCons String String gt String String Int gt Int gt Visibility gt Visibility gt TypeExpr gt TypeExpr gt ConsDecl gt ConsDecl update constructor declaration updConsName String String gt String String ConsDecl gt ConsDecl update name of constructor declaration updConsArity Int gt Int ConsDecl ConsDecl update arity of constructor declaration updConsVisibility Visibility gt Visibility gt ConsDecl gt ConsDecl update visibility of constructor declaration updConsArgs TypeExpr TypeExpr ConsDecl ConsDecl update arguments of constructor declaration updQNamesInConsDecl String String gt String String ConsDecl gt ConsDecl update all qualified names in constructor declaration tVarIndex TypeExpr Int get index from type variable domain TypeExpr TypeExpr get domain from functional type range TypeExpr TypeExpr get range from functional type tConsName TypeExpr gt String String get name from constructed type tConsArgs TypeExpr
191. ed modules so that their exported entities are available in the top level environment expr Evaluate the expression expr to normal form and show the computed results Since PAKCS compiles Curry programs into Prolog programs non deterministic computations are imple mented by backtracking Therefore computed results are shown one after the other In the e interactive mode which can be set in the configuration file pakcsrc or by setting the op tion interactive see below you will be asked after each computed result whether you want to see the next alternative result or all alternative results The default answer value for this question can be defined in the configuration file pakcsrc file see Section 2 6 Free variables in initial expressions must be declared as in Curry programs if the free variable mode is not turned on see option free below Thus in order to see the results of their bindings they must be introduced by a where free declaration For instance one can write not b where b free in order to obtain the following bindings and results b b True False False True Without these declarations an error is reported in order to avoid the unintended introduction of free variables in initial expressions by typos eval expr Same as expr This command might be useful when putting commands as arguments when invoking pakcs define z expr
192. ee a WUI for tree types The rendering specifies the rendering of inner nodes Leaves are shown with their default rendering renderTuple HtmlExp gt HtmlExp Standard rendering of tuples as a table with a single row Thus the elements are horizontally aligned renderTaggedTuple String gt HtmlExp gt HtmlExp Standard rendering of tuples with a tag for each element Thus each is preceded by a tag that is set in bold and all elements are vertically aligned renderList HtmlExp gt HtmlExp Standard rendering of lists as a table with a row for each item Thus the elements are vertically aligned mainWUI WuiSpec a gt a gt a gt I0 HtmlForm 10 HtmlForm Generates an HTML form from a WUI data specification an initial value and an update form 229 wui2html WuiSpec a gt a gt a I0 HtmlForm gt HtmlExp WuiHandler Generates HTML editors and a handler from a WUI data specification an initial value and an update form wuilnForm WuiSpec a a gt a gt IO HtmlForm gt HtmlExp WuiHandler gt 10 HtmlForm IO HtmlForm Puts a WUI into a HTML form containing holes for the WUI and the handler wuiWithErrorForm WuiSpec a gt a gt a I0 HtmlForm gt HtmlExp gt WuiHandler gt I0 HtmlForm HtmlExp WuiHandler Generates HTML editors and a handler from a WUI data specification an initial value and an update f
193. elements setSpaced Doc gt Doc Spaced version of set tupled Doc gt Doc The document tupled xs comma seperates the documents xs and encloses them in parenthesis The documents are rendered horizontally if that fits the page Otherwise they are aligned vertically All comma seperators are put in front of the elements tupledSpaced Doc gt Doc Spaced version of tupled semiBraces Doc Doc 152 The document semiBraces xs seperates the documents xs with semi colons and encloses them in braces The documents are rendered horizontally if that fits the page Otherwise they are aligned vertically All semi colons are put in front of the elements semiBracesSpaced Doc Doc Spaced version of semiBraces enclose Doc gt Doc Doc gt Doc The document enclose 1 r x encloses document x between documents 1 and r using lt gt enclose lrx 1 lt gt x lt gt r squotes Doc gt Doc Document squotes x encloses document x with single quotes dquotes Doc Doc Document dquotes x encloses document x with double quotes bquotes Doc Doc Document bquotes x encloses document x with back quotes parens Doc Doc Document parens x encloses document x in parenthesis and gt parensIf Bool Doc Doc Document parensIf x encloses document x in parenthesis and iff the con dition is true angles Doc Doc Document
194. emented in a more efficient way without introducing auxiliary operations Optimization of programs containing functional patterns Since functions patterns can evaluate to non linear constructor terms they are dynamically checked for multiple occurrences of variables which are if present replaced by equality constraints so that the constructor term is always linear see 6 for details Since these dynamic checks are costly and not necessary for func tional patterns that are guaranteed to evaluate to linear terms there is an optimizer for functional patterns that checks for occurrences of functional patterns that evaluate always to linear construc tor terms and replace such occurrences with a more efficient implementation This optimizer can be enabled by the following possibilities e Set the environment variable FCYPP to fpopt before starting PAKCS e g by the shell command export FCYPP fpopt Then the functional pattern optimization is applied if programs are compiled and loaded in PAKCS e Put an option into the source code If the source code of a program contains a line with a comment of the form the comment must start at the beginning of the line PAKCS_OPTION_FCYPP fpopt then the functional pattern optimization is applied if this program is compiled and loaded in PAKCS The optimizer also report errors in case of wrong uses of functional patterns i e in case of a function f defined with functiona
195. ent is true 79 satisfied Boolean Bool Checks the consistency of the constraint with regard to the accumulated constraints and if the check succeeds tells the constraint check Boolean Bool Asks whether the argument or its negation is now entailed by the accumulated con straints Fails if it is not bound Boolean Bool Instantiates given variables with regard to the accumulated constraints simplify Boolean Boolean Simplifies the argument with regard to the accumulated constraints evaluate Boolean Bool Evaluates the argument with regard to the accumulated constraints A 2 10 Library 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 repre sented 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 Exported functions permute a gt a Compute any permutation of a list For example 1 2 3 4 may give 1 3 4 2 subset a gt a Compute any sublist of a list The sublist contains some of the elements of the list in the same order For example 1 2 3 4 may give 1 3 and 1 2 3 gives 1 2 3 1 2 1 3 1 2 3 2 3 or splitSet a gt lal a Split a list into any two sublists For example 1
196. ents xs horizontally with lt gt as long as its fits the page than inserts a line and continues doing that for all documents inxs fillSep xs foldr lt gt empty xs sep Doc gt Doc The document sep xs concatenates all documents xs either horizontally with lt gt if it fits the page or vertically with sep xs group vsep xs hcat Doc Doc The document hcat xs concatenates all documents xs horizontally with lt gt vcat Doc Doc The document vcat xs concatenates all documents xs vertically with lt gt If a group undoes the line breaks inserted by vcat all documents are directly concatenated fillCat Doc Doc The document fillCat xs concatenates documents xs horizontally with lt gt as long as its fits the page than inserts a linebreak and continues doing that for all documents in xs fillCat xs foldr lt gt empty xs cat Doc Doc The document cat xs concatenates all documents xs either horizontally with lt gt if it fits the page or vertically with lt gt cat xs group vcat xs punctuate Doc gt Doc gt Doc punctuate p xs concatenates all documents xs with document p except for the last document someText map text words in a tuple test parens align cat punctuate comma someText 150 This is layed out on a page width of 20 as words in a tuple But when the page width is 15 i
197. er with a main index file index html If one prefers another directory for the documentation files one can also execute the command currydoc docdir Example 29 where docdir is the directory for the documentation files In order to generate the common documentation for large collections of Curry modules e g the libraries contained in the PAKCS distribution one can call currydoc with the following options currydoc noindexhtml docdir Mod This command generates the documentation for module Mod in the directory docdir without the index pages i e main index page and index pages for all functions and constructors defined in Mod and its imported modules currydoc onlyindexhtml docdir Modi Mod2 Modn This command generates only the index pages i e a main index page and index pages for all functions and constructors defined in the modules Mod1 M2 Modn and their imported modules in the directory docdir 30 7 CurryBrowser A Tool for Analyzing and Browsing Curry Pro grams CurryBrowser is a tool to browse through the modules and functions of a Curry application show them in various formats and analyze their properties Moreover it is constructed in a way so that new analyzers can be easily connected to CurryBrowser A detailed description of the ideas behind this tool can be found in 18 19 CurryBrowser is part of the PAKCS distribution and can be started in two ways e In the command shell via the command pakcs
198. erence height width and initial contents checkbox CgiRef String HtmlExp A checkbox with a reference and a value The value is returned if checkbox is on 9999 otherwise is returned checkedbox CgiRef String HtmlExp A checkbox that is initially checked with a reference and a value The value is returned 9999 if checkbox is on otherwise is returned radio_main CgiRef String HtmlExp A main button of a radio initially on with a reference and a value The value is returned of this button is on A complete radio button suite always consists of a main button radiomain and some further buttons radioothers with the same reference Initially the main button is selected or nothing is selected if one uses radiomainoff instead of radio_main The user can select another button but always at most one button of the radio can be selected The value corresponding to the selected button is returned in the environment for this radio reference radio_main_off CgiRef String HtmlExp A main button of a radio initially off with a reference and a value The value is returned of this button is on radio_other CgiRef String HtmlExp 206 A further button of a radio initially ofP with a reference identical to the main button of this radio and a value The value is returned of this button is on selection CgiRef gt String String HtmlExp
199. errors e PAKCS translates all local declarations into global functions with additional arguments lambda lifting see Appendix D of the Curry language report Thus in the compiled target code the definition of functions with local declarations look different from their origi nal definition in order to see the result of this transformation you can use the CurryBrowser see Section 7 e Tabulator stops instead of blank spaces in source files are interpreted as stops at columns 9 17 25 33 and so on In general tabulator stops should be avoided in source programs e Since PAKCS compiles Curry programs into Prolog programs non deterministic computa tions are treated as in Prolog by a backtracking strategy which is known to be incomplete Thus the order of rules could influence the ability to find solutions for a given goal e Threads created by a concurrent conjunction are not executed in a fair manner usually threads corresponding to leftmost constraints are executed with higher priority e Encapsulated search In order to allow the integration of non deterministic computations in programs performing I O at the top level PAKCS supports the search operators findall and findfirst These and some other operators are available in the library Findall i e they are not part of the standard prelude In contrast to the general definition of encapsulated search 22 the current implementation suspends the evaluation of findall and
200. ers i e the type of a finite domain variable is Int The arithmetic operations related to finite domain variables are suffixed by The following functions and constraints for finite domain constraint solving are currently supported in PAKCS 4 domain Int gt Int gt Int gt Bool The constraint domain z 2 l u is satisfied if the domain of all variables x is the interval l u Int gt Int gt Int Addition on finite domain values Int gt Int gt Int Subtraction on finite domain values Int gt Int gt Int Multiplication on finite domain values Int gt Int gt Bool Equality of finite domain values Note that this library is based on the corresponding library of SICStus Prolog but does not implement the complete functionality of the SICStus Prolog library However using the PAKCS interface for external functions see Appendix E it is relatively easy to provide the complete functionality 5l Int gt Int gt Bool Disequality of finite domain values lt Int gt Int gt Bool less than relation on finite domain values lt Int gt Int gt Bool less than or equal relation on finite domain values gt Int gt Int gt Bool greater than relation on finite domain values gt Int gt Int gt Bool greater than or equal relation on finite domain values sum Int
201. erts a string into an AbstractCurry represention of this string toVar Int CExpr Converts an index i into a variable named xi cvar String CExpr Converts a string into a variable with index 1 cpvar String CPattern Converts a string into a pattern variable with index 1 ctvar String CTypeExpr Converts a string into a type variable with index 1 A 5 5 Library AbstractCurry Pretty Pretty printing of AbstractCurry This library provides a pretty printer for AbstractCurry modules Exported types data Qualification Exported constructors e Full Qualification e Imports Qualification e OnDemand Qualification e None Qualification data LayoutChoice Exported constructors 252 e PreferNestedLayout LayoutChoice e PreferFilledLayout LayoutChoice data Options Exported constructors Exported functions defaultOptions Options defaultOptions options 78 2 Imports Therefore use these options only with functions like prettyCurryProg or ppCurryProg because they will overwrite the module name anyway Also avoid setting on demand qualification because no informa tion about related modules is given options Int gt Int gt Qualification gt String CurryProg Options setPageWith Int Options Options Sets the page width of the pretty printer options setIndentWith Int Options Options Sets the indentation width of the pretty pr
202. es 16 30 Springer LNCS 5418 2009 M Hanus and S Koschnicke An ER based framework for declarative web programming Theory and Practice of Logic Programming 14 3 269 291 2014 M Hanus and F Steiner Controlling search in declarative programs In Principles of Declar ative Programming Proc Joint International Symposium PLILP ALP 98 pages 374 390 Springer LNCS 1490 1998 M Hanus ed Curry An integrated functional logic language vers 0 9 0 Available at http www curry language org 2015 T Johnsson Lambda lifting Transforming programs to recursive functions In Functional Programming Languages and Computer Architecture pages 190 203 Springer LNCS 201 1985 P Wadler Efficient compilation of pattern matching In S L Peyton Jones editor The Implementation of Functional Programming Languages pages 78 103 Prentice Hall 1987 49 A Libraries of the PAKCS Distribution The PAKCS distribution comes with an extensive collection of libraries for application program ming The libraries for arithmetic constraints over real numbers finite domain constraints ports for concurrent and distributed programming and meta programming by representing Curry pro grams in Curry are described in the following subsection in more detail The complete set of libraries with all exported types and functions are described in the further subsections For a more detailed online documentation of all libraries of PAKCS see http ww
203. es a server side socket with a symbolic name socketAccept Socket gt IO String Handle Returns a connection of a client to a socket The connection is returned as a pair consisting of a string identifying the client the format of this string is implementation dependent and a handle to a stream communication with the client The handle is both readable and writable waitForSocketAccept Socket gt Int I0 Maybe String Handle Waits until a connection of a client to a socket is available If no connection is available within the time limit it returns Nothing otherwise the connection is returned as a pair consisting of a string identifying the client the format of this string is implementation dependent and a handle to a stream communication with the client sClose Socket gt IO Closes a server socket socketName Socket String Returns a the symbolic name of a named socket connectToSocketRepeat Int gt IO a gt Int gt String 10 Maybe Handle Waits for connection to a Unix socket with a symbolic name In contrast to connectToSocket this action waits until the socket has been registered with its sym bolic name 141 connectToSocketWait String IO Handle Waits for connection to a Unix socket with a symbolic name and return the handle of the connection This action waits possibly forever until the socket with the symbolic name is registered connectToSocket String IO Han
204. es pretty printers for FlatCurry modules and all substructures e g expressions Exported types data Options Options for pretty printing Exported constructors e Options Int gt QualMode String Options data QualMode Qualification mode determines whether identifiers are printed qualified or unqualified While QualNone and QualImports aim at readability there may be ambiguities due to shadowing On the contrary QualImports and QualA11 produce correct output at the cost of readability Exported constructors e QualNone QualMode QualNone no qualification only unqualified names e QualImportsButPrelude QualMode QualImportsButPrelude qualify all imports except those from the module Prelude e QualImports QualMode QualImports qualify all imports including Prelude e QualAll QualMode QualAll qualify all names 275 Exported functions indentWidth Options Int qualMode Options QualMode currentModule Options String defaultOptions Options Default Options for pretty printing ppProg Options gt Prog gt Doc pretty print a FlatCurry module ppHeader Options gt String gt TypeDec1 FuncDec1 gt Doc pretty print the module header ppExports Options gt TypeDec1 gt FuncDec1 gt Doc pretty print the export list ppTypeExport Options gt TypeDecl Doc pretty print a type export
205. es the following entities in the program Port a This is the datatype of a port to which one can send messages of type a openPort Port a gt a gt Bool The constraint openPort p s establishes a new internal port p with an associated message stream s p and s must be unbound variables otherwise the constraint fails and causes a runtime error send a gt Port a gt Bool The constraint send m p is satisfied if p is constrained to contain the message m i e m will be sent to the port p so that it appears in the corresponding stream doSend a gt Port a gt I0 The I O action doSend m p solves the constraint send m p and returns nothing openNamedPort String gt 10 a The I O action openNamedPort n opens a new external port with symbolic name n and returns the associated stream of messages connectPort String gt 10 Port a The I O action connectPort n returns a port with symbolic name n i e n must have the form portname machine to which one can send messages by the send constraint Currently 53 no dynamic type checking is done for external ports i e sending messages of the wrong type to a port might lead to a failure of the receiver Restrictions Every expression possibly containing logical variables can be sent to a port However as discussed in 15 port communication is strict i e the expression is evaluated to normal form before sending
206. ess the database is small allDBKeyInfos Int a Dynamic Query Int a Returns a list of all stored entries Do not use this function unless the database is small Int gt a gt ColVal Constructs a value restriction for the column given as first argument someDBKeys Int gt a Dynamic gt ColVal gt Query Int Returns a list of those stored keys where the corresponding info part matches the gioven value restriction Safe to use even on large databases if the number of results is small someDBInfos Int gt a Dynamic gt ColVal Query a Returns a list of those info parts of stored entries that match the given value restrictions for columns Safe to use even on large databases if the number of results is small someDBKeyInfos Int gt a Dynamic ColVal Query Int a Returns a list of those entries that match the given value restrictions for columns Safe to use even on large databases if the number of results is small someDBKeyProjections Int gt a Dynamic gt Int ColVal gt Query Int b Returns a list of column projections on those entries that match the given value re strictions for columns Safe to use even on large databases if the number of results is small 133 getDBInfo Int gt a gt Dynamic Int Query Maybe a Queries the information stored under the given key Yields Nothing if th
207. esulting document by 1 and r The documents are rendered horizontally fillEncloseSep Doc gt Doc Doc gt Doc gt Doc The document fillEncloseSep 1 r s xs concatenates the documents xs seperated by s and encloses the resulting document by 1 and r The documents are rendered horizontally if that fits the page Otherwise they are aligned vertically All seperators are put in front of the elements fillEncloseSepSpaced Doc Doc gt Doc gt Doc gt Doc The document fillEncloseSepSpaced 1 r s xs concatenates the documents xs seperated by s and encloses the resulting document by 1 and r In addition after each occurrence of s after 1 and before r a space is inserted The documents are rendered horizontally if that fits the page Otherwise they are aligned vertically All seperators are put in front of the elements list Doc Doc The document list xs comma seperates the documents xs and encloses them in square brackets The documents are rendered horizontally if that fits the page Other wise they are aligned vertically All comma seperators are put in front of the elements listSpaced Doc gt Doc Spaced version of list set Doc Doc The document set xs comma seperates the documents xs and encloses them in braces The documents are rendered horizontally if that fits the page Otherwise they are aligned vertically All comma seperators are put in front of the
208. eters of the front end as configured by the compiler specific resource configuration file setQuiet Bool gt FrontendParams gt FrontendParams Set quiet mode of the front end 87 setExtended Bool gt FrontendParams FrontendParams Set extended mode of the front end setOverlapWarn Bool FrontendParams FrontendParams Set overlap warn mode of the front end setFullPath String FrontendParams FrontendParams Set the full path of the front end If this parameter is set the front end searches all modules in this path instead of using the default path setHtmlDir String FrontendParams FrontendParams Set the htmldir parameter of the front end Relevant for HTML generation setLogfile String FrontendParams FrontendParams Set the logfile parameter of the front end If this parameter is set all messages produced by the front end are stored in this file setSpecials String FrontendParams FrontendParams Set additional specials parameters of the front end These parameters are specific for the current front end and should be used with care since their form might change in the future quiet FrontendParams Bool Returns the value of the quiet parameter extended FrontendParams Bool Returns the value of the extended parameter overlapWarn FrontendParams Bool Returns the value of the overlapWarn parameter fullPath Fronte
209. findfirst until the argument does not contain unbound global variables Moreover the evaluation of findall is strict i e it computes all solutions before returning the complete list of solutions Since it is known that the result of these search operators might depend on the evaluation strategy due to the combination of sharing and lazy evaluation see 12 for a detailed dis cussion it is recommended to use set functions 7 as a strategy independent encapsulation of non deterministic computations Set functions compute the set of all results of a defined function but do not encapsulate non determinism occurring in the actual arguments See the library SetFunctions Section A 2 50 for more details e There is currently no general connection to external constraint solvers However the PAKCS compiler provides constraint solvers for arithmetic and finite domain constraints see Ap pendix A 1 3 Modules in PAKCS PAKCS searches for imported modules in various directories By default imported modules are searched in the directory of the main program and the system module directory pakcshome 1ib This search path can be extended by setting the environment variable CURRYPATH which can be also set in a PAKCS session by the option set path see below to a list of directory names separated by colons In addition a local standard search path can be defined in the pakcsrc file see Section 2 6 Thus modules to be l
210. fixOp 278 287 ppPrefixQOp 278 ppProg 276 284 ppQFunc 255 ppQName 278 287 ppQType 255 pPrint 145 ppRule 277 286 ppTVarIndex 277 286 ppType 255 pplypeDecl 277 285 ppTypeDecls 277 285 ppTypeExp 277 285 ppTypeExport 276 285 ppTypeExpr 277 286 ppVarIndex 277 286 329 pre 184 204 245 pre 185 preprocessor 35 pretty 158 prettyCurryProg 253 printdepth 14 printfail 13 printMemInfo 160 printValues 168 ProcessInfo 159 product 138 profile 14 profileSpace 160 profileSpaceNF 160 profileTime 160 profileTimeNF 160 Prog 255 progFuncs 263 288 progImports 263 288 progName 263 288 progOps 263 288 program documentation 28 testing 33 progTypes 263 288 ProtocolMsg 57 publicConsNames 247 publicFuncNames 247 publicTypeNames 247 punctuate 150 puts 93 pVars 251 QName 239 255 Qualification 252 QualMode 275 qualMode 276 Query 79 130 queryAl1 80 queryJustOne 80 queryOne 80 queryOneWithDefault 80 Queue 176 quickSort 190 quiet 88 radio_main 206 radio main off 206 radio_other 206 range 266 291 rangle 154 rarrow 155 rbrace 154 rbracket 154 rcFileContents 86 rcFileName 86 rcParams 87 readAbstractCurryFile 246 readAnyQExpression 175 readAnyQTerm 175 readAnyUnqualifiedTerm 174 readCgiServerMsg 211 readCompleteFile 125 readCsV 78 readCSVFile 78 readCSVFileWithDelims 78 readCSVWithDelims 78 readCurry 55 245 readC
211. for possible configurations of a widget Exported constructors e Active Bool gt ConfItem Active define the active state for buttons entries etc e Anchor String ConfItem Anchor alignment of information inside a widget where the argument must be n ne e se s sw w nw or center e Background String ConfItem Background the background color e Foreground String ConfItem Foreground the foreground color e Handler Event GuiPort 10 Reconfigureltem gt ConfItem Handler an event handler associated to a widget The event handler returns a list of widget ref configuration pairs that are applied after the handler in order to configure GUI widgets e Height Int ConfItem Height the height of a widget chars for text pixels for graphics 109 CheckInit String ConfItem CheckInit initial value for checkbuttons CanvasItems CanvasItem ConfItem CanvasItems list of items contained in a canvas List String gt ConfItem List list of values shown in a listbox Menu MenuItem gt ConfItem Menu the items of a menu button WRef WidgetRef ConfItem WRef a reference to this widget Text String ConfItem Text an initial text contents Width Int Confltem Width the width of a widget chars for text pixels for graphics Fill Confltem Fill
212. g GVar t g gvar v Here the type t must not contain type variables v is the initial value for every program run Note the implementation in PAKCS is based on threading a state through the execution Thus it might be the case that some updates of global variables are lost if fancy features like unsafe operations or debugging support are used Exported types data GVar The general type of global variables Exported constructors 106 Exported functions gvar a gt GVara gvar is only used for the declaration of a global variable and should not be used else where In the future it might become a keyword readGVar GVar a gt IO a Reads the current value of a global variable writeGVar GVar a gt a 10 Updates the value of a global variable The associated term is evaluated to a data term and might contain free variables A 2 30 Library 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 Exported types data GuiPort The port to a GUI is just the stream connection to a GUI where Tcl Tk communication is done Exported constructors data Widget The type of possible widgets in a GUI Exported constructors e PlainButton ConfItem Widget PlainButton a button in a GUI whose event handler is activated if the user presses the button e Can
213. g String gt CVisibility Int String CTypeExpr gt CTypeDecl e CNewType String String gt CVisibility gt Int String CConsDecl gt CTypeDecl data CConsDecl A constructor declaration consists of the name of the constructor and a list of the argument types of the constructor The arity equals the number of types Exported constructors e CCons String String CVisibility CTypeExpr gt CConsDecl e CRecord String String CVisibility gt CFieldDec1 gt CConsDecl data CFieldDecl A record field declaration consists of the name of the the label the visibility and its corresponding type Exported constructors e CField String String gt CVisibility CTypeExpr gt CFieldDecl data CTypeExpr Type expression A type expression is either a type variable a function type or a type constructor application Note the names of the predefined type constructors are Int Float Bool Char IO unit type tuple types list type Exported constructors e CTVar Int String CTypeExpr e CFuncType CTypeExpr CTypeExpr gt CTypeExpr e CTCons String String gt CTypeExpr CTypeExpr data COpDecl Data type for operator declarations An operator declaration fix p n in Curry corre sponds to the AbstractCurry term COp n fix p Exported constructors 241
214. ger LNCS 4902 2008 48 14 15 16 17 18 19 23 24 25 M Hanus A unified computation model for functional and logic programming In Proc of the 24th ACM Symposium on Principles of Programming Languages Paris pages 80 93 1997 M Hanus Distributed programming in a multi paradigm declarative language In Proc of the International Conference on Principles and Practice of Declarative Programming PPDP 99 pages 376 395 Springer LNCS 1702 1999 M Hanus A functional logic programming approach to graphical user interfaces In Inter national Workshop on Practical Aspects of Declarative Languages PADL 00 pages 47 62 Springer LNCS 1753 2000 M Hanus High level server side web scripting in Curry In Proc of the Third International Symposium on Practical Aspects of Declarative Languages PADL 01 pages 76 92 Springer LNCS 1990 2001 M Hanus A generic analysis environment for declarative programs In Proc of the ACM SIG PLAN 2005 Workshop on Curry and Functional Logic Programming WCFLP 2005 pages 43 48 ACM Press 2005 M Hanus CurryBrowser A generic analysis environment for Curry programs In Proc of the 16th Workshop on Logic based Methods in Programming Environments WLPE 06 pages 61 74 2006 M Hanus and C Kluf Declarative programming of user interfaces In Proc of the 11th International Symposium on Practical Aspects of Declarative Languages PADL 09 pag
215. ges and node label only without the node identifier itself UContext Int Int Int Unlabeled context GDecomp a b b Int Int a b Int Graph a b A graph decompostion is a context for a node n and the remaining graph without that node Decomp a b Maybe b Int Int a b Int Graph a b a decomposition with a maybe context UDecomp a Maybe Int Int Int a Unlabeled decomposition Path Int Unlabeled path LPath a Int a Labeled path UPath Int Quasi unlabeled path UGr Graph O a graph without any labels Graph The type variables of Graph are nodeLabel and edgeLabel The internal representation of Graph is hidden Exported constructors 182 Exported functions amp a Int Int b a Int gt Graph b a gt Graph ba amp takes a node context and a Graph and yields a new graph The according key idea is detailed at the beginning nl is the type of the node labels and el the edge labels Note that it is an error to induce a context for a node already contained in the graph matchAny Graph a b gt b Int Int a b Int Graph a b decompose a graph into the Context for an arbitrarily chosen Node and the remaining Graph In order to use graphs as abstract data structures we also need means to decompose a graph This decompostion should work as much like pattern matching as possible The normal matching is done by the function match
216. ground terms before applying this operation getAssoc String gt I0 Maybe String Gets the value associated to a string Nothing is returned if there does not exist an associated value newlORef a IO IORef a Creates a new IORef with an initial values readIORef I0Ref a gt 10 a Reads the current value of an IORef writelORef I0Ref a gt a gt 10 Updates the value of an IORef modifyI0ORef I0Ref a gt a gt a gt I0 Modify the value of an IORef A 2 34 Library JavaScript A library to represent JavaScript programs Exported types data JSExp Type of JavaScript expressions Exported constructors 125 data JSString String JSExp JSString string constant JSInt Int JSExp JSInt integer constant JSBool Bool gt JSExp JSBool Boolean constant JSIVar Int JSExp JSIVar indexed variable JSIArrayldx Int Int gt JSExp JSIArrayldx array access to index array variable JSOp String JSExp JSExp JSExp JSOp infix operator expression JSFCall String gt JSExp JSExp JSFCall function call JSApply JSExp JSExp gt JSExp JSApply function call where the function is an expression JSLambda Int gt JSStat gt JSExp JSLambda anonymous function with indexed variables as arguments JSStat Type of JavaScript statements 126
217. gt Transaction a gt Transaction b gt Transaction b Sequential composition of transactions sequenceT Transaction a Transaction a Executes a sequence of transactions and collects all results in a list sequenceT_ Transaction a Transaction Executes a sequence of transactions and ignores the results mapT a Transaction b a Transaction b Maps a transaction function on a list of elements The results of all transactions are collected in a list mapT_ a Transaction b a Transaction Maps a transaction function on a list of elements The results of all transactions are ignored runT Transaction a gt IO Either a TError 81 Executes a possibly composed transaction on the current state of dynamic predicates as a single transaction Before the transaction is executed the access to all persistent predicates is locked i e no other process can perform a transaction in parallel After the successful transac tion the access is unlocked so that the updates performed in this transaction become persistent and visible to other processes Otherwise i e in case of a failure or abort of the transaction the changes of the transaction to persistent predicates are ignored and Nothing is returned In general a transaction should terminate and all failures inside a transaction should be handled execept for an explicit failT that leads to an abort of the transaction If a
218. gt CExpr gt CExpr 250 An application of a qualified function name to a list of arguments applyE CExpr CExpr CExpr An application of an expression to a list of arguments constF String String gt CExpr A constant i e an application without arguments applyV Int String CExpr CExpr An application of a variable to a list of arguments applyJust CExpr CExpr applyMaybe CExpr CExpr CExpr CExpr tupleExpr CExpr gt CExpr Constructs a tuple expression from list of component expressions cBranch CPattern CExpr CPattern CRhs Constructs from a pattern and an expression a branch for a case expression tuplePattern CPattern gt CPattern Constructs a tuple pattern from list of component patterns pVars Int gt CPattern Constructs for given n a list of n PVars starting from 0 pChar Char CPattern Converts a character into a pattern pNil CPattern Constructs an empty list pattern listPattern CPattern CPattern Constructs a list pattern from list of component patterns stringPattern String CPattern Converts a string into a pattern representing this string list2ac CExpr CExpr 251 Converts a list of AbstractCurry expressions into an AbstractCurry representation of this list cChar Char CExpr Converts a character into an AbstractCurry expression string2ac String CExpr Conv
219. gt Int gt Int gt Int gt Bool gt Int gt Bool scalarProduct cs vs relop v is satisfied if cs vs relop v is satisfied The first argument must be a list of integers The other arguments are as in sum count Int Int gt Int gt Int gt Bool gt Int gt Bool count v vs relop c is satisfied if n relop c where n is the number of elements in the list of FD variables vs that are equal to v is satisfied The first argument must be an integer The other arguments are as in sun allDifferent Int Bool All different constraint on FD variables all_different Int gt Bool For backward compatibility Use allDifferent indomain Int gt Bool Instantiate a single FD variable to its values in the specified domain labeling LabelingOption gt Int Bool Instantiate FD variables to their values in the specified domain A 2 8 Library CLPR Library for constraint programming with arithmetic constraints over reals Exported functions Float gt Float gt Float Addition on floats in arithmetic constraints Float gt Float gt Float Subtraction on floats in arithmetic constraints Float gt Float gt Float Multiplication on floats in arithmetic constraints Float gt Float gt Float Division on floats in arithmetic constraints lt Float Float Bool 73 Less than constraint on floats gt Float gt
220. h a softbreak in be tween with identity empty This effectively puts x and y either right next to each other or underneath each other lt gt Doc Doc gt Doc The document x lt gt y concatenates document x and y with a hardline in be tween with identity empty This effectively puts x and y underneath each other compose Doc gt Doc Doc gt Doc gt Doc The document compose f xs concatenates all documents xs with function f Func tion f should be like lt gt and so on hsep Doc Doc The document hsep xs concatenates all documents xs horizontally with lt gt vsep Doc gt Doc The document vsep xs concatenates all documents xs vertically with Ifa group undoes the line breaks inserted by vsep all documents are separated with a space someText map text words text to lay out test text some lt gt vsep someText This is layed out as some text to lay out The align combinator can be used to align the documents under their first element test text some lt gt align vsep someText This is printed as 149 some text to lay out vsepBlank Doc gt Doc The document vsep xs concatenates all documents xs vertically with lt gt Ifa group undoes the line breaks inserted by vsepBlank all documents are separated with a space fillSep Doc Doc The document fillSep xs concatenates docum
221. he end of the queue matchHead Queue a Maybe a Queue a Matches the front of a queue matchHead q is equivalent to if isEmpty q then Nothing else Just deqHead q deqTail q but more efficient matchLast Queue a Maybe a Queue a Matches the end of a queue matchLast q is equivalent to if isEmpty q then Nothing else Just deqLast q deqInit q but more efficient listToDeq a Queue a Transforms a list to a double ended queue deqToList Queue a gt la Transforms a double ended queue to a list 177 A 3 3 Library 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 Example To store a mapping from Int gt String the finite map needs a Boolean predicate like lt This version was ported from a corresponding Haskell library Exported types data FM Exported constructors Exported functions emptyFM a gt a Bool gt FM ab The empty finite map unitFM a gt a gt Bool gt a gt b gt FMab Construct a finite map with only a single element listToFM a gt a gt Bool gt a b gt FMab Builts a finite map from given list of tuples key element For multiple occurences of key the last corresponding element of the list is taken addToFM F
222. he storage mechanism for the global entity Exported constructors 105 e Temporary GlobalSpec Temporary the global value exists only during a single execution of a program e Persistent String GlobalSpec Persistent f the global value is stored persisently in file f which is created and initialized if it does not exists Exported functions global a GlobalSpec Global a global is only used for the declaration of a global value and should not be used else where In the future it might become a keyword readGlobal Global a gt IO a Reads the current value of a global writeGlobal Global a gt a gt 10 O Updates the value of a global The value is evaluated to a ground constructor term before it is updated A 2 29 Library 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 In contast to global entities as defined in the library Global global variables can contain logic variables shared with computations running in the same computation space As a consequence global variables cannot be persistent their values are not kept across different program executions Currently it is still experimental so that its interface might be slightly changed in the future A global variable g with an initial value v of type t must be declared by
223. home bin currybrowser mod e In the PAKCS environment after loading the module mod and typing the command browse Here mod is the name of the main module of a Curry application After the start CurryBrowser loads the interfaces of the main module and all imported modules before a GUI is created for interactive browsing To get an impression of the use of CurryBrowser Figure 1 shows a snapshot of its use on a particular application here the implementation of CurryBrowser The upper list box in the left column shows the modules and their imports in order to browse through the modules of an application Similarly to directory browsers the list of imported modules of a module can be opened or closed by clicking After selecting a module in the list of modules its source code interface or various other formats of the module can be shown in the main right text area For instance one can show pretty printed versions of the intermediate flat programs see below in order to see how local function definitions are translated by lambda lifting 24 or pattern matching is translated into case expressions 14 25 Since Curry is a language with parametric polymorphism and type inference programmers often omit the type signatures when defining functions Therefore one can also view and store the selected module as source code where missing type signatures are added Below the list box for selecting modules there is a menu Analyze sele
224. hout module qualifiers into the corresponding data term The string might contain logical variable encodings produced by showAnyTerm 174 readsAnyQTerm String gt a String Transforms a string containing a term in standard prefix notation with qualified con structor names into the corresponding data term The string might contain logical variable encodings produced by showAnyQTerm In case of a successful parse the re sult is a one element list containing a pair of the data term and the remaining unparsed string readAnyQTerm String gt a Transforms a string containing a term in standard prefix notation with qualified con structor names into the corresponding data term The string might contain logical variable encodings produced by showAnyQTerm showAnyExpression a String Transforms any expression even not in normal form into a string representation in standard prefix notation without module qualifiers The result depends on the evalua tion and binding status of logic variables so that it should be used with care showAnyQExpression a String Transforms any expression even not in normal form into a string representation in standard prefix notation with module qualifiers The result depends on the evaluation and binding status of logic variables so that it should be used with care readsAnyQExpression String gt a String Transforms a string containing an expression in standard prefix nota
225. ia an incomplete left to right strategy Returns Nothing if the search space is finitely failed getOneValue a gt IO Maybe a 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 gt a Bool gt I0 la Returns a list of values that do not satisfy a given constraint getSearchTree a b Bool IO SearchTree b a 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 A 2 2 Library Assertion This module defines the datatype and operations for the Curry module tester currytest 56 Exported types data Assertion Datatype for defining test cases Exported constructors data ProtocolMsg The messages sent to the test GUI Used by the currytest tool Exported constructors e TestModule String ProtocolMsg e TestCase String Bool ProtocolMsg e TestFinished ProtocolMsg e TestCompileError ProtocolMsg Exported functions assertTrue String gt Bool Assertion assertTrue s b asserts with name s that b must be true assertEqual String gt a gt a Assertion a
226. ifferent digit such that this equation is valid and there are no leading zeros The usual way to solve finite domain constraint problems is to specify the domain of the involved variables followed by a specification of the constraints and the labeling of the constraint variables in order to start the search for solutions Thus the send more money problem can be solved as follows import CLPFD smm 1 52 1 s e n d m o r y amp domain 1 0 9 s gt 0 amp m gt 0 amp allDifferent 1 amp 1000 s 100 e 10 n d 1000 m 100 o 10 r e 10000 m 1000 o 100 n 10 e y amp labeling FirstFail 1 where s e n d m o r y free Then we can solve this problem by evaluating the goal smm s e n d m o r y which yields the unique solution s 9 e 5 n 6 d 7 m 1 0 0 r 8 y 2 A 1 3 Ports Distributed Programming in Curry To support the development of concurrent and distributed applications PAKCS supports internal and external ports as described in 15 Since 15 contains a detailed description of this concept together with various programming examples we only summarize here the functions and constraints supported for ports in PAKCS The basic datatypes functions and constraints for ports are defined in the system module Ports cf Section 1 3 i e in order to use ports the program must contain the import declaration import Ports This declaration includ
227. iformly distributed sequence of values between 0 inclusive and the specified value exclusive Each value is a 32 bits positive integer All n possible values are produced with approximately equal probability nextBoolean Int gt Bool Returns a pseudorandom uniformly distributed sequence of boolean values The values True and False are produced with approximately equal probability getRandomSeed IO Int Returns a time dependent integer number as a seed for really random numbers Should only be used as a seed for pseudorandom number sequence and not as a random number since the precision is limited to milliseconds 187 A 3 6 Library 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 Exported types data RedBlackTree A red black tree consists of a tree structure and three order predicates These predicates generalize the red black tree They define 1 equality when inserting into the tree eg for a set eqInsert is for a multiset it is gt False for a lookUp table it is fst 2 equality for looking up values eg for a set eqLookUp is for a multiset it is for a lookUp table it is fst 3 the less than relation for the binary search tree Exported constructors Exported function
228. ilarly to consfail all but the complete fail trace is stored in the file f This option is useful in non interactive program executions like web scripts consfail int Similarly to consfail all but after each failure occurrence an interactive mode for exploring the fail trace is started see help information in this interactive mode When the interactive mode is finished the program execution proceeds with a failure e compact Reduce the size of target programs by using the parser option compact see Sec tion 14 for details about this option interactive Turn on off the interactive mode In the interactive mode the next non deterministic value is computed only when the user requests it Thus one has also the possibility to terminate the enumeration of all values after having seen some values The 149 default value for this option can be set in the configuration file pakcsrc initially the interactive mode is turned off first Turn on off the first only mode In the first only mode only the first value of the main expression is printed instead of all values 13 profile Profile mode If the profile mode is on then information about the number of calls failures exits etc are collected for each function during the debug mode see above and shown after the complete execution additionaly the result
229. ileCHR String gt a CHR a b gt I0 Compile a list of CHR Curry rules into CHR Prolog and store its interface in a Curry program name given as first argument chr2curry Goal a b Bool Transforms a primitive CHR constraint into a Curry constraint Used in the generated CHR Prolog code to evaluated primitive constraints A 2 5 Library CHRcompiled This module defines the structure of CHR goals and some constructors to be used in compiled CHR Curry rules Furthermore it defines an operation solveCHR to solve a CHR goal as a constraint This module is imported in compiled CHR Curry programs compare library CHR 62 Exported types data Goal A typed CHR goal Since types are not present at run time in compiled we use a phantom type to parameterize goals over CHR constraints The argument of the goal is the constraint implementing the goal with the compiled CHR Prolog program Exported constructors e Goal Bool gt Goal a Exported functions Goal a gt Goal a gt Goal a Conjunction of CHR goals true Goal a The always satisfiable CHR constraint fail Goala The always failing constraint andCHR Goal a gt Goal a Join a list of CHR goals into a single CHR goal by conjunction allCHR a gt Goal b gt a gt Goal b Is a given constraint abstraction satisfied by all elements in a list solveCHR Goal a gt Bool Evaluate a given CHR goal and embed this as
230. implemented in Curry some functionalities of it require an installed graph visualization tool dot http www graphviz org otherwise they have no effect 31 Browser Version of 22 05 2006 one ssa Select module and imports Show source Show selected module as Tools File Settings Read an existing FlatCurry file w r t current load path readFlatCurryFileInLoadPath prt mod do mbfilename lt findFileInLoadPath mod fcy maybe error FlatCurry file mod fcy not found readFlatCurryFile ndReport prt mod mbfilename Imports readFlatCurryFileAndReport prt mod filename do size lt fileSize filename prt Reading FlatCurry file of module mod show size bytes prog lt readFlatCurryFile filename seq prog prog return prog Finds the first file with a possible suffix in the load path findFileInLoadPath String gt String gt IO Maybe String findFileInLoadPath file suffixes do loadpath lt getLocalLoadPath N findFileInPath file suffixes loadpath Analyze selected module computes real load path in case of non local first program argument getLocalLoadPath do Select functions Y focus in code loadpath lt getLoadPath args lt get rgs if null args then return loadpath else return dirName head args tail loadpath read Flat Curry FilelnLoadPath Current function analysis Nondeterministic Select analysis Determ
231. imumFor 74 maxlist 120 maxValue 168 maybeToList 140 maybeType 250 MContext 182 Menultem 112 mergeSort 190 min3 120 minFM 180 minimize 74 minimum 139 minimumBy 139 minimumFor 74 minlist 120 minusFM 179 minValue 168 missingArgs 271 295 missingCombArgs 271 296 mkGraph 183 mkUGraph 183 MName 239 327 modify 93 modifyIORef 125 modNameToPath 87 modsOfType 248 mplus 140 multipleSelection 207 nav 204 nbsp 203 neg 72 75 neighbors 184 neighbors 185 nest 146 newDBEntry 129 134 135 newDBKeyEntry 129 134 newlORef 125 newNamedObject 145 newNodes 186 newObject 145 newTreeLike 188 nextBoolean 187 nextInt 187 nextIntRange 187 nmap 187 noChildren 192 Node 181 node 185 nodeRange 184 nodes 186 noGuard 250 noHandlerPage 211 noindex 30 noNodes 184 nonvar 62 normalise 97 notEmpty 167 nub 136 nubBy 136 odd 121 olist 204 on 103 once 99 onlyindex 30 OpDecl 257 openFile 122 openNamedPort 53 54 144 openPort 53 144 openProcessPort 144 opFixity 267 292 opName 267 292 opPrecedence 267 292 opt 234 OptDescr 104 Option 65 281 Options 253 275 options 253 orC 77 orExps 271 296 out 185 out 186 outdeg 185 outdeg 186 overlapWarn 88 page 202 pageBodyAttr 202 pageCss 202 pageEnc 202 pageLinkInfo 202 pageMetalnfo 202 PageParam 200 pakcs 9 PAKCS_LOCALHOST 54 PAKCS_OPTION_FCYPP 45
232. in the IO monad transformQ a gt b Query a gt Query b Applies a function to the result of a database query runT Transaction a gt I0 Either a TError Runs a transaction atomically in the IO monad Transactions are immediate which means that locks are acquired on all databases as soon as the transaction is started After one transaction is started no other database connection will be able to write to the database or start a transaction Other connections can read the database during a transaction of another process The choice to use immediate rather than deferred transactions is conservative It might also be possible to allow multiple simultaneous transactions that lock tables on the first database access which is the default in SQLite However this leads to unpredictable order in which locks are taken when multiple databases are involved The current implementation fixes the locking order by sorting databases by their name and locking them in order immediately when a transaction begins More information on _transaction html gt transactions in SQLite is available online runJustT Transaction a gt IO a Executes a possibly composed transaction on the current state of dynamic predicates as a single transaction Similar to runT but a run time error is raised if the execution of the transaction fails http sqlite org lang 131 getDB Query a Transaction a Lifts a database query to the tra
233. in variable v using a branch and bound algo rithm 70 e Assumptions Int LabelingOption Assumptions x The variable x is unified with the number of choices made by the selected enumeration strategy when a solution is found e RandomVariable Int LabelingOption RandomVariable x Select a random variable for instantiation where x is a seed value for the random numbers only supported by SWI Prolog e RandomValue Int LabelingOption RandomValue x Label variables with random integer values where x is a seed value for the random numbers only supported by SWI Prolog Exported functions domain Int gt Int Int gt Bool Constraint to specify the domain of all finite domain variables Int gt Int gt Int Addition of FD variables Int gt Int gt Int Subtraction of FD variables Int gt Int gt Int Multiplication of FD variables Int gt Int gt Bool Equality of FD variables Int Int gt Bool Disequality of FD variables lt Int gt Int gt Bool Less than constraint on FD variables lt Int Int gt Bool Less than or equal constraint on FD variables gt Int Int gt Bool 71 Greater than constraint on FD variables gt Int gt Int gt Bool Greater than or equal constraint on FD variables Int gt Int gt Constraint Reifyable equality constr
234. inate instead of finitely failing In such cases it could be necessary to consider the influence of the order of pattern matching Note that other orders of pattern matching can be obtained using auxiliary operations 19 4 Recognized Syntax of Curry The PAKCS Curry compiler accepts a slightly extended version of the grammar specified in the Curry Report 23 Furthermore the syntax recognized by PAKCS differs from that specified in the Curry Report regarding numeric or character literals We therefore present the complete description of the syntax below whereas syntactic extensions are highlighted 4 1 Notational Conventions The syntax is given in extended Backus Naur Form eBNF using the following notation NonTerm a production Non Term nonterminal symbol Term terminal symbol la optional a zero or more repetitions a grouping a 8 alternative ag difference elements generated by a without those generated by 8 The Curry files are expected to be encoded in UTF8 However source programs are biased towards ASCII for compatibility reasons 4 2 Lexicon 4 2 1 Case Mode Although the Curry Report specifies four different case modes Prolog G del Haskell free the PAKCS only supports the free mode which puts no constraints on the case of identifiers 4 2 2 Identifiers and Keywords Letter any ASCII letter Dashes Ident Letter Letter Digit _ gt Symbol ej j 4 7 lt
235. ing gt HtmlForm gt HtmlForm Adds redirection to given HTML form expires Int HtmlForm HtmlForm Adds expire time to given HTML form addSound String Bool HtmlForm HtmlForm 201 Adds sound to given HTML form The functions adds two different declarations for sound one invented by Microsoft for the internet explorer one introduced for netscape As neither is an official part of HTML addsound might not work on all systems and browsers The greatest chance is by using sound files in MID format pageEnc String PageParam An encoding scheme for a HTML page pageCSS String PageParam A URL for a CSS file for a HTML page pageMetaInfo String String PageParam Meta information for a HTML page The argument is a list of attributes included in the meta tag in the header for this page pageLinkInfo String String PageParam Link information for a HTML page The argument is a list of attributes included in the link tag in the header for this page pageBodyAttr String String gt PageParam Optional attribute for the body element of the web page More than one occurrence is allowed i e all such attributes are collected page String HtmlExp HtmlPage A basic HTML web page with the default encoding standardPage String gt HtmlExp HtmlPage A standard HTML web page where the title is included in the body as the first header addPageParam H
236. ing new back ends for Curry whereas AbstractCurry Types is intended for manipulations of programs that are more oriented towards the source program There are predefined I O actions to read AbstractCurry and FlatCurry programs AbstractCurry Files readCurry and FlatCurry Files readFlatCurry These actions parse the corresponding source program and return a data term representing this program according to the definitions in the modules AbstractCurry Types and FlatCurry Types Since all datatypes are explained in detail in these modules we refer to the online documentation of these modules As an example consider a program file test curry containing the following two lines ple prog y g g rev rev x xs rev xs x Then the I O action FlatCurry Files readFlatCurry test returns the following term Prog test Prelude Func test rev 1 Public FuncType TCons Prelude TVar 0 TCons Prelude TVar 0 Rule 0 Case Flex Var 1 Branch Pattern Prelude 0 Comb ConsCall Prelude O Branch Pattern Prelude 2 3 Comb FuncCall Prelude Comb FuncCall test rev Var 3 Comb ConsCall Prelude Var 2 Comb ConsCall Prelude O 1 333 A 2 General Libraries A 2 1 Library AllSolutions This module contains a collection of functions for obtaining lists of solutions to constraints These operations are useful
237. ing with acy UACY FrontendTarget UACY Untyped without type checking AbstractCurry file ending with uacy HTML FrontendTarget HTML colored HTML representation of source program CY FrontendTarget CY source representation employed by the frontend FrontendParams Abstract data type for representing parameters supported by the front end of the Curry compiler Exported constructors Exported functions curryCompiler String The name of the Curry compiler e g pakcs or kics2 curryCompilerMajorVersion Int The major version number of the Curry compiler curryCompilerMinorVersion Int The minor version number of the Curry compiler curryRuntime String The name of the run time environment e g sicstus swi or ghc 85 curryRuntimeMajorVersion Int The major version number of the Curry run time environment curryRuntimeMinorVersion Int The minor version number of the Curry run time environment installDir String Path of the main installation directory of the Curry compiler rcFileName 10 String The name of the file specifying configuration parameters of the current distribution This file must have the usual format of property files see description in module Prop ertyFile rcFileContents 10 String String Returns the current configuration parameters of the distribution This action yields the list of pairs var val
238. ingIgnoreCase 191 let 17 letBinds 271 296 letBody 271 296 line 146 linebreak 146 linesep 146 list 152 list2ac 251 list2CategorizedHtml 196 ListBoxScroll 118 listenOn 141 169 listenOnFresh 169 listPattern 251 listSpaced 152 listToDefaultArray 176 listToDeq 177 listToErrorArray 176 listToFM 178 326 listToMaybe 140 listType 249 litem 204 Literal 261 literal 271 296 LNode 181 log 101 logBase 101 logfile 88 lookup 188 lookupAFCSubst 300 lookupFileInPath 94 lookupFlatCurryFileInLoadPath 262 lookupFM 180 lookupModuleSourceInLoadPath 87 lookupRBT 191 lookupSubst 195 lookupWithDefaultFM 180 lparen 154 LPath 182 lpre 185 lpre 186 lsuc 184 1suc 186 magenta 157 MailOption 212 main 78 mainWUI 221 229 makeRelative 97 makeValid 98 mapAccumES 93 mapAccumL 139 mapAccumR 139 mapChildFamilies 192 mapChildFamiliesI0 193 mapChildren 192 mapChildrenI0 193 mapES 93 mapFamily 192 mapFamilyI0 193 mapFM 179 mapMaybe 140 mapMMaybe 140 mapT 81 132 mapT_ 81 132 mapValues 167 markdown 28 MarkdownDoc 212 MarkdownElem 212 markdownEscapeChars 214 markdownText2CompleteHTML 214 markdownText2CompleteLaTexX 214 markdownText2HTML 214 markdownText2LaTex 214 markdownText2LaTeXWithFormat 214 match 184 matchAny 183 matchHead 177 matchLast 177 matrix 115 max3 120 maxFM 180 maximize 74 maximum 138 maximumBy 139 max
239. inistic operation Figure 1 Snapshot of the main window of CurryBrowser analyses are local i e they need only to consider the local definition of this function e g Calls directly Overlapping rules Pattern completeness where other analyses are global i e they consider the definitions of all functions directly or indirectly called by this function e g Depends on Solution complete Set valued Finally there are a few additional tools integrated into CurryBrowser for instance to visualize the import relation between all modules as a dependency graph These tools are available through the Tools menu More details about the use of CurryBrowser and all built in analyses are available through the Help menu of CurryBrowser 32 8 CurryTest A Tool for Testing Curry Programs CurryTest is a simple tool in the PAKCS distribution to write and run repeatable tests CurryTest simplifies the task of writing test cases for a module and executing them The tool is easy to use Assume one has implemented a module MyMod and wants to write some test cases to test its functionality making regression tests in future versions etc For this purpose there is a system library Assertion Section A 2 2 which contains the necessary definitions for writing tests In particular it exports an abstract polymorphic type Assertion a together with the following operations assertTrue S
240. inter options setQualification Qualification Options Options Sets the qualification method to be used by the pretty printer setModName String Options Options Sets the name of the current module in the pretty printer options setLayoutChoice LayoutChoice Options Options Sets the preferred layout in the pretty printer options showCProg CurryProg String Shows a pretty formatted version of an abstract Curry Program The options for pretty printing are the defaultOptions prettyCurryProg Options CurryProg String pretty print the document generated by ppCurryProg using the page width specified by given options ppCurryProg Options CurryProg Doc 253 pretty print a CurryProg the representation of a program written in curry using AbstractCurry according to given options This function will overwrite the module name given by options with the name encapsulated in CurryProg ppMName String Doc pretty print a module name just a string ppExports Options CTypeDecl gt CFuncDecl gt Doc pretty print exports i e all type and function declarations which are public extract the type and function declarations which are public and gather their qualified names in a list ppImports Options String Doc pretty print imports list of module names by prepending the word import to the module name ppCOpDecl Options gt COpDecl
241. ion VariableID VariableID free n gt 0 FixityDeclaration Pattern Expr where LocalDefs InfixExpr TypeExpr expression type signature 24 InfirExpr NoOpExpr FunctExpr BasicExpr Alt GdAlts FBind Qual Stmt Literal GDataConstr FunctionName QFunctionName InfirExpr NoOpExpr QOp InfixExpr InfixExpr InfixExpr NoOpExpr SimplePat SimplePat gt Expr let LocalDefs in Expr if Expr then Expr else Expr case Expr of Alt Alt fcase Expr of Alt Alt do Stmt Stmt Expr FunctExpr FunctExpr BasicExpr QVariablelD QFunctionName GDataConstr Literal Expr Expr Expry Expr Expr Expr Expr Expr 1 L Expr Qual Qual J C InfixExpr QOp gt Q0p y InfixExpr QDataConstr FBind FBind y FBind labeled update n gt 0 BasicExpr gpataConstr FBind Pattern gt Expr where LocalDefs Pattern GdAlts where LocalDefs InfixExpr gt Expr GdAlts QLabelID Expr Expr let LocalDefs Pattern lt Expr Expr let LocalDefs Pattern lt Expr Int Char String Float O GLP QDataConstr FunctionID InfixOpID QFunctionID QInfixOpID 25 infix operator application unary int minus unary float minus lambda expression n gt 0 let expression conditional case expression n gt 0 fc
242. ion call at a pattern position With functional patterns we can define the operation last as follows last _ y y This definition is not only more compact but also avoids the complete evaluation of the list elements since a functional pattern is considered as an abbreviation for the set of constructor terms obtained by all evaluations of the functional pattern to normal form see 6 for an exact definition the previous definition is conceptually equivalent to the set of rules last y y last _ y y last _ _ y y 17 which shows that the evaluation of the list elements is not demanded by the functional pattern In general a pattern of the form f ti t n gt 0 is interpreted as a functional pattern if f is not a visible constructor but a defined function that is visible in the scope of the pattern It is also possible to combine functional patterns with as patterns Similarly to the meaning of as patterns in standard constructor patterns as patterns in functional patterns are interpreted as a sequence of pattern matching where the variable of the as pattern is matched before the given pattern is matched This process can be described by introducing an auxiliary operation for this two level pattern matching process For instance the definition f _ x 42 _ _ x is considered as syntactic sugar for the expanded definition f _ x _ f x where f 42 _ x However as patterns are usually impl
243. irectory After the generation of this project see the generated file README txt for information about the generated project structure one can compile the generated programs by make compile In order to generate the executable web application configure the generated Makefile by adapting the variable WEBSERVERDIR to the location where the compiled cgi programs should be stored and run make deploy After the successful compilation and deployment of all files the application is executable in a web browser by selecting the URL lt URL of web dir gt spicey cgi 43 13 UI Declarative Programming of User Interfaces The PAKCS distribution contains a collection of libraries to implement graphical user interfaces as well as web based user interfaces from declarative descriptions Exploiting these libraries it is possible to define the structure and functionality of a user interface independent from the concrete technology Thus a graphical user interface or a web based user interface can be generated from the same description by simply changing the imported libraries This programming technique is described in detail in 20 The libraries implementing these user interfaces are contained in the directory pakcshome too1s ui Thus in order to compile programs containing such user interface specifications one has to in clude the directory pakcshome too1s ui into the Curry load path e g by setting the environment variable CURRYPATH
244. is applicable the first constraint is kept and the second con straint is deleted I gt CHR a b gt Goal a b gt CHR a b A rule with a guard NW Goal a b gt Goal a b gt Goal a b Conjunction of CHR goals true Goal a b The always satisfiable CHR constraint fail Goal ab 60 The always failing constraint andCHR Goal a b gt Goal a b Join a list of CHR goals into a single CHR goal by conjunction allCHR a gt Goal b c gt a gt Goal bc Is a given constraint abstraction satisfied by all elements in a list chrsToGoal a gt Goal ba Transforms a list of CHR constraints into a CHR goal toGoall a b gt a gt Goal c b Transform unary CHR constraint into a CHR goal toGoal2 a gt b gt c gt a b Goaldc Transforms binary CHR constraint into a CHR goal toGoal3 a gt b gt c gt d gt a gt b gt c gt Goal ed Transforms a ternary CHR constraint into a CHR goal toGoal4 la gt b gt c gt d gt e gt a gt b gt c gt gt d gt Goal fe Transforms a CHR constraint of arity 4 into a CHR goal toGoal5 a gt b gt c gt d gt e gt f gt ar b cd e Goal gf Transforms a CHR constraint of arity 5 into a CHR goal toGoal6 a gt b gt c gt d gt e gt f gt g gt a gt b gt c gt d gt e gt 1f gt Goal h g Transforms a CHR constraint of arity 6 into a CHR goal a a gt Goal ab Primitive syntactic equa
245. ise with False e SP_Close SP_Msg SP_Close close the input output streams Exported functions openPort Port a gt la Bool Opens an internal port for communication send a Port a Bool Sends a message to a port doSend a gt Port a gt I0 I O action that sends a message to a port ping Int gt Port a gt 10 Maybe Int Checks whether port p is still reachable timeoutOnStream Int a Maybe a Checks for instantiation of a stream within some amount of time openProcessPort String gt I0 Port SP_Msg Opens a new connection to a process that executes a shell command openNamedPort String I0 a Opens an external port with a symbolic name connectPortRepeat Int gt IO a gt Int gt String IO Maybe Port b Waits for connection to an external port In contrast to connectPort this action waits until the external port has been registered with its symbolic name connectPortWait String gt I0 Port a Waits for connection to an external port and return the connected port This action waits possibly forever until the external port is registered 144 connectPort String I0 Port a Connects to an external port The external port must be already registered otherwise an error is reported choiceSPEP Port SP_Msg gt a Either String a This function implements a committed choice over the receiving of messages via a stream port
246. isibility TypeDecl Visibility get visibility of type declaration typeParams TypeDecl gt Int get type parameters of type declaration typeConsDecls TypeDecl ConsDec1 264 get constructor declarations from type declaration typeSyn TypeDecl TypeExpr get synonym of type declaration isTypeSyn TypeDecl Bool is type declaration a type synonym updType String String gt String String gt Visibility Visibility gt Int gt Int ConsDec1 gt ConsDecl gt TypeExpr TypeExpr gt TypeDecl TypeDecl update type declaration updTypeName String String gt String String TypeDecl TypeDecl update name of type declaration updTypeVisibility Visibility gt Visibility gt TypeDecl gt TypeDecl update visibility of type declaration updTypeParams Int gt Int gt TypeDecl TypeDecl update type parameters of type declaration updTypeConsDecls ConsDecl gt ConsDecl TypeDecl TypeDecl update constructor declarations of type declaration updTypeSynonym TypeExpr TypeExpr gt TypeDecl gt TypeDecl update synonym of type declaration updQNamesInType String String String String TypeDecl gt TypeDecl update all qualified names in type declaration trCons String String gt Int gt Visibility TypeExpr gt a gt ConsDecl gt a transform constructor d
247. it by the constraint send Furthermore if messages containing logical variables are sent to external ports the behavior is as follows 1 The sender waits until all logical variables in the message have been bound by the receiver 2 The binding of a logical variable received by a process is sent back to the sender of this logical variable only if it is bound to a ground term i e as long as the binding contains logical variables the sender is not informed about the binding and therefore the sender waits External ports on local machines The implementation of external ports assumes that the host machine running the application is connected to the Internet i e it uses the standard IP address of the host machine for message sending If this is not the case and the application should be tested by using external ports only on the local host without a connection to the Internet the environment variable PAKCS_LOCALHOST must be set to yes before PAKCS is started In this case the IP address 127 0 0 1 and the hostname localhost are used for identifying the local machine Selection of Unix sockets for external ports The implementation of ports uses sockets to communicate messages sent to external ports Thus if a Curry program uses the I O action openNamedPort to establish an externally visible server PAKCS selects a Unix socket for the port communication Usually a free socket is selected by the operating system If the soc
248. ix operators from program updProg String gt String gt String String gt TypeDecl gt TypeDecl FuncDec1 gt FuncDecl gt OpDec1 OpDec11 gt Prog gt Prog update program updProgName String gt String gt Prog Prog 263 update name of program updProgImports String Stringl gt Prog Prog update imports of program updProgTypes TypeDec1 TypeDec1 gt Prog gt Prog update type declarations of program updProgFuncs FuncDec1 FuncDec1 gt Prog Prog update functions of program updProgOps OpDec1 gt OpDec1 gt Prog gt Prog update infix operators of program allVarsInProg Prog Int get all program variables also from patterns updProgExps Expr Expr Prog gt Prog lift transformation on expressions to program rnmAllVarsInProg Int gt Int gt Prog gt Prog rename programs variables updQNamesInProg String String String String Prog Prog update all qualified names in program rnmProg String Prog Prog rename program update name of and all qualified names in program trType String String gt Visibility Int gt ConsDecl gt a gt String String Visibility Int TypeExpr a TypeDecl gt a transform type declaration typeName TypeDecl gt String String get name of type declaration typeV
249. ket number should be fixed in an application e g because of the use of firewalls that allow only communi cation over particular sockets then one can set the environment variable PAKCS_SOCKET to a distinguished socket number before PAKCS is started This has the effect that PAKCS uses only this socket number for communication even for several external ports used in the same application program Debugging To debug distributed systems it is sometimes helpful to see all messages sent to external ports This is supported by the environment variable PAKCS_TRACEPORTS If this variable 6 is set to yes before PAKCS is started then all connections to external ports and all messages sent and received on external ports are printed on the standard error stream A 1 4 AbstractCurry and FlatCurry Meta Programming in Curry To support meta programming i e the manipulation of Curry programs in Curry there are system modules AbstractCurry Types and FlatCurry Types which define datatypes for the representation of Curry programs AbstractCurry Types is a more direct representation of a Curry program whereas FlatCurry Types is a simplified representation where local function definitions are replaced by global definitions i e lambda lifting has been performed and pattern matching is translated 54 into explicit case or expressions Thus FlatCurry Types can be used for more back end oriented program manipulations or for writ
250. l patterns that recursively depend on f 18 3 3 Order of Pattern Matching Curry allows multiple occurrences of pattern variables in standard patterns These are an abbrevi ation of equational constraints between pattern variables Functional patterns might also contain multiple occurrences of pattern variables For instance the operation f _ x _ x _ x returns all elements with at least two occurrences in a list If functional patterns as well as multiple occurrences of pattern variables occur in a pattern defining an operation there are various orders to match an expression against such an operation In the current implementation the order is as follows 1 Standard pattern matching First it is checked whether the constructor patterns match Thus functional patterns and multiple occurrences of pattern variables are ignored 2 Functional pattern matching In the next phase functional patterns are matched but occur rences of standard pattern variables in the functional patterns are ignored 3 Non linear patterns If standard and functional pattern matching is successful the equational constraints which correspond to multiple occurrences pattern variables are solved 4 Guards Finally the guards supplied by the programmer are checked The order of pattern matching should not influence the computed result However it might have some influence on the termination behavior of programs i e a program might not term
251. lFile2FlatCurry 280 xmlRead 233 XmlReads 232 xmlReads 233 xmlShow 233 XmlShows 232 xmlShows 233 XOptConv 233 XPrimConv 232 XRepConv 233 xtxt 231 yellow 157 338
252. laceChildren mapChildrenI0O a gt b b gt a gt b gt I0 b gt a gt IOa IO version of mapChildren mapFamilyI0 a gt a a gt a gt a 10a gt a gt IOa IO version of mapFamily mapChildFamiliesI0 a gt b b gt a gt b gt b b gt b gt b gt 10 b gt a gt IOa IO version of mapChildFamilies evalFamilyI0 a gt a a gt a gt a gt I0 Maybe a a gt IOa IO version of evalFamily evalChildFamiliesI0 a gt b b gt ad gt b gt b b gt b gt b gt IO Maybe b gt a gt IOa IO version of evalChildFamilies A 3 12 Library Rewriting Term Library for representation of first order terms This library is the basis of other libraries for the manipulation of first order terms e g unification of terms Therefore this library also defines other structures like term equations or positions 193 Exported types type Varldx Int Variable index identifying a variable type TermEq a Term a Term a The type of an equation type TermEqs a Term a Term a The type of multiple equations type Pos Int A position in a term represented as a list of integers Arguments are enumerated from 0 data Term Representation of a first order terms symbols e g strings Exported constructors e TermVar Int Terma TermVar i The variable with index i It
253. lationship diagrams 42 EntryScroll 118 eOpt 235 eqFM 179 equal 185 equalFilePath 97 equals 155 ERD2Curry 42 erd2curry 42 eRep 235 eRepSeqi 236 eRepSeq2 236 eRepSeq3 237 eRepSeg4 237 eRepSeg5 238 eRepSeg6 239 errorT 81 132 ES 92 eSeqi 236 321 eSeq2 236 eSeq3 237 eSeg4 237 eSeq5 238 eSeq6 238 eString 235 evalChildFamilies 193 evalChildFamiliesl0 193 evalCmd 124 evalES 92 evalFamily 192 evalFamilyl0 193 evalSpace 160 evalTime 160 evaluate 76 even 121 Event 111 exclusivel0 125 execCmd 124 exists 75 existsDBKey 128 133 135 exitGUI 117 exitWith 170 exp 101 expires 201 Expr 259 extended 88 extendSubst 195 external function 312 extSeparator 95 factorial 120 fail 60 63 failES 92 failT 81 132 faint 157 false 75 family 192 FCYPP 45 fcypp 45 fd 67 FDConstr 67 FDExpr 67 FDRel 64 FilePath 94 fileSize 83 fileSuffix 94 fill 155 fillBreak 156 fillCat 150 fillEncloseSep 152 fillEncloseSepSpaced 152 fillSep 150 filterFM 179 find 136 findall 8 100 findfirst 8 100 findIndex 136 findIndices 136 firewall 54 first 13 103 fix 103 Fixity 257 FlatCurry 54 flatCurry2Xm1 280 flatCurry2Xm1File 280 flatCurryFileName 262 flatCurryIntName 262 FlexRigidResult 281 float 154 233 floatType 250 FM 178 fmSortBy 180 fmToList 180 fmToListPreOrder 180 focusInput 118 fold 193 foldChild
254. le gt se d ptores tdi a gii betua OR Ea E oo 162 AZAT Library Read gt osc cacce ad eS a ica a e D adao Re eR HS 162 A ZAS Library Ds laneros 000 ea oe p he ee eee Ee 163 A 2 49 Library ReadShowTerm 0 0000 eee eee eee ee 164 A 2 50 Library SetFunctions ee eee ee 165 4 251 Library Socket cca ee ee a RD DR Re ee we aa 168 A262 Library es oe be a HA Ee we ee e 169 A253 Library Tim s s co le ek a a DO REM AE Ee OES 171 2 20d Library Unsale c eee eh Cea ba CRG DS a eee HEE 173 Data Structures and Algorithms gt o sac spa soa ta rema keu iesp 175 Adl Dibrary ATAY ooe s aci ee ed a a aaa Ee ee a a 175 A 3 2 Library Dequeue 176 fis Libtary FinieMap ee sde neea Cae ee heed HOE R p A a e a 178 A 3 4 Library GraphInductive e 181 230 Library Famer e aoe oroe a ic ae RA a we A we RA 187 Poe Library RedBlackiree co oo laca a de we Qs es 188 AST Library SCC o ge ene eb be eG eee Gee ee wee bade we ES 189 ae Libery SARBI 2s ah p Pa ee wk ne Gee buen Gb RS Sa BaP ae 189 ASE Library A a ee ek Pes eee Hee PG ae Re Pk Sas 190 23100 Labia Table BT ts ra ae a A De ek eo Ao 191 A311 Library Traversal o ocasion ds aci ad ee O I aha 192 Ala Library Dri SL e o i we a ee Oe ee dias 193 A 3 13 Library Rewriting Substitution a 194 A 3 14 Library Rewriting Unification ceca frou dtir eo 195 A 3 15 Library Rewriting UnificationSpec e 195 Ad Libraries tor Web Applications
255. lecting input entries in an application addCanvas WidgetRef gt CanvasItem gt GuiPort gt 10 Adds a list of canvas items to a canvas referred by the first argument popupMessage String gt 10 A simple popup message Cmd GuiPort IO ConflItem A simple event handler that can be associated to a widget The event handler takes a GUI port as parameter in order to read or write values from into the GUI Command GuiPort IO Reconfigureltem gt ConfItem An event handler that can be associated to a widget The event handler takes a GUI port as parameter in order to read or write values from into the GUI and returns a list of widget reference configuration pairs which is applied after the handler in order to configure some GUI widgets Button GuiPort I0 gt ConflItem Widget A button with an associated event handler which is activated if the button is pressed ConfigButton GuiPort gt I0 ReconfigureItem gt ConfItem gt Widget A button with an associated event handler which is activated if the button is pressed The event handler is a configuration handler see Command that allows the configura tion of some widgets TextEditScroll ConfItem Widget A text edit widget with vertical and horizontal scrollbars The argument contains the configuration options for the text edit widget ListBoxScroll Confltem Widget A list box widge
256. les in given expression updLiterals a gt Literal AExpr a AExpr a gt AExpr a update all literals in given expression updCombs a CombType gt String String a AExpr a AExpr a gt AExpr a AExpr a update all combined expressions in given expression updLets a gt Int a AExpr a AExpr a gt AExpr a gt AExpr a gt AExpr a update all let expressions in given expression updFrees a gt Int a gt AExpr a gt AExpr a gt AExpr a gt AExpr a update all free declarations in given expression updOrs a gt AExpr a gt AExpr a gt AExpr a AExpr a gt AExpr a update all or expressions in given expression 297 updCases a gt CaseType AExpr a gt ABranchExpr a AExpr a AExpr a gt AExpr a update all case expressions in given expression updBranches APattern a gt AExpr a ABranchExpr a AExpr a gt AExpr a update all case branches in given expression updTypeds a gt AExpr a gt TypeExpr AExpr a gt AExpr a gt AExpr a update all typed expressions in given expression isFuncCall AExpr a Bool is expression a call of a function where all arguments are provided isFuncPartCall AExpr a Bool is expression a partial function call isConsCall AExpr a Bool is expression a call of a constructor isConsPartCall AExpr a Bool is expression a partial constructor call isGround
257. lity on arbitrary terms a gt a gt Goal a b Primitive syntactic disequality on ground terms lt a gt a gt Goal ab Primitive less or equal constraint gt a gt a gt Goal ab Primitive greater or equal constraint lt a lt a gt Goal a b 61 Primitive less than constraint gt a gt a gt Goal ab Primitive greater than constraint ground a gt Goal a b Primitive groundness constraint useful for guards nonvar a Goal ab Primitive nonvar constraint useful for guards anyPrim Bool gt Goal ab Embed user defined primitive constraint solveCHR la CHR a b gt Goal a b gt Bool Interpret CHR rules parameterized over domain variables for a given CHR goal sec ond argument and embed this as a constraint solver in Curry If user defined CHR constraints remain after applying all CHR rules a warning showing the residual con straints is issued runCHR la gt CHR a b gt Goal a b gt b Interpret CHR rules parameterized over domain variables for a given CHR goal second argument and return the remaining CHR constraints runCHRwithTrace la gt CHR a b gt Goal a b gt b Interpret CHR rules parameterized over domain variables for a given CHR goal second argument and return the remaining CHR constraints Trace also the active and passive constraints as well as the applied rule number during computation comp
258. ll functions are parameterized with a dynamic predicate that takes an integer key as a first parameter Exported functions existsDBKey Int gt a gt Dynamic Int Query Bool Exists an entry with a given key in the database allDBKeys Int gt a gt Dynamic Query Int Query that returns all keys of entries in the database allDBInfos Int gt a Dynamic gt Query a Query that returns all infos of entries in the database allDBKeyInfos Int gt a Dynamic Query Int a Query that returns all key info pairs of the database getDBInfo Int gt a gt Dynamic gt Int Query Maybe a Gets the information about an entry in the database index a gt la gt Int 128 compute the position of an entry in a list fail if given entry is not an element sortByIndex Int a gt a Sorts a given list by associated index groupByIndex Int a gt lal Sorts a given list by associated index and group for identical index Empty lists are added for missing indexes getDBInfos Int gt a gt Dynamic gt Int Query Maybe a Gets the information about a list of entries in the database deleteDBEntry Int a Dynamic Int Transaction Deletes an entry with a given key in the database No error is raised if the given key does not exist deleteDBEntries Int gt a Dynamic Int gt Transaction Deletes all e
259. ltType 248 267 292 retract 90 returnES 92 returnT 81 132 rewriteA11 100 rewriteSome 100 rights 91 rnmAllVars 273 298 rnmAl1lVarsInFunc 269 294 rnmAllVarsInProg 264 289 rnmAllVarsInRule 270 295 rnmAllVarsInTypeExpr 267 292 rnmProg 264 289 rotate 177 round 101 row 115 rparen 154 Rule 258 ruleArgs 269 294 ruleBody 270 294 ruleExtDecl 270 294 runCgiServerCmd 211 runCHR 62 runCHRwithTrace 62 runConfigControlledGUI 116 runControlledGUI 116 runcurry 40 runFormServerWithKey 208 runFormServerWithKeyAndFormParams 208 runGUI 115 runGUIwithParams 115 runHandlesControlledGUI 116 runInitControlledGUI 116 runInitGUI 115 runInitGUIwithParams 115 runInitHandlesControlledGUI 116 runJustT 82 131 331 runNamedServer 145 runPassiveGUI 115 runQ 80 131 runT 81 131 runTNA 82 safe 15 satisfied 76 satisfy 143 scalarProduct 68 73 scan 304 scanl 139 scanl1 139 scanr 139 scanri 139 scc 189 sClose 141 169 searchPathSeparator 95 SearchTree 56 second 103 section 203 SeekMode 121 seeText 117 select 167 selection 207 selectionInitial 207 selectValue 167 semi 154 semiBraces 152 semiBracesSpaced 153 send 53 144 sendMail 212 sendMailWithOptions 212 sep 150 separatorChar 93 seqi 235 seq2 236 seq3 236 seq4 237 seq5 238 seq6 238 seqStrActions 58 sequenceMaybe 140 sequenceT 81 132 sequenceT_ 81 132 set 152
260. lue lt gt a gt Either b c gt d a gt a gt Either b c a a gt Either b d a 92 Apply a function yielded by a monadic action to a monadic value gets a Either b a a Retrieve the current state puts a gt a gt Either b a Replace the current state modify a gt a gt a gt Either b a Modify the current state mapES a gt b gt Either c d b gt la gt b gt Either c d b Map a monadic function on all elements of a list by sequencing the effects concatMapES a gt b gt Either c d b gt la gt b gt Either c d b Same as concatMap but for a monadic function mapAccumES a gt b gt c gt Either d a e c gt a gt b gt c gt Either d Ca e c Same as mapES but with an additional accumulator threaded through A 2 21 Library FileGoodies A collection of useful operations when dealing with files Exported functions separatorChar Char The character for separating hierarchies in file names On UNIX systems the value is pathSeparatorChar Char The character for separating names in path expressions On UNIX systems the value is suffixSeparatorChar Char The character for separating suffixes in file names On UNIX systems the value is isAbsolute String Bool Is the argument an absolute name dirName String String Extracts the directoy prefix of a given Unix file name Retu
261. lue _ Just value mlookup default _ Nothing Default rules are often a good replacement for negation as failure used in logic programming For instance the following program defines a solution to the n queens puzzle where the default rule is useful since it is easier to characterize the unsafe positions of the queens on the chessboard see the first rule of safe OPTIONS_CYMAKE F pgmF currypp optF defaultrules import Combinatorial permute import Integer abs A placement is safe if two queens are not in a same diagonal safe _ x ys z _ abs x z length ys 1 failed safe default xs xs A solution to the n queens puzzle is a safe permutation queens Int Int queens n safe permute 1 n 39 10 runcurry Running Curry Programs runcurry is a command usually stored in pakcshome bin where pakcshome is the installation direc tory of PAKCS see Section 1 1 This command supports the execution of Curry programs without explicitly invoking the interactive environment Hence it can be useful to write short scripts in Curry intended for direct execution The Curry program must always contain the definition of an operation main of type 10 The execution of the program consists of the evaluation of this operation Basically the command runcurry supports three modes of operation e One can execute a Curry program whose file name is provided as an argument when runcur
262. m e PlStruct String PlTerm PlTerm 161 Exported functions plList PlTerm gt PlTerm A Prolog list of Prolog terms showPlProg PlClause gt String Shows a Prolog program in standard Prolog syntax showPlClause PlClause String showPlGoals PlGoal gt String showPlGoal PlGoal String showPlTerm PlTerm String A 2 46 Library 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 Exported functions readPropertyFile String gt I0 String String Reads a property file and returns the list of properties Returns empty list if the property file does not exist updatePropertyFile String String gt String gt 10 Update a property in a property file or add it if it is not already there A 2 47 Library Read Library with some functions for reading special tokens This library is included for backward compatibility You should use the library ReadNumeric which provides a better interface for these functions 162 Exported functions readNat String Int Read a natural number in a string The string might contain leadings blanks and the the number is read up to the first non digit readInt Stri
263. m a list of Either all the Right elements in order isLeft Either a b gt Bool Return True if the given value is a Left value False otherwise isRight Either a b Bool Return True if the given value is a Right value False otherwise 91 fromLeft Either ab gt a Extract the value from a Left constructor fromRight Either a b gt b Extract the value from a Right constructor partitionEithers Either a b lal b Partitions a list of Either into two lists All the Left elements are extracted in order to the first component of the output Similarly the Right elements are extracted to the second component of the output A 2 20 Library ErrorState A combination of Error and state monad like ErrorT State in Haskell Exported types type ES a b c b gt Either a c b Error state monad Exported functions evalES a gt Either b c a gt a gt Either bc Evaluate an ES monad returnES a gt b gt Either c a b Lift a value into the ES monad failES a gt b gt Either a c b Failing computation in the ES monad gt a gt Either b c a gt c gt a gt Either b d a gt a gt Either b d a Bind of the ES monad gt a gt Either b c a gt a gt Either b d a gt a gt Either b d a Sequence operator of the ES monad lt gt a gt b gt c gt Either d a c gt c gt Either d b c Apply a pure function onto a monadic va
264. m branch expression branchPattern BranchExpr Pattern get pattern from branch expression branchExpr BranchExpr Expr get expression from branch expression updBranch Pattern gt Pattern Expr Expr BranchExpr BranchExpr update branch expression updBranchPattern Pattern Pattern gt BranchExpr BranchExpr update pattern of branch expression updBranchExpr Expr Expr BranchExpr BranchExpr update expression of branch expression trPattern String String gt Int a gt Literal gt a gt Pattern gt a transform pattern patCons Pattern String String get name from constructor pattern patArgs Pattern gt Int get arguments from constructor pattern patLiteral Pattern gt Literal get literal from literal pattern isConsPattern Pattern gt Bool is pattern a constructor pattern updPattern String String String String L Int gt Int gt Literal gt Literal Pattern Pattern update pattern updPatCons String String String String Pattern gt Pattern update constructors name of pattern updPatArgs Int gt Int gt Pattern gt Pattern update arguments of constructor pattern updPatLiteral Literal Literal gt Pattern Pattern update literal of pattern patExpr Pattern Expr build expression from pattern 274 A 5 9 Library FlatCurry Pretty This library provid
265. mbinator for parsers The returned parser repeats zero or more times a parser p with representation and returns the representation of all parsers in a list some a gt b gt b gt a gt b gt b A some combinator for parsers The returned parser repeats the argument parser with representation at least once A 2 42 Library Ports Library for distributed programming with ports This paper contains a description of the basic ideas behind this library Exported types data Port The internal constructor for the port datatype is not visible to the user Exported constructors data SP_Msg A stream port is an adaption of the port concept to model the communication with bidirectional streams i e a stream port is a port connection to a bidirectional stream e g opened by openProcessPort where the communication is performed via the fol lowing stream port messages Exported constructors e SP_Put String SP_Msg SP_Put s write the argument s on the output stream e SP_GetLine String SP_Msg SP_GetLine s unify the argument s with the next text line of the input stream e SP_GetChar Char SP_Msg SP_GetChar c Shttp www informatik uni kiel de mh papers PPDP99 html 143 unify the argument c with the next character of the input stream e SP_EOF Bool SP_Msg SP_EOF b unify the argument b with True if we are at the end of the input stream otherw
266. me ctMonth CalendarTime gt Int The month of a calendar time ctDay CalendarTime Int The day of a calendar time ctHour CalendarTime gt Int The hour of a calendar time ctMin CalendarTime Int The minute of a calendar time ctSec CalendarTime Int The second of a calendar time ctTZ CalendarTime gt Int The time zone of a calendar time The value of the time zone is the difference to UTC time in seconds getClockTime 10 ClockTime 171 Returns the current clock time getLocalTime I0 CalendarTime Returns the local calendar time clockTimeToInt ClockTime Int Transforms a clock time into a unique integer It is ensured that clock times that differs in at least one second are mapped into different integers toCalendarTime ClockTime 10 CalendarTime Transforms a clock time into a calendar time according to the local time if possible Since the result depends on the local environment it is an I O operation toUTCTime ClockTime CalendarTime Transforms a clock time into a standard UTC calendar time Thus this operationa is independent on the local time toClockTime CalendarTime ClockTime Transforms a calendar time interpreted as UTC time into a clock time calendarTimeToString CalendarTime String Transforms a calendar time into a readable form toDayString CalendarTime String Transforms a calendar time into a string containing the day
267. ments in a set Thus setn f al an returns the set of all values of f b1 bn where b1 bn are values of the arguments a1 an i e the arguments are evaluated outside this capsule so that the non determinism caused by evaluating these arguments is not captured in this capsule but yields several results for setn Similarly logical variables occuring in a1 an are not bound inside this capsule but causes a suspension until they are bound The set of values returned by a set function is represented by an abstract type Values on which several operations are defined in this module Actually it is a multiset of values i e duplicates are not removed Restrictions 1 The set is a multiset i e it might contain multiple values 165 2 The multiset of values is completely evaluated when demanded Thus if it is infinite its evaluation will not terminate even if only some elements e g for a containment test are demanded However for the emptiness test at most one value will be computed 3 The arguments of a set function are strictly evaluated before the set functions itself will be evaluated Since this implementation is restricted and prototypical the interface is not stable and might change Exported types data Values Abstract type representing multisets of values Exported constructors Exported functions setO a Values a Combinator to transform a 0 ary function into a correspon
268. mlConv Repeatable m f gt XmlConv Repeatable Elem g Creates an XML converter for repetitions of sequences represented as an XML element that can be used in repetitions A 5 Libraries for Meta Programming A 5 1 Library AbstractCurry Types 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 Note this defines a slightly new format for AbstractCurry in comparison to the first proposal of 2003 Assumption an abstract Curry program is stored in file with extension acy Exported types type MName String A module name type QName String String The data type for representing qualified names In AbstractCurry all names are qual ified to avoid name clashes The first component is the module name and the second component the unqualified name as it occurs in the source program An exception are locally defined names where the module name is the empty string to avoid name clashes with a globally defined name type CTVarIName Int String The type for representing type variables They are represented by i n where i is a type variable index which is unique inside a function and n is a name if possible the name written in the source program type CField a String String a Labeled record fields type Arity Int Function arity type CVarIName Int String 239 Data types for representing object v
269. mportDech ImportDecl no fixity declarations here BlockDeclaration BlockDeclaration y k n gt 0 ImportDecl import qualified ModuleID as ModuleID ImportRestr ImportRestr Import Importn n gt 0 hiding Import Import n gt 0 Import FunctionName TypeConstrID ConsLabelName ConsLabelName n gt 0 TypeConstrID BlockDeclaration TypeSynonymDecl DataDeclaration FixityDeclaration FunctionDeclaration TypeSynonymDecl type SimpleType TypeExpr SimpleType TypeConstrID TypeVarID TypeVarlD n gt 0 TypeConstrID see lexicon DataDeclaration data SimpleType external data type data SimpleType ConstrDecl ConstrDecl n gt 0 ConstrDecl DataConstr Simple TypeExpr Simple TypeExpr n gt 0 SimpleTypeExpr ConsOp TypeConsExpr infix data constructor DataConstr4 FieldDeclaration FieldDeclaration y n gt 0 FieldDeclaration LabelID LabelID TypeExpr n gt 0 LabelID see lexicon TypeExpr TypeConsExpr gt TypeExpr TypeConsExpr QTypeConstrID SimpleTypeExpry Simple TypeExpr n gt 0 Simple TypeExpr Simple TypeExpr TypeVarID QTypeConstrID O unit type TypeExpr TypeExpr tuple type n gt 1 TypeExpr list type TypeExpr parenthesized type 23 Type VarID FirityDeclaration FixityKeyword InfirOpID FunctionDeclaration External
270. n Erwig In this library graphs are composed and decomposed in an inductive way The key idea is as follows A graph is either empty or it consists of node context and a graph g which are put together by a constructor amp amp This constructor amp amp however is not a constructor in the sense of abstract data type but more basically a defined constructing funtion A context is a node together withe the edges to and from this node into the nodes in the graph g For examples of how to use this library cf the module GraphAlgorithms Exported types type Node Int Nodes and edges themselves in contrast to their labels are coded as integers For both of them there are variants as labeled unlabelwd and quasi unlabeled labeled with Unlabeled node type LNode a Int a Labeled node type UNode Int Quasi unlabeled node type Edge Int Int Unlabeled edge type LEdge a Int Int a Labeled edge type UEdge Int Int Quasi unlabeled edge 181 type type type type type type type type type type type data Context a b b Int Int a b Int The context of a node is the node itself along with label and its adjacent nodes Thus a context is a quadrupel for node n it is of the form edges to n node n n s label edges from n MContext a b Maybe b Int Int a b Int maybe context Context a b b Int a b Int context with ed
271. n XML element that can be used in repetitions seg2 la gt b gt c gt XmlConv d e a gt XmlConv f g b gt XmlConv NotRepeatable NoElem c Creates an XML converter representing a sequence of arbitrary XML data The se quence must not be used in repetitions and does not represent an XML element repSeg2 a b gt c XmlConv Repeatable d a gt XmlConv Repeatable e b gt Xm1Conv NotRepeatable NoElem c Creates an XML converter that represents a repetition of a sequence of repeatable XML data The repetition may be used in other repetitions and does not represent an XML element This combinator is provided because converters for repeatable sequences cannot be constructed by the seq combinators eSeq2 String gt a gt b gt c gt XmlConv d e a gt XmlConv f g b gt XmlConv Repeatable Elem c Creates an XML converter for compound values represented as an XML element with children that correspond to the values components The element can be used in repe titions eRepSeq2 String gt a gt b gt c gt XmlConv Repeatable d a gt XmlConv Repeatable e b gt XmlConv Repeatable Elem c Creates an XML converter for repetitions of sequences represented as an XML element that can be used in repetitions seg3 a gt b gt c gt d gt XmlConv e f a gt XmlConv g h b gt XmlConv i j c gt Xml1Conv NotRepeatable NoElem d Creates an XML converter representing a seq
272. nd does not represent an XML element repSeq4 a b c d gt e XmlConv Repeatable f a gt XmlConv Repeatable g b XmlConv Repeatable h c XmlConv Repeatable i d gt XmlConv NotRepeatable NoElem e Creates an XML converter that represents a repetition of a sequence of repeatable XML data The repetition may be used in other repetitions and does not represent an XML element This combinator is provided because converters for repeatable sequences cannot be constructed by the seq combinators eSeq4 String gt a gt b gt c gt d gt e gt XmlConv f g a gt XmlConv h i b gt XmlConv j k c XmlConv 1 m d gt XmlConv Repeatable Elem e Creates an XML converter for compound values represented as an XML element with children that correspond to the values components The element can be used in repe titions eRepSeq4 String gt a gt b gt c gt d gt e XmlConv Repeatable f a gt XmlConv Repeatable g b XmlConv Repeatable h c gt XmlConv Repeatable i d gt XmlConv Repeatable Elem e Creates an XML converter for repetitions of sequences represented as an XML element that can be used in repetitions 237 seq5 a lt b gt c gt d gt e f gt XmlConv g ha gt XmlConv i j b gt XmlConv k 1 c XmlConv m n d gt XmlConv o p e XmlConv NotRepeatable NoElem f Creates an XML converter representing a sequence of arbitrary XML data The se
273. nd rule is applied only if there is no appropriate key in the association list 38 OPTIONS_CYMAKE F pgmF currypp optF seqrules mlookup key _ key value _ Just value mlookup _ Nothing 9 3 Default Rules An alternative to sequential rules are default rules i e these two options cannot be simultaneously used Default rules are activated by the preprocessor option defaultrules In this case one can add to each operation a default rule A default rule for a function f is defined as a rule defining the operation f default this mechanism avoids any language extension for default rules A default rule is applied only if no standard rule is applicable either because the left hand sides pattern do not match or the conditions are not satisfiable Default rules are preferable over the sequential rule selection strategy since they have a better operational behavior This is due to the fact that the test for the application of default rules is done with the same sometimes optimal strategy than the selection of standard rules Moreover default rules provide a similar power than sequential rules i e they can be applied if the standard rules have complex functional patterns or complex conditions As a simple example we show the implementation of the previous example for sequential rules with a default rule OPTIONS_CYMAKE F pgmF currypp optF defaultrules mlookup key _ key va
274. ndParams Maybe String Returns the full path parameter of the front end htmldir FrontendParams Maybe String Returns the htmldir parameter of the front end logfile FrontendParams Maybe String Returns the logfile parameter of the front end specials FrontendParams String Returns the special parameters of the front end 88 callFrontend FrontendTarget String 10 In order to make sure that compiler generated files like fcy fint acy are up to date one can call the front end of the Curry compiler with this action If the front end returns with an error an exception is raised callFrontendWithParams FrontendTarget FrontendParams String 10 In order to make sure that compiler generated files like fcy fint acy are up to date one can call the front end of the Curry compiler with this action where various parameters can be set If the front end returns with an error an exception is raised A 2 18 Library Dynamic Library for dynamic predicates _dyn html gt This paper contains a description of the basic ideas behind this library Currently it is still experimental so that its interface might be slightly changed in the future A dynamic predicate p with arguments of type t1 tn must be declared by p ti gt gt tn gt Dynamic p dynamic A dynamic predicate where all facts should be persistently stored in the directory DIR must be declared by
275. ng Int Read a possibly negative integer in a string The string might contain leadings blanks and the the integer is read up to the first non digit readHex String Int Read a hexadecimal number in a string The string might contain leadings blanks and the the integer is read up to the first non heaxdecimal digit A 2 48 Library ReadNumeric Library with some functions for reading and converting numeric tokens Exported functions readInt String Maybe Int String Read a possibly negative integer as a first token in a string The string might contain leadings blanks and the integer is read up to the first non digit If the string does not start with an integer token Nothing is returned otherwise the result is Just v s where v is the value of the integer and s is the remaing string without the integer token readNat String Maybe Int String Read a natural number as a first token in a string The string might contain leadings blanks and the number is read up to the first non digit If the string does not start with a natural number token Nothing is returned otherwise the result is Just v s where v is the value of the number and s is the remaing string without the number token readHex String Maybe Int String Read a hexadecimal number as a first token in a string The string might contain leadings blanks and the number is read up to the first non hexadecimal digit If the string does not
276. ng gt String I0 Int String String Executes a command with the given arguments as a new default shell process and provides the input via the process stdin input stream The exit code of the process and the contents written to the standard I O streams stdout and stderr are returned connectToCommand String 10 Handle Executes a command with a new default shell process The input and output streams of the new process is returned as one handle which is both readable and writable Thus writing to the handle produces input to the process and output from the process can be retrieved by reading from this handle The handle should be closed with I0 hClose since they are not closed automatically when the process terminates 124 readCompleteFile String 10 String An action that reads the complete contents of a file and returns it This action can be used instead of the lazy readFile action if the contents of the file might be changed updateFile String gt String String gt I0 An action that updates the contents of a file exclusivel0 String gt IO a gt IO a Forces the exclusive execution of an action via a lock file For instance exclusivelO myaction lock act ensures that the action act is not executed by two processes on the same system at the same time setAssoc String String gt I0 Defines a global association between two strings Both arguments must be evaluable to
277. non local variables A 2 9 Library CLPB This library provides a Boolean Constraint Solver based on BDDs Exported types data Boolean Exported constructors 74 Exported functions true Boolean The always satisfied constraint false Boolean The never satisfied constraint neg Boolean Boolean Result is true iff argument is false amp amp Boolean gt Boolean gt Boolean Result is true iff both arguments are true C I Boolean Boolean Boolean Result is true iff at least one argument is true Boolean Boolean Boolean Result is true iff exactly one argument is true Boolean Boolean Boolean Result is true iff both arguments are equal lt Boolean Boolean Boolean Result is true iff the first argument implies the second gt Boolean gt Boolean Boolean Result is true iff the second argument implies the first lt Boolean gt Boolean Boolean Result is true iff the first argument is false and the second is true gt Boolean gt Boolean Boolean Result is true iff the first argument is true and the second is false count Boolean gt Int gt Boolean Result is true iff the count of valid constraints in the first list is an element of the second list exists Boolean Boolean Boolean Result is true if the first argument is a variable which can be instantiated such that the second argum
278. nsaction type such that it can be composed with other transactions Run time errors that occur during the execution of the given query are transformed into transaction errors returnT a Transaction a Returns the given value in a transaction that does not access the database doneT Transaction Returns the unit value in a transaction that does not access the database Useful to ignore results when composing transactions errorT TError Transaction a Aborts a transaction with an error failT String Transaction a Aborts a transaction with a user defined error message l gt gt Transaction a gt a gt Transaction b gt Transaction b Combines two transactions into a single transaction that executes both in sequence The first transaction is executed its result passed to the function which computes the second transaction which is then executed to compute the final result If the first transaction is aborted with an error the second transaction is not executed l gt gt Transaction a gt Transaction b gt Transaction b Combines two transactions to execute them in sequence The result of the first trans action is ignored sequenceT Transaction a Transaction a Executes a list of transactions sequentially and computes a list of all results sequenceT_ Transaction a Transaction Executes a list of transactions sequentially ignoring their results mapT a Transaction b
279. nt dquote contains a double quote semi Doc The document semi contains a semi colon 154 colon Doc The document colon contains a colon comma Doc The document comma contains a comma space Doc The document space contains a single space x lt gt y x lt gt space lt gt y dot Doc The document dot contains a single dot backslash Doc The document backslash contains a back slash equals Doc The document equals contains an equal sign larrow Doc The document larrow contains a left arrow sign lt rarrow Doc The document rarrow contains a right arrow sign gt doubleArrow Doc The document doubleArrow contains an double arrow sign gt doubleColon Doc The document doubleColon contains a double colon sign bar Doc The document bar contains a vertical bar sign at Doc The document at contains an at sign tilde Doc The document tilde contains a tilde sign fill Int Doc gt Doc 155 The document fi11 i d renders document d It than appends spaces until the width is equal to i If the width of d is already larger nothing is appended This combinator is quite useful in practice to output a list of bindings The following example demonstrates this types empty Doc nest Int gt Doc gt Doc linebreak Doc ptype name tp fill 6 text name lt gt text lt gt
280. nto a Curry program by the command erd2curry t myerd term The directory pakcshome currytools erd2curry contains two examples for such ERD term files Blog erdterm This is a simple ERD model for a blog with entries comments and tags Uni erdterm This is an ERD model for university lectures as presented in the paper 13 There is also the possibility to visualize an ERD term as a graph with the graph visualization program dotty for this purpose it might be necessary to adapt the definition of dotviewcommand in your pakcsrc file see Section 2 6 according to your local environment The visualization can be performed by the command erd2curry v myerd term 42 12 Spicey An ER based Web Framework Spicey is a framework to support the implementation of web based systems in Curry Spicey generates an initial implementation from an entity relationship ER description of the underlying data The generated implementation contains operations to create and manipulate entities of the data model supports authentication authorization session handling and the composition of individual operations to user processes Furthermore the implementation ensures the consistency of the database w r t the data dependencies specified in the ER model i e updates initiated by the user cannot lead to an inconsistent state of the database The idea of this tool which is part of the distribution of PAKCS is described in detail in 21 Thus we de
281. ntries with the given keys in the database No error is raised if some of the given keys does not exist updateDBEntry Int gt a Dynamic Int gt a Transaction Overwrites an existing entry in the database newDBEntry Int gt a gt Dynamic gt a gt Transaction Int Stores a new entry in the database and return the key of the new entry newDBKeyEntry Int a Dynamic Int gt a Transaction Stores a new entry in the database under a given key The transaction fails if the key already exists cleanDB Int gt a Dynamic gt Transaction Deletes all entries in the database A 2 36 Library 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 This module reimplements the interface of the module KeyDatabase based on the SQLite database engine In order to use it you need to have sqlite3 in your PATH environment variable or adjust the value of the constant path lt code gt to lt code gt sqlite3 Programs that use the KeyDatabase module can be adjusted to use this module instead by re placing the imports of Dynamic Database and KeyDatabase with this module and changing the 129 declarations of datab
282. nts updRuleBody Expr Expr Rule Rule update rules body updRuleExtDecl String String Rule Rule update rules external declaration allVarsInRule Rule gt Int get variable names in a functions rule rnmAllVarsInRule Int gt Int gt Rule gt Rule rename all variables in rule updQNamesInRule String String String String Rule Rule update all qualified names in rule trCombType a gt Int gt a gt a gt Int gt a gt CombType gt a transform combination type isCombTypeFuncCall CombType Bool is type of combination FuncCall isCombTypeFuncPartCall CombType Bool is type of combination FuncPartCall isCombTypeConsCall CombType Bool 270 is type of combination ConsCall isCombTypeConsPartCall CombType Bool is type of combination ConsPartCall missingArgs CombType Int varNr Expr Int get internal number of variable literal Expr Literal get literal if expression is literal expression combType Expr gt CombType get combination type of a combined expression combName Expr gt String String get name of a combined expression combArgs Expr Expr get arguments of a combined expression missingCombArgs Expr Int get number of missing arguments if expression is combined letBinds Expr Int Expr get indices of variables in let declaration letBody Expr Expr get body of let de
283. oaded are searched in the following directories in this order i e the first occurrence of a module file in this search path is imported 1 Current working directory or directory prefix of the main module e g directory home joe curryprogs if one loads the Curry program home joe curryprogs main 2 The directories enumerated in the environment variable CURRYPATH 6 3 The directories enumerated in the pakcsrc variable libraries 4 The directory pakcshome 1ib The same strategy also applies to modules with a hierarchical module name with the only difference that the hierarchy prefix of a module name corresponds to a directory prefix of the module For instance if the main module is stored in directory MAINDIR and imports the module Test Func then the module stored in MAINDIR Test Func curry is imported without setting any additional import path according to the module search strategy described above Note that the standard prelude pakcshome 1ib Prelude curry will be always implicitly im ported to all modules if a module does not contain an explicit import declaration for the module Prelude 2 PAKCS An Interactive Curry Development System PAKCS is an interactive system to develop applications written in Curry It is implemented in Prolog and compiles Curry programs into Prolog programs It contains various tools a source level debugger solvers for arithmetic constraints over r
284. of a name and an extension for that file type If the user chooses an existing file she he will asked to confirm to 9999 overwrite it The file with its full path name will be returned or if the user cancels the selection chooseColor IO String Pops up a GUI dialog box to select a color The name of the color will be returned or 9999 if the user cancels the selection A 2 31 Library 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 Exported functions C Int gt Int gt Int The value of a bis a raised to the power of b Fails if b amp 1t 0 Executes in O log b steps pow Int gt Int gt Int The value of pow a b is a raised to the power of b Fails if b amp 1t 0 Executes in O log b steps ilog Int gt Int 119 The value of ilog n is the floor of the logarithm in the base 10 of n Fails if n amp 1t 0 For positive integers the returned value is 1 less the number of digits in the decimal representation of n isqrt Int Int The value of isqrt n is the floor of the square root of n Fails if n amp 1t 0 Executes in O log n steps but there must be a better way factorial Int gt Int The value of factorial n is the factorial of n Fails ifn amp 1t 0 binomial Int Int Int The value of binomial n mis n n 1 n m 1 m m 1
285. of a successful parse the result is a one element list containing a pair of the data term and the remaining un parsed string readQTerm String gt a Transforms a string containing a term in standard prefix notation with qualified con structor names into the corresponding data term readQTermFile String gt IO a Reads a file containing a string representation of a term in standard prefix notation and returns the corresponding data term readQTermListFile String gt I0 a Reads a file containing lines with string representations of terms of the same type and returns the corresponding list of data terms writeQTermFile String gt a gt 10 Writes a ground term into a file in standard prefix notation writeQTermListFile String la gt I0 Writes a list of ground terms into a file Each term is written into a separate line which might be useful to modify the file with a standard text editor A 2 50 Library SetFunctions This module contains an implementation of set functions The general idea of set functions is described in S Antoy M Hanus Set Functions for Functional Logic Programming Proc 11th Inter national Conference on Principles and Practice of Declarative Programming PPDP 09 pp 73 82 ACM Press 2009 Intuition If f is an n ary function then setn f is a set valued function that collects all non determinism caused by f but not the non determinism caused by evaluating argu
286. of using the curly brackets and semicolons of the context free syntax a Curry programmer must specify these lists by indentation the indentation of a list of syntactic entities after let where do or of is the indentation of the next symbol following the let where do of Any item of this list start with the same indentation as the list Lines with only whitespaces or an indentation greater than the indentation of the list continue the item in its previous line Lines with an indentation less than the indentation of the list terminate the entire list Moreover a list started by let is terminated by the keyword in Thus the sentence fx hxwhere gy yti hz gz 2 which is valid w r t the context free syntax is written with the layout rules as fx hx where g y y 1 hz g2z 2 or also as f hx where e z g z 2 mp og gt To avoid an indentation of top level declarations the keyword module and the end of file token are assumed to start in column 0 In order to determine the exact column number we assume a fixed width font with tab stops at each 8th column 22 4 4 Context Free Grammar Module module ModuleID Exports where Block Block ModuleID see lexicon Exports Export Exportn Export QFunctionName QTypeConstrID ConsLabelName QTypeConstrID module ModuleID ConsLabelName gt n gt 0 ConsLabelName LabellD DataConstr Block I
287. okieParam e CookieDomain String CookieParam e CookiePath String CookieParam e CookieSecure CookieParam data HtmlPage The data type for representing HTML pages The constructor arguments are the title the parameters and the contents body of the web page Exported constructors e HtmlPage String PageParam gt HtmlExp HtmlPage 199 data PageParam The possible parameters of an HTML page Exported constructors e PageEnc String PageParam PageEnc the encoding scheme of this page e PageCSS String PageParam PageCsSS s a URL for a CSS file for this page e PageJScript String PageParam PageJScript s a URL for a Javascript file for this page e PageMeta String String PageParam PageMeta as meta information in form of attributes for this page e PageLink String String PageParam PageLink as link information in form of attributes for this page e PageBodyAttr String String PageParam PageBodyAttr attr optional attribute for the body element of the page more than one occurrence is allowed Exported functions defaultEncoding String The default encoding used in generated web pages idOfCgiRef CgiRef String Internal identifier of a CgiRef intended only for internal use in other libraries formEnc String FormParam An encoding scheme for a HTML form formCSS String FormPa
288. ombined expressions in given expression 272 updLets Int Expr Expr Expr gt Expr Expr update all let expressions in given expression updFrees Int gt Expr Expr gt Expr Expr update all free declarations in given expression updOrs Expr gt Expr Expr gt Expr Expr update all or expressions in given expression updCases CaseType Expr BranchExpr Expr Expr Expr update all case expressions in given expression updBranches Pattern Expr BranchExpr Expr Expr update all case branches in given expression updTypeds Expr gt TypeExpr Expr Expr Expr update all typed expressions in given expression isFuncCall Expr Bool is expression a call of a function where all arguments are provided isFuncPartCall Expr Bool is expression a partial function call isConsCall Expr Bool is expression a call of a constructor isConsPartCall Expr Bool is expression a partial constructor call isGround Expr Bool is expression fully evaluated allVars Expr gt Int get all variables also pattern variables in expression rnmAllVars Int gt Int gt Expr gt Expr rename all variables also in patterns in expression updQNames String String gt String String Expr gt Expr update all qualified names in expression 273 trBranch Pattern Expr gt a gt BranchExpr gt a transfor
289. ompactFlatCurryFile Option gt String String gt I0 Computes a single FlatCurry program containing all functions potentially called from a set of main functions and writes it into a FlatCurry file This is done by merging all imported FlatCurry modules and removing the imported functions that are definitely not used 282 computeCompactFlatCurry Option gt String I0 Prog Computes a single FlatCurry program containing all functions potentially called from a set of main functions This is done by merging all imported FlatCurry modules these are loaded demand driven so that modules that contains no potentially called functions are not loaded and removing the imported functions that are definitely not used A 5 15 Library FlatCurry Annotated Types 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 For more information about the abstract syntax tree of FlatCurry see the documentation of the respective module Exported types type Arity Int Arity of a function declaration data AProg Annotated FlatCurry program corresponds to a module Exported constructors e AProg String gt String TypeDecl AFuncDecl a gt OpDec1 gt AProg a data AFuncDecl Annotated f
290. on This datatype defines options to control the instantiation of FD variables in the solver solveFD Exported constructors LeftMost Option LeftMost The leftmost variable is selected for instantiation default FirstFail Option FirstFail The leftmost variable with the smallest domain is selected also known as first fail prin ciple FirstFailConstrained Option FirstFailConstrained The leftmost variable with the smallest domain and the most constraints on it is selected Min Option Min The leftmost variable with the smalled lower bound is selected Max Option Max The leftmost variable with the greatest upper bound is selected Step Option Step Make a binary choice between x b and x b for the selected variable x where b is the lower or upper bound of x default Enum Option Enum Make a multiple choice for the selected variable for all the values in its domain 65 Bisect Option Bisect Make a binary choice between x amp 1t m and x amp gt m for the selected variable x where m is the midpoint of the domain x also known as domain splitting Up Option Up The domain is explored for instantiation in ascending order default Down Option Down The domain is explored for instantiation in descending order All Option All Enumerate all solutions by backtracking default Minimize Int Option Minimize v
291. ons TypeExpr Bool is type declaration a constructed type isFuncType TypeExpr Bool is type declaration a functional type updTVars Int TypeExpr TypeExpr TypeExpr 291 update all type variables updTCons String String TypeExpr TypeExpr gt TypeExpr TypeExpr update all type constructors updFuncTypes TypeExpr TypeExpr TypeExpr TypeExpr TypeExpr update all functional types argTypes TypeExpr TypeExpr get argument types from functional type resultType TypeExpr TypeExpr get result type from nested functional type rnmAllVarsInTypeExpr Int gt Int gt TypeExpr TypeExpr rename variables in type expression updQNamesInTypeExpr String String gt String String TypeExpr gt TypeExpr update all qualified names in type expression trOp String String gt Fixity gt Int gt a gt OpDecl gt a transform operator declaration opName OpDecl gt String String get name from operator declaration opFixity OpDecl Fixity get fixity of operator declaration opPrecedence OpDecl Int get precedence of operator declaration updOp String String String String gt Fixity gt Fixity gt Int gt Int OpDecl OpDecl update operator declaration updOpName String String gt String String OpDecl gt OpDecl update name of operator declaration updOpFixit
292. or character attributes Character attributes must not be used in repetitions and do not represent XML elements aString String XmlConv NotRepeatable NoElem String 234 Creates an XML converter for string attributes String attributes must not be used in repetitions and do not represent XML elements aBool String String String XmlConv NotRepeatable NoElem Bool Creates an XML converter for boolean attributes Boolean attributes must not be used in repetitions and do not represent XML elements eInt String XmlConv Repeatable Elem Int Creates an XML converter for integer elements Integer elements may be used in repe titions eFloat String XmlConv Repeatable Elem Float Creates an XML converter for float elements Float elements may be used in repetitions eChar String XmlConv Repeatable Elem Char Creates an XML converter for character elements Character elements may be used in repetitions eString String XmlConv Repeatable Elem String Creates an XML converter for string elements String elements may be used in repeti tions eBool String String XmlConv Repeatable Elem Bool Creates an XML converter for boolean elements Boolean elements may be used in repetitions eEmpty String a XmlConv Repeatable Elem a pry 8 P Takes a name and a value and creates an empty XML element that represents the given value The created element may be used in repetitions
293. orm In addition to wui2html we can provide a skeleton form used to show illegal inputs A 4 10 Library XML Library for processing XML data Warning the structure of this library is not stable and might be changed in the future Exported types data XmlExp The data type for representing XML expressions Exported constructors e XText String XmlExp XText a text string PCDATA e XElem String gt String String XmlExp gt XmlExp XElem an XML element with tag field attributes and a list of XML elements as contents data Encoding The data type for encodings used in the XML document Exported constructors e StandardEnc Encoding e Iso88591Enc Encoding data XmlDocParams 230 The data type for XML document parameters Exported constructors e Enc Encoding XAmlDocParams Enc the encoding for a document e DtdUrl String XmlDocParams DtdUrl the url of the DTD for a document Exported functions tagOf XmlExp String Returns the tag of an XML element or empty for a textual element elemsOf XmlExp gt XmlExp Returns the child elements an XML element textOf XmlExp gt String Extracts the textual contents of a list of XML expressions Useful auxiliary function when transforming XML expressions into other data structures For instance textOf XText xy XElem a XText bc xy bc textOfXml Xml
294. orms the normal form of a term into a string representation in stan dard prefix notation Thus showAnyTerm evaluates its argument to normal form This function is similar to the function ReadShowTerm showTerm but it also transforms logic variables into a string representation that can be read back by Unsafe read s AnyUnqualifiedTerm Thus the result depends on the evaluation and binding status of logic variables so that it should be used with care showAnyQTerm a String Transforms the normal form of a term into a string representation in standard prefix notation Thus showAnyQTerm evaluates its argument to normal form This function is similar to the function ReadShowTerm showQTerm but it also transforms logic variables into a string representation that can be read back by Unsafe read s AnyQTerm Thus the result depends on the evaluation and binding status of logic variables so that it should be used with care readsAnyUnqualifiedTerm String gt String gt a String Transform a string containing a term in standard prefix notation without module qual ifiers into the corresponding data term The string might contain logical variable en codings produced by showAnyTerm In case of a successful parse the result is a one element list containing a pair of the data term and the remaining unparsed string readAnyUnqualifiedTerm String String gt a Transforms a string containing a term in standard prefix notation wit
295. orresponding right hand sides and a list of local declarations 242 Exported constructors e CSimpleRhs CExpr gt CLocalDec1 CRhs e CGuardedRhs CExpr CExpr gt CLocalDec1 CRhs data CLocalDecl Data type for representing local let where declarations Exported constructors e CLocalFunc CFuncDecl CLocalDecl e CLocalPat CPattern CRhs CLocalDecl e CLocalVars Int String CLocalDecl data CPattern Data type for representing pattern expressions Exported constructors e CPVar Int String gt CPattern e CPLit CLiteral CPattern e CPComb String String CPattern CPattern e CPAs Int String CPattern CPattern e CPFuncComb String String CPattern CPattern e CPLazy CPattern CPattern e CPRecord String String gt String String CPattern CPattern data CExpr Data type for representing Curry expressions Exported constructors e CVar Int String CExpr e CLit CLiteral CExpr CSymbol String String gt CExpr CApply CExpr CExpr CExpr CLambda CPattern CExpr gt CExpr 243 CLetDecl CLocalDecl CExpr CExpr CDoExpr CStatement CExpr CListComp CExpr gt CStatement gt CExpr e CCase CCaseType gt CExpr CPattern CRhs gt CExpr CTyped CExpr CTypeExpr CExpr CRecConstr String String
296. ound in a2 intersectFM FM a b gt FMa b gt Mab Filters only those keys that are bound in both of the given maps The elements will be taken from the second map intersectFM_C a gt b c FM d a FM d b gt FMd c Filters only those keys that are bound in both of the given maps and combines the elements as in addToFM_C foldFM a gt b gt c gt c gt c FMaboc Folds finite map by given function mapFM a gt b gt c FMa b gt Mac Applies a given function on every element in the map filterFM a gt b gt Bool gt FMa b gt Mab Yields a new finite map with only those key element pairs matching the given predicate sizeFM FM ab gt Int How many elements does given map contain eqFM FM ab FM a b gt Bool Do two given maps contain the same key element pairs 179 isEmptyFM FM a b gt Bool Is the given finite map empty elemFM a gt FM a b gt Bool Does given map contain given key lookupFM FM a b gt a Maybe b Retrieves element bound to given key lookupWithDefaultFM FM a b gt b gt a gt b Retrieves element bound to given key If the element is not contained in map return default value keyOrder FM a b gt a gt a Bool Retrieves the ordering on which the given finite map is built minFM FM a b Maybe a b Retrieves the smallest key element pair in the finite map according to the basic key ordering maxFM
297. ow the source text of module m which must be accessible via the current load path source f Show the source code of function f which must be visible in the currently loaded module in a separate window source m f Show the source code of function f defined in module m in a separate window cd dir Change the current working directory to dir dir Show the names of all Curry programs in the current working directory 11 emd Shell escape execute cmd in a Unix shell save Save the currently loaded program as an executable evaluating the main expression main The executable is stored in the file Mod if Mod is the name of the currently loaded main module it save expr Similar as save but the expression expr typically a call to the main function will be evaluated by the executable fork expr The expression expr which must be of type IO O is evaluated in an independent process which runs in parallel to the current PAKCS process All output and error messages from this new process are suppressed This command is useful to test distributed Curry programs see Appendix A 1 3 where one can start a new server process by this command The new process will be terminated when the evaluation of the expression expr is finished coosy Start the Curry Object Observation System COOSy a tool to observe the execution of
298. parts enclosed in e small comment from to the end of a line e text a string i e text enclosed in e letter the given string is the representation of a character e meta containing information for meta programming For an example to use the state scanner cf addtypes the tool to add function types to a given program Exported types type Tokens Token data Token The different categories to classify the source code Exported constructors e SmallComment String Token e BigComment String Token e Text String Token e Letter String Token e Code String Token e ModuleHead String Token e Meta String Token 303 Exported functions isSmallComment Token Bool test for category SmallComment isBigComment Token Bool test for category BigComment isComment Token Bool test if given token is a comment big or small isText Token Bool test for category Text String isLetter Token Bool test for category Letter Char isCode Token Bool test for category Code isModuleHead Token Bool test for category ModuleHead ie imports and operator declarations isMeta Token Bool test for category Meta ie between and scan String gt Token Divides the given string into the six categories For applications it is important to know whether a
299. pes data Option Options to guide the compactification process Exported constructors e Verbose Option Verbose for more output e Main String gt Option Main 281 data optimize for one main unqualified function supplied here Exports Option Exports optimize w r t the exported functions of the module only InitFuncs String String Option InitFuncs optimize w r t given list of initially required functions Required RequiredSpec Option Required list of functions that are implicitly required and thus should not be deleted if the corresponding module is imported Import String Option Import module that should always be imported useful in combination with option InitFuncs RequiredSpec Data type to specify requirements of functions Exported constructors Exported functions requires String String String String RequiredSpec fun requires reqfun specifies that the use of the function fun implies the application of function reqfun alwaysRequired String String RequiredSpec alwaysRequired fun specifies that the function fun should be always present if the corresponding module is loaded defaultRequired RequiredSpec Functions that are implicitly required in a FlatCurry program since they might be generated by external functions like or on the fly generateC
300. ppConsExports Options gt ConsDecl Doc pretty print the export list of constructors ppFuncExports Options FuncDecl gt Doc pretty print the export list of functions ppImports Options String Doc pretty print a list of import statements ppImport Options String Doc pretty print a single import statement ppOpDecls Options gt OpDec1 Doc pretty print a list of operator fixity declarations ppOpDecl Options gt OpDecl Doc 276 pretty print a single operator fixity declaration ppFixity Fixity Doc pretty print the associativity keyword ppTypeDecls Options TypeDecl gt Doc pretty print a list of type declarations ppTypeDecl Options TypeDecl Doc pretty print a type declaration ppConsDecls Options ConsDec1 Doc pretty print the constructor declarations ppConsDecl Options gt ConsDecl Doc pretty print a single constructor ppTypeExp Options gt TypeExpr Doc pretty a top level type expression ppTypeExpr Options Int TypeExpr Doc pretty print a type expression ppTVarIndex Int Doc pretty print a type variable ppFuncDecls Options FuncDecl gt Doc pretty print a list of function declarations ppFuncDecl Options FuncDecl Doc pretty print a function declaration ppRule Options Rule Doc pretty print a function rule ppExp Options Expr Doc Pretty prin
301. pr BranchExpr data Pattern Data type for representing patterns in case expressions Exported constructors e Pattern String String Int Pattern e LPattern Literal Pattern data Literal Data type for representing literals occurring in an expression or case branch It is either an integer a float or a character constant Exported constructors e Intc Int gt Literal e Floatc Float Literal e Charc Char Literal Exported functions showQNameInModule String gt String String String Translates a given qualified type name into external name relative to a module Thus names not defined in this module except for names defined in the prelude are prefixed with their module name 261 A 5 7 Library FlatCurry Files This library supports meta programming i e the manipulation of Curry programs in Curry This library defines I O actions Exported functions readFlatCurry String 10 Prog I O action which parses a Curry program and returns the corresponding FlatCurry program Thus the argument is the module path without suffix curry or lcurry and the result is a FlatCurry term representing this program readFlatCurryWithParseOptions String FrontendParams 10 Prog I O action which parses a Curry program with respect to some parser options and returns the corresponding FlatCurry program This I O action is used by the standard action readFla
302. prog_pe fcy The latter program is implicitly loaded by the peval command so that the partially evaluated program is directly available The corresponding source program can be shown by the show command see above The current partial evaluator is an experimental prototype so it might not work on all programs based on the ideas described in 1 2 3 4 2 3 Options of PAKCS The following options which can be set by the command set are currently supported debug Debug mode In the debug mode one can trace the evaluation of an expression setting spy points break points etc see the commands for the debug mode described below 12 free Free variable mode If the free variable mode is off default then free variables occur ring in initial expressions entered in the PAKCS environment must always be declared by where free This avoids the introduction of free variables in initial expressions by typos which might lead to the exploration of infinite search spaces If the free variable mode is on each undefined symbol occurring in an initial expression is considered as a free variable In this case the syntax of accepted initial expressions is more restricted In particular lambda abstractions lets and list comprehensions are not allowed if the free variable mode is on printfail Print failures If this option is set failures occurring during evaluation i e non
303. pted for Curry by Bjoern Peemoeller c Sven Panne 2002 2005 The Glasgow Haskell Compiler License Copyright 2004 The University Court of the University of Glasgow All rights reserved Redistribution and use in source and binary forms with or without modification are permitted provided that the following conditions are met this list of conditions and the following disclaimer this list of conditions and the following disclaimer in the documentation and or other materials provided with the distribution used to endorse or promote products derived from this software without specific prior written permission THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW AND THE CONTRIBUTORS AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED IN NO EVENT SHALL THE UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT INDIRECT INCIDENTAL SPE CIAL EXEMPLARY OR CONSEQUENTIAL DAMAGES INCLUDING BUT NOT LIMITED TO PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES LOSS OF USE DATA OR PROFITS OR BUSINESS INTERRUPTION HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY WHETHER IN CONTRACT STRICT LIABILITY OR TORT INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS SOFT WARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE Exported types data
304. quence must not be used in repetitions and does not represent an XML element repSegb a gt b gt c gt d gt e f gt XmlConv Repeatable g a gt XmlConv Repeatable h b XmlConv Repeatable i c XmlConv Repeatable j d gt XmlConv Repeatable k e gt XmlConv NotRepeatable NoElem f Creates an XML converter that represents a repetition of a sequence of repeatable XML data The repetition may be used in other repetitions and does not represent an XML element This combinator is provided because converters for repeatable sequences cannot be constructed by the seq combinators eSeq5 String gt a gt b gt c gt d gt e gt f gt XmlConv g h a XmlConv i j b XmlConv k 1 c XmlConv m n d gt XmlConv o p e gt XmlConv Repeatable Elem f Creates an XML converter for compound values represented as an XML element with children that correspond to the values components The element can be used in repe titions eRepSeq5 String gt a gt b gt c gt d gt e gt f gt XmlConv Repeatable g a gt XmlConv Repeatable h b XmlConv Repeatable i c gt XmlConv Repeatable j d XmlConv Repeatable k e XmlConv Repeatable Elem f Creates an XML converter for repetitions of sequences represented as an XML element that can be used in repetitions seq6 a gt b gt c gt d gt e gt f gt g gt XmlConv h i a gt XmlConv j k b gt XmlConv
305. r Infers the types of a group of possibly mutually recursive functions Note that the functions are only monomorphically instantiated i e polymorphic recursion is not sup ported The given type may be too general for instance a type variable only and will be specialised to the inferred type inferExpr Prog gt Expr gt I0 Either String AExpr TypeExpr inferProgEnv FM String String TypeExpr Prog Either String AProg TypeExpr Infers the type of a whole program Uses the given type environment instead of gener ating a new one inferFunctionEnv FM String String TypeExpr String String Prog gt Either String AFuncDecl TypeExpr Infers the types of a single function specified by its qualified name Uses the given type environment instead of generating a new one 302 getTypeEnv Prog gt IO FM String String TypeExpr Extract the type environment from the given Prog getTypeEnvFromProgEnv String Prog Prog Either String FM String String TypeExpr Extract the type environment from the given Prog by lookup in a module name gt Prog environment A 5 20 Library 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 e moduleHead module interface imports operators e code the part where the actual program is defined e big comment
306. r String Transforms a transaction error into a string A 2 37 Library 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 Remark This library has been revised to the library KeyDatabase Thus it might not be further supported in the future 134 Exported functions existsDBKey Int gt a Dynamic Int gt I0 Bool Exists an entry with a given key in the database allDBKeys Int gt a Dynamic gt 10 Int Returns all keys of entries in the database getDBInfo Int gt a gt Dynamic gt Int gt I0 a Gets the information about an entry in the database index a gt a gt Int compute the position of an entry in a list fail if given entry is not an element sortByIndex Int a a Sorts a given list by associated index groupByIndex Int a gt lal Sorts a given list by associated index and group for identical index Empty lists are added for missing indexes getDBInfos Int gt a gt Dynamic Int gt 10 a Gets the information about a list of entries in the database deleteDBEntry Int gt a Dynamic gt Int gt I0 Deletes an entry with a given key in the database updateDBEntry Int g
307. r String gt TypeDec1 gt AFuncDecl a gt Doc pretty print the module header 284 ppExports TypeDec1 AFuncDecl a gt Doc pretty print the export list ppTypeExport TypeDecl Doc pretty print a type export ppConsExports ConsDecl gt Doc pretty print the export list of constructors ppFuncExports AFuncDecl a gt Doc pretty print the export list of functions ppImports String gt Doc pretty print a list of import statements ppImport String Doc pretty print a single import statement ppOpDecls OpDec1 gt Doc pretty print a list of operator fixity declarations ppOpDecl OpDecl Doc pretty print a single operator fixity declaration ppFixity Fixity Doc pretty print the associativity keyword ppTypeDecls TypeDecl gt Doc pretty print a list of type declarations ppTypeDecl TypeDecl Doc pretty print a type declaration ppConsDecls ConsDecl gt Doc pretty print the constructor declarations ppConsDecl ConsDecl Doc pretty print a single constructor ppTypeExp TypeExpr Doc pretty a top level type expression 285 ppTypeExpr Int TypeExpr gt Doc pretty print a type expression ppTVarIndex Int Doc pretty print a type variable ppFuncDecls AFuncDecl a gt Doc pretty print a list of function declarations ppFuncDecl AFuncDecl a Doc pretty print a function declaration ppRule
308. r Just x where x is the first list element maybeToList Maybe a gt a Return an empty list for Nothing or a singleton list for Just x catMaybes Maybe a gt a Return the list of all Just values mapMaybe a gt Maybe b gt a gt b Apply a function which may throw out elements using the Nothing constructor to a list of elements gt gt Maybe a gt a Maybe b Maybe b Monadic bind for Maybe Maybe can be interpreted as a monad where Nothing is interpreted as the error case by this monadic binding sequenceMaybe Maybe a Maybe la Monadic sequence for Maybe mapMMaybe a Maybe b a Maybe b Monadic map for Maybe mplus Maybe a gt Maybe a Maybe a Combine two Maybes returning the first Just value if any 140 A 2 40 Library 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 In standard applications the server side uses the operations listenOn and socketAccept to provide some service on a named socket and the client side uses the operation connectToSocket to request a service Exported types data Socket Abstract type for named sockets Exported constructors Exported functions listenOn String 10 Socket Creat
309. r Maybe values where radio buttons are used to switch between Nothing and Just The value WUI is shown after the radio button WUI wEither WuiSpec a WuiSpec b WuiSpec Either a b WUI for union types Here we provide only the implementation for Either types since other types with more alternatives can be easily reduced to this case wTree WuiSpec a gt WuiSpec WTree a WUI for tree types The rendering specifies the rendering of inner nodes Leaves are shown with their default rendering renderTuple HtmlExp HtmlExp Standard rendering of tuples as a table with a single row Thus the elements are horizontally aligned renderTaggedTuple String HtmlExp gt HtmlExp Standard rendering of tuples with a tag for each element Thus each is preceded by a tag that is set in bold and all elements are vertically aligned renderList HtmlExp gt HtmlExp Standard rendering of lists as a table with a row for each item Thus the elements are vertically aligned mainWUI WuiSpec a gt a a gt I0 HtmlForm 10 HtmlForm Generates an HTML form from a WUI data specification an initial value and an update form wui2html WuiSpec a gt a gt a gt I0 HtmlForm gt HtmlExp WuiHandler Generates HTML editors and a handler from a WUI data specification an initial value and an update form wuilnForm WuiSpec a gt a gt a gt IO HtmlForm gt HtmlExp
310. ram 200 A URL for a CSS file for a HTML form formMetaInfo String String FormParam Meta information for a HTML form The argument is a list of attributes included in the meta tag in the header for this form formBodyAttr String String FormParam Optional attribute for the body element of the HTML form More than one occurrence is allowed i e all such attributes are collected form String HtmlExp gt HtmlForm A basic HTML form for active web pages with the default encoding and a default background standardForm String gt HtmlExp gt HtmlForm A standard HTML form for active web pages where the title is included in the body as the first header cookieForm String gt String String gt HtmlExp gt HtmlForm An HTML form with simple cookies The cookies are sent to the client s browser together with this form addCookies String String HtmlForm HtmlForm Add simple cookie to HTML form The cookies are sent to the client s browser together with this form answerText String HtmlForm A textual result instead of an HTML form as a result for active web pages answerEncText String String HtmlForm A textual result instead of an HTML form as a result for active web pages where the encoding is given as the first parameter addFormParam HtmlForm FormParam HtmlForm Adds a parameter to an HTML form redirect Int Str
311. ransforms a multiset of values into a list sorted by a given ordering on the values As a consequence the multiset of values is completely evaluated In order to ensure that the result of this operation is independent of the evaluation order the given ordering must be a total order A 2 51 Library 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 168 Exported types data Socket The abstract type of sockets Exported constructors Exported functions listenOn Int 10 Socket Creates a server side socket bound to a given port number listenOnFresh I0 Int Socket Creates a server side socket bound to a free port The port number and the socket is returned socketAccept Socket gt I0 String Handle Returns a connection of a client to a socket The connection is returned as a pair consisting of a string identifying the client the format of this string is implementation dependent and a handle to a stream communication with the client The handle is both readable and writable waitForSocketAccept Socket gt Int gt I0 Maybe String Handle Waits until a connection of a client to a socket is available If no connection is available within the time limit it returns Nothing otherwise the
312. reas constructor and function names are annotated with a fresh variant of the type in the type assumption 3 Based on FlatCurry s type inference rules type equations are generated for a function s rule 4 The resulting equations are solved using unification and the resulting substitution is applied to the function rule 5 The inferred types are then normalized such that for every function rule the type variables start with 0 301 In addition the function inferNewFunctions allows to infer the types of a list of functions whose type is not known before Consequently this disallows polymorphic recursive functions Those functions are separated into strongly connected components before their types are inferred to allow mutually recursive function definitions In case of any error the type inference quits with an error message Exported types type TypeEnv FM String String TypeExpr A type environment Exported functions inferProg Prog gt IO Either String AProg TypeExpr Infers the type of a whole program inferProgFromProgEnv String Prog Prog Either String AProg TypeExpr Infers the type of a whole program w r t a list of imported modules inferFunction String String gt Prog gt IO Either String AFuncDecl TypeExpr Infers the types of a single function specified by its qualified name inferNewFunctions Prog gt FuncDecl IO Either String AFuncDecl TypeExp
313. ren 193 foldFM 179 foldValues 168 footer 203 form 201 formatMarkdownFileAsPDF 214 formatMarkdownInputAsPDF 214 formBodyAttr 201 formCSS 200 formEnc 200 formMetalnfo 201 322 FormParam 198 free 13 free variable mode 10 13 freeExpr 271 296 freeVars 271 296 fromJust 140 fromLeft 92 fromMarkdownText 214 fromMaybe 140 fromRight 92 FrontendParams 85 FrontendTarget 84 fullPath 88 funcArgs 269 294 funcArity 268 293 funcBody 269 294 FuncDecl 257 funcName 248 268 293 funcNamesOfFDecl 249 funcNamesOfLDecl 249 funcNamesOfStat 249 funcRHS 269 294 funcRule 268 293 function external 312 functional pattern 17 functions 246 funcType 268 293 funcVis 248 funcVisibility 268 293 garbageCollect 160 garbageCollectorOff 160 garbageCollectorOn 160 GDecomp 182 gelem 185 generateCompactFlatCurryFile 282 germanLatexDoc 209 getAbsolutePath 84 getAllFailures 56 getAllSolutions 56 getAllValues 56 98 getArgs 170 getAssoc 125 getClockTime 171 getContents 123 getContentsO0fUrl 215 getCookies 208 getCPUTime 169 getCurrentDirectory 83 getCursorPosition 117 getDB 81 132 getDBInfo 128 134 135 getDBInfos 129 134 135 getDirectoryContents 83 getDynamicSolution 90 getDynamicSolutions 90 getElapsedTime 169 getEnviron 170 getFileInPath 94 getFlatCurryFileInLoadPath 262 getFlexRigid 281 getHomeDirectory 84 getHostname 170 getKnowledge 90 getLoad
314. resented as XML data Empty XML data must not be used in repetitions and does not represent an XML element attr String gt String gt a a gt String XmlConv NotRepeatable NoElem a Takes a name and string conversion functions and returns an XML converter that represents an attribute Attributes must not be used in repetitions and do not represent an XML element adapt a gt b b gt a gt XmlConv c d a gt XmlConv c d b Converts between arbitrary XML converters for different types opt XmlConv a b c gt XmlConv NotRepeatable NoElem Maybe c Creates a converter for arbitrary optional XML data Optional XML data must not be used in repetitions and does not represent an XML element rep XmlConv Repeatable a b XmlConv NotRepeatable NoElem b Takes an XML converter representing repeatable data and returns an XML converter that represents repetitions of this data Repetitions must not be used in other repeti tions and do not represent XML elements alnt String XmlConv NotRepeatable NoElem Int Creates an XML converter for integer attributes Integer attributes must not be used in repetitions and do not represent XML elements aFloat String XmlConv NotRepeatable NoElem Float Creates an XML converter for float attributes Float attributes must not be used in repetitions and do not represent XML elements aChar String XmlConv NotRepeatable NoElem Char Creates an XML converter f
315. rns if there is no prefix 93 baseName String String Extracts the base name without directoy prefix of a given Unix file name splitDirectoryBaseName String String String Splits a Unix file name into the directory prefix and the base name The directory 99 prefix is if there is no real prefix in the name stripSuffix String String Strips a suffix the last suffix starting with a dot from a file name fileSuffix String String Yields the suffix the last suffix starting with a dot from given file name splitBaseName String gt String String Splits a file name into prefix and suffix the last suffix starting with a dot and the rest splitPath String String Splits a path string into list of directory names lookupFileInPath String String String gt IO Maybe String Looks up the first file with a possible suffix in a list of directories Returns Nothing if such a file does not exist getFileInPath String gt String String gt I0 String Gets the first file with a possible suffix in a list of directories An error message is delivered if there is no such file A 2 22 Library FilePath This library is a direct port of the Haskell library System FilePath of Neil Mitchell Exported types type FilePath String Exported functions pathSeparator Char pathSeparators String 94 isPathSeparator Char Bool
316. rog gt CFuncDecl Returns the function declarations of a given curry program 246 constructors CurryProg CConsDec1 Returns all constructors of given curry program types CurryProg CTypeDecl Returns the type declarations of a given curry program publicFuncNames CurryProg gt String String Returns the names of all visible functions in given curry program publicConsNames CurryProg gt String String Returns the names of all visible constructors in given curry program publicTypeNames CurryProg String String Returns the names of all visible types in given curry program typeName CTypeDecl gt String String Returns the name of a given type declaration typeVis CTypeDecl CVisibility Returns the visibility of a given type declaration typeCons CTypeDecl gt CConsDec1 Returns the constructors of a given type declaration consName CConsDecl String String Returns the name of a given constructor declaration consVis CConsDecl CVisibility Returns the visibility of a given constructor declaration isBaseType CTypeExpr Bool Returns true if the type expression is a base type isPolyType CTypeExpr Bool Returns true if the type expression contains type variables isFunctionalType CTypeExpr Bool Returns true if the type expression is a functional type islOType CTypeExpr Bool Returns true if the type expression is IO t 2
317. rts If you detect any further technical problem please write to pakcs curry language org AT References 1 E Albert M Alpuente M Hanus and G Vidal A partial evaluation framework for Curry 10 11 programs In Proc of the 6th International Conference on Logic for Programming and Auto mated Reasoning LPAR 99 pages 376 395 Springer LNCS 1705 1999 E Albert M Hanus and G Vidal Using an abstract representation to specialize functional logic programs In Proc of the 7th International Conference on Logic for Programming and Automated Reasoning LPAR 2000 pages 381 398 Springer LNCS 1955 2000 E Albert M Hanus and G Vidal A practical partial evaluator for a multi paradigm declar ative language In Proc of the 5th International Symposium on Functional and Logic Pro gramming FLOPS 2001 pages 326 342 Springer LNCS 2024 2001 E Albert M Hanus and G Vidal A practical partial evaluator for a multi paradigm declar ative language Journal of Functional and Logic Programming 2002 1 2002 S Antoy and M Hanus Compiling multi paradigm declarative programs into Prolog In Proc International Workshop on Frontiers of Combining Systems FroCoS 2000 pages 171 185 Springer LNCS 1794 2000 S Antoy and M Hanus Declarative programming with function patterns In Proceedings of the International Symposium on Logic based Program Synthesis and Transformation LOP STR 05 Springer LNCS to app
318. rules arguments updRuleBody AExpr a AExpr a ARule a ARule a update rules body updRuleExtDecl String String ARule a ARule a update rules external declaration allVarsInRule ARule a gt Int get variable names in a functions rule rnmAllVarsInRule Int gt Int gt ARule a gt ARule a rename all variables in rule updQNamesInRule String String gt String String gt ARule a gt ARule a update all qualified names in rule trCombType a gt Int gt a gt a gt Int gt a gt CombType gt a transform combination type isCombTypeFuncCall CombType Bool is type of combination FuncCall isCombTypeFuncPartCall CombType Bool is type of combination FuncPartCall isCombTypeConsCall CombType Bool is type of combination ConsCall isCombTypeConsPartCall CombType Bool is type of combination ConsPartCall missingArgs CombType Int varNr AExpr a gt Int get internal number of variable 295 literal AExpr a Literal get literal if expression is literal expression combType AExpr a CombType get combination type of a combined expression combName AExpr a gt String String get name of a combined expression combArgs AExpr a AExpr a get arguments of a combined expression missingCombArgs AExpr a gt Int get number of missing arguments if expression is combined letBinds AExpr a gt Int a AExpr a
319. ry e is called In this case the suffix curry or 1curry must be present and cannot be dropped One can write additional commands for the interactive environment typically settings of some options before the Curry program name All arguments after the Curry program name are passed as run time arguments For instance consider the following program stored in the file ShowArgs curry import System getArgs main getArgs gt gt print This program can be executed by the shell command gt runcurry ShowArgs curry Hello World which produces the output Hello World e One can also execute a Curry program whose whose program text comes from the standard input Thus one can either pipe the program text into this command or type the program text on the keyboard For instance if we type gt runcurry main putStr unlines map show take 8 1 followed by the end of file marker Ctrl D the output AON OOF WN RHE is produced e One can also write the program text in a script file to be executed like a shell script In this case the script must start with the line 40 usr bin env runcurry followed by the source text of the Curry program For instance we can write a simple Curry script to count the number of code lines in a Curry program by removing all blank and comment lines and counting the remaining lines usr bin env runcurry import Char isSpace import System
320. rySubdir String String Transforms a path to a module name into a file name by adding the currySubDir to the path and transforming a hierarchical module name into a path For instance inCurrySubdir mylib Data Char evaluates to mylib curry Data Char inCurrySubdirModule String String String Transforms a file name by adding the currySubDir to the file name This version respects hierarchical module names addCurrySubdir String String Transforms a directory name into the name of the corresponding sub directory contain ing auxiliary files getLoadPathForModule String I0 String Returns the current path list of directory names that is used for loading modules w r t 2 a given module path The directory prefix of the module path or if there is no such prefix is the first element of the load path and the remaining elements are determined by the environment variable CURRYRPATH and the entry libraries of the system s re file lookupModuleSourceInLoadPath String I0 Maybe String String Returns a directory name and the actual source file name for a module by looking up the module source in the current load path If the module is hierarchical the directory is the top directory of the hierarchy Returns Nothing if there is no corresponding source file defaultParams FrontendParams The default parameters of the front end rcParams 10 FrontendParams The default param
321. s empty a gt a Bool a a gt Bool gt a gt a Bool gt RedBlackTree a The three relations are inserted into the structure by function empty Returns an empty tree i e an empty red black tree augmented with the order predicates isEmpty RedBlackTree a Bool Test on emptyness newTreeLike RedBlackTree a RedBlackTree a Creates a new empty red black tree from with the same ordering as a give one lookup a RedBlackTree a Maybe a Returns an element if it is contained in a red black tree update a RedBlackTree a gt RedBlackTree a Updates inserts an element into a RedBlackTree delete a RedBlackTree a RedBlackTree a Deletes entry from red black tree tree2list RedBlackTree a gt a Transforms a red black tree into an ordered list of its elements sort a gt a gt Bool gt a gt a Generic sort based on insertion into red black trees The first argument is the order for the elements setInsertEquivalence a a Bool gt RedBlackTree a RedBlackTree a For compatibility with old version only 188 A 3 7 Library SCC Computing strongly connected components Copyright c 2000 2003 Wolfgang Lux See LICENSE for the full license The function scc computes the strongly connected components of a list of entities in two steps First the list is topologically sorted downwards using the defines relation Then the resulting list is
322. s D1 D2 prog p1 prog po This file contains the Prolog program prog pl in an intermediate format for faster loading prog This file is stored in the same directory as prog pl This file contains the executable after compiling and saving a program with PAKCS see Section 2 2 311 E External Functions Currently PAKCS has no general interface to external functions Therefore if a new external func tion should be added to the system this function must be declared as external in the Curry source code and then an implementation for this external function must be inserted in the corresponding back end An external function is defined as follows in the Curry source code 1 Add a type declaration for the external function somewhere in the body of the appropriate file usually the prelude or some system module 2 For external functions it is not allowed to define any rule since their semantics is determined by an external implementation Instead of the defining rules you have to write f external somewhere in the file containing the type declaration for the external function f For instance the addition on integers can be declared as an external function as follows Int gt Int gt Int external The further modifications to be done for an inclusion of an external function has to be done in the back end A new external function is added to the back end of PAKCS by informing the compiler about the existence of
323. s can be either flexible or rigid in Curry Exported constructors e Rigid CaseType e Flex CaseType data CombType Data type for classifying combinations i e a function constructor applied to some arguments Exported constructors e FuncCall CombType FuncCall 258 a call to a function where all arguments are provided e ConsCall CombType ConsCall a call with a constructor at the top all arguments are provided e FuncPartCall Int gt CombType FuncPartCall a partial call to a function i e not all arguments are provided where the parameter is the number of missing arguments e ConsPartCall Int CombType ConsPartCall a partial call to a constructor i e not all arguments are provided where the parameter is the number of missing arguments data Expr Data type for representing expressions Remarks if then else expressions are represented as function calls if el then e2 else e3 is represented as Comb FuncCall Prelude if_then_else e1 e2 e3 Higher order applications are represented as calls to the external function apply For instance the rule app fx fx is represented as Rule 0 1 Comb FuncCall Prelude apply Var 0 Var 1 A conditional rule is represented as a call to an external function cond where the first argument is the condition a constraint For instance the rule equal2 x x 2 True 259 is represented as
324. s generated by the compiler so that an n ary function can be implemented by an n 1 ary predicate where the last argument must be instantiated to the result of evaluating the function The standard interface can be used if all arguments are ensured to be fully evaluated e g see definition of above and no suspension control is necessary i e it is ensured that the external function call does not suspend for all arguments Otherwise the raw interface see below must be used For instance the Prolog code implementing prim_Int_plus contained in the Prolog library prim_standard pl is as follows note that the arguments of are passed in reverse order to prim_Int_plus in order to ensure a left to right evaluation of the original arguments by the calls to prim_Int_plus Y X R R is X Y 3 The standard interface for I O actions i e external functions with result type 10 a assumes 313 that the I O action is implemented as a predicate with a possible side effect that instantiates the last argument to the returned value of type a For instance the primitive predicate prim_getChar implementing prelude I O action getChar can be implemented by the Prolog code prim_getChar C get_code N char_int C N where char_int is a predicate relating the internal Curry representation of a character with its ASCII value 4 If some arguments passed to the external functions are not fully evaluated or the external function
325. s graphical interface tested i e the corresponding assertions are checked and the results Ok or failure are reported together with the name of each assertion For our example above we obtain the following successful protocol Testing module TestList OK OK all OK prefix All tests successfully passed There is also a graphical interface that summarizes the results more nicely In order to start this 199 interface one has to add the parameter window or w e g executing a test suite by currytest window TestList or currytest w TestList A snapshot of the interface is shown in Figure 2 34 9 CurryPP A Preprocessor for Curry Programs The Curry preprocessor currypp implements various transformations on Curry source programs It supports some experimental language extensions that might become part of the standard parser of Curry in some future version Currently the Curry preprocessor supports the following extensions that will be described below in more detail Integrated code This extension allows to integrate code written in some other language into Curry programs like regular expressions format specifications printf HTML and XML code Sequential rules If this feature is used all rules in a Curry module are interpreted as sequential i e a rule is applied only if all previous rules defining the same operation are not applicable The idea of sequential rules
326. scanri is a variant of scanr that has no starting value argument mapAccumL a gt b gt a c gt a gt b gt a c The mapAccumL function behaves like a combination of map and foldl it applies a function to each element of a list passing an accumulating parameter from left to right and returning a final value of this accumulator together with the new list mapAccumR a gt b gt a c a gt b gt a c The mapAccumR function behaves like a combination of map and foldr it applies a function to each element of a list passing an accumulating parameter from right to left and returning a final value of this accumulator together with the new list cycle a gt a Builds an infinite list from a finite one unfoldr a gt Maybe b a gt a gt b Builds a list from a seed value A 2 39 Library Maybe Library with some useful functions on the Maybe datatype 139 Exported functions isJust Maybe a Bool Return True iff the argument is of the form Just _ isNothing Maybe a Bool Return True iff the argument is of the form Nothing fromJust Maybe a gt a Extract the argument from the Just constructor and throw an error if the argument is Nothing fromMaybe a gt Maybe a gt a Extract the argument from the Just constructor or return the provided default value if the argument is Nothing listToMaybe a Maybe a Return Nothing on an empty list o
327. scribe only the basic steps to use this tool in order to generate a web application First one has to create a textual description of the entity relationship model as a Curry term of type ERD w r t the type definitions given in module pakcshome currytools erd2curry ERD curry and store it in some file e g mymodel erdterm The directory pakcshome currytools spicey contains two examples for such ERD term files Blog erdterm This is a simple ER model for a blog with entries comments and tags as presented in the paper 21 Uni erdterm This is an ER model for university lectures as presented in the paper 13 Then change to the directory in which you want to create the project sources Execute the command spiceup mymodel erdterm with the path to the ERD term file as a parameter spiceup is a program stored in pakcshome bin where pakcshome is the installation directory of PAKCS see Section 1 1 You can also provide a path name i e the name of a directory where the database files should be stored e g spiceup dbpath DBDIR mymodel erdterm If the parameter dbpath DBDIR is not provided then DBDIR is set to the current directory Since this specification will be used in the generated web programs a relative database directory name will be relative to the place where the web programs are stored In order to avoid such confusion it might be better to specify an absolute path name for the database d
328. so that closing tags can be omitted In order to include strings computed by Curry expressions into these HTML syntax these Curry expressions must be enclosed in curly brackets The following example program shows its use OPTIONS_CYMAKE F pgmF currypp optF foreigncode import HTML htmlPage String HtmlExp htmlPage name html lt html gt lt head gt lt title gt Simple Test lt body gt lt hi gt Hello name lt h1 gt lt p gt Bye lt p gt Bye lt h2 gt reverse name Bye If a Curry expression computes an HTML expression i e it is of type HtmlExp instead of String it can be integrated into the HTML syntax by double curly brackets The following simple example taken from 17 shows the use of this feature OPTIONS_CYMAKE F pgmF currypp optF foreigncode import HTML main IO HtmlForm main return form Question html Enter a string textfield tref lt hr gt button Reverse string revhandler button Duplicate string duphandler where tref free revhandler env return form Answer html lt hi gt Reversed input reverse env tref 37 duphandler env return form Answer html lt h1 gt Duplicated input env tref env tref 9 1 4 XML Expressions The foreign language tag xm1 introduces a notation for XML expressions see PAKCS library XML The syntax is similar to the language
329. sorted upwards using the uses relation and partitioned into the connected components Both relations are computed within this module using the bound and free names of each declaration In order to avoid useless recomputations the code in the module first decorates the declarations with their bound and free names and a unique number The latter is only used to provide a trivial ordering so that the declarations can be used as set elements Exported functions scc a gt b gt a gt b gt a gt fal Computes the strongly connected components of a list of entities To be flexible we distinguish the nodes and the entities defined in this node A 3 8 Library SetRBT Library with an implementation of sets as red black trees All the operations on sets are generic i e one has to provide an explicit order predicate lt less than on elements Exported types type SetRBT a RedBlackTree a Exported functions emptySetRBT a a Bool RedBlackTree a Returns an empty set i e an empty red black tree augmented with an order predicate isEmptySetRBT RedBlackTree a Bool Test for an empty set elemRBT a RedBlackTree a Bool Returns true if an element is contained in a red black tree set insertRBT a RedBlackTree a RedBlackTree a Inserts an element into a set if it is not already there insertMultiRBT a RedBlackTree a RedBlackTree a 189 Inserts an element into a mul
330. specification for more elaborate implementations Exported types data UnificationError The data type for the different kinds of errors that can occur during unification Exported constructors e Clash Term a gt Term a gt UnificationError a Clash ti t2 Two term constructors with different names are supposed to be equal e OccurCheck Int Term a gt UnificationError a OccurCheck v t A term is supposed to be equal to a term in which it occurs as a subterm 195 Exported functions unify Term a Term a Either UnificationError a FM Int Term a y Unifies the given equations A 4 Libraries for Web Applications A 4 1 Library 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 Exported functions list2CategorizedHtml a HtmlExp gt b String gt a gt b gt Bool gt HtmlExp General categorization of a list of entries The item will occur in every category for which the boolean function categoryFun yields True categorizeByItemKey String HtmlExp gt HtmlExpl Categorize a list of entries with respect to the inial keys The categories are named as all initial characters of the keys of the items stringList2ItemList String String HtmlExp Convert a string list into an key item list The strings are used as keys and
331. st is contained in another sortBy a gt a gt Bool gt a gt a Sorts a list w r t an ordering relation by the insertion method insertBy a a gt Bool gt a gt a gt a Inserts an object into a list according to an ordering relation last a gt a Returns the last element of a non empty list init a gt a Returns the input list with the last element removed sum Int gt Int Returns the sum of a list of integers product Int gt Int Returns the product of a list of integers maximum a a Returns the maximum of a non empty list 138 maximumBy a gt a Ordering gt a gt a Returns the maximum of a non empty list according to the given comparison function minimum a gt a Returns the minimum of a non empty list minimumBy a gt a Ordering gt a gt a Returns the minimum of a non empty list according to the given comparison function scanl a gt b a a b gt al scanl is similar to fold1 but returns a list of successive reduced values from the left scanl f z x1 x2 z z f x1 z f x1 f x2 scanli a gt a gt a gt a gt a scan11 is a variant of scanl that has no starting value argument scanl1 f x1 x2 ely lf 52 co scanr a gt b gt b gt b gt a gt b scanr is the right to left dual of scanl scanri a a gt a gt a gt al
332. stem like SICStus Prolog or SWI Prolog exists see the file INSTALL html in the PAKCS directory for a description of the necessary software to install PAKCS All executable files required to use the different components of PAKCS are stored in the directory pakcshome bin where pakcshome is the installation directory of the complete PAKCS installation You should add this directory to your path e g by the bash command export PATH pakcshome bin PATH The source code of the Curry program must be stored in a file with the suffix curry e g lcurry prog curry Literate programs must be stored in files with the extension Since the translation of Curry programs with PAKCS creates some auxiliary files see Section D for details you need write permission in the directory where you have stored your Curry programs The auxiliary files for all Curry programs in the current directory can be deleted by the command cleancurry this is a shell script stored in the bin directory of the PAKCS installation see above The command cleancurry r also deletes the auxiliary files in all subdirectories 1 2 Restrictions There are a few minor restrictions on Curry programs when they are processed with PAKCS e Singleton pattern variables i e variables that occur only once in a rule should be denoted as an anonymous variable _ otherwise the parser will print a warning since this is a typical source of programming
333. ster all cgi servers registerCgiServer String gt String gt 10 unregisterCgiServer String gt I0 A 4 4 Library HtmlParser This module contains a very simple parser for HTML documents Exported functions readHtmlFile String 10 HtmlExp Reads a file with HTML text and returns the corresponding HTML expressions parseHtmlString String HtmlExp Transforms an HTML string into a list of HTML expressions If the HTML string is a well structured document the list of HTML expressions should contain exactly one element A 4 5 Library Mail This library contains functions for sending emails The implementation might need to be adapted to the local environment 211 Exported types data MailOption Options for sending emails Exported constructors e CC String Mail0Option cC recipient of a carbon copy e BCC String MailOption BCC recipient of a blind carbon copy e TO String MailOption TO recipient of the email Exported functions sendMail String String gt String String gt 10 Sends an email via mailx command sendMailWithOptions String String gt MailOption gt String gt I0 Sends an email via mailx command and various options Note that multiple options are allowed e g more than one CC option for multiple recipient of carbon copies Important note The implementation of this operation is based on the command
334. t Returns various informations about the current state of the Curry process Note that the returned values are very implementation dependent so that one should interpret them with care garbageCollector0ff 10 O Turns off the garbage collector of the run time system if possible This could be useful to get more precise data of memory usage garbageCollectorOn 10 Turns on the garbage collector of the run time system if possible garbageCollect 10 Invoke the garbage collector if possible This could be useful before run time critical operations showMemInfo ProcessInfo Int String Get a human readable version of the memory situation from the process infos printMemInfo I0 O Print a human readable version of the current memory situation of the Curry process profileTime IO a gt IO a Print the time needed to execute a given IO action profileTimeNF a gt I0 Evaluates the argument to normal form and print the time needed for this evaluation profileSpace IO a gt IO a Print the time and space needed to execute a given IO action During the executation the garbage collector is turned off to get the total space usage profileSpaceNF a gt 10 Evaluates the argument to normal form and print the time and space needed for this evaluation During the evaluation the garbage collector is turned off to get the total space usage evalTime a gt a Evaluates the argument to norm
335. t a Dynamic gt Int gt a gt 10 O Overwrites an existing entry in the database newDBEntry Int gt a gt Dynamic gt a gt I0 Int Stores a new entry in the database and return the key of the new entry cleanDB Int gt a Dynamic gt 10 Deletes all entries in the database A 2 38 Library List Library with some useful operations on lists 135 Exported functions elemIndex a gt a Maybe Int Returns the index i of the first occurrence of an element in a list as Just i otherwise Nothing is returned elemIndices a gt a gt Int Returns the list of indices of occurrences of an element in a list find a gt Bool gt a Maybe a Returns the first element e of a list satisfying a predicate as Just e otherwise Nothing is returned findIndex a gt Bool gt a Maybe Int Returns the index i of the first occurrences of a list element satisfying a predicate as Just i otherwise Nothing is returned findIndices a gt Bool gt a gt Int Returns the list of indices of list elements satisfying a predicate nub a gt a Removes all duplicates in the argument list nubBy a a gt Bool gt a gt a Removes all duplicates in the argument list according to an equivalence relation delete a gt a gt a Deletes the first occurrence of an element in a list deleteBy a gt a gt Bool gt a gt a
336. t b gt c gt d gt WuiSpec a WuiSpec b gt WuiSpec c WuiSpec d w4Tuple WuiSpec a WuiSpec b gt WuiSpec c WuiSpec d WuiSpec a b c d WUI combinator for tuples of arity 4 wCons4 a gt b gt c d gt e gt WuiSpec a gt WuiSpec b gt WuiSpec c gt WuiSpec d WuiSpec e WUI combinator for constructors of arity 4 The first argument is the ternary construc tor The further arguments are the WUI specifications for the argument types wCons4JS Maybe JSExp gt JSExp gt a gt b gt c gt d gt e gt WuiSpec a gt WuiSpec b WuiSpec c WuiSpec d WuiSpec e 225 woTuple WuiSpec a WuiSpec b WuiSpec c WuiSpec d WuiSpec e gt WuiSpec a b c d e WUI combinator for tuples of arity 5 wConsb a gt b gt c d gt e f gt WuiSpec a gt WuiSpec b WuiSpec c gt WuiSpec d WuiSpec e WuiSpec f WUI combinator for constructors of arity 5 The first argument is the ternary construc tor The further arguments are the WUI specifications for the argument types wCons5JS Maybe JSExp gt JSExp gt a gt b gt c gt d gt e gt f gt WuiSpec a gt WuiSpec b gt WuiSpec c gt WuiSpec d gt WuiSpec e gt WuiSpec f w6Tuple WuiSpec a WuiSpec b WuiSpec c WuiSpec d WuiSpec e gt WuiSpec f WuiSpec a b c d e f WUI combinator for tuples of arity 6
337. t a top level expression ppExpr Options Int Expr Doc pretty print an expression ppVarIndex Int Doc 277 pretty print a variable ppLiteral Literal Doc pretty print a literal ppComb Options gt Int String String Expr gt Doc Pretty print a constructor or function call ppDecls Options gt Int Expr Doc pretty print a list of declarations ppDecl Options gt Int Expr gt Doc pretty print a single declaration ppCaseType CaseType gt Doc Pretty print the type of a case expression ppBranch Options gt BranchExpr Doc Pretty print a case branch ppPattern Options gt Pattern gt Doc Pretty print a pattern ppPrefixQ0p Options String String gt Doc pretty print a qualified prefix operator ppPrefix0Op String String gt Doc pretty print a prefix operator unqualified ppInfixQOp Options gt String String gt Doc pretty print an infix operator ppQName Options gt String String Doc Pretty print a qualified name ppName String String gt Doc Pretty print a qualified name unqualified e g for type definitions isInfixOp String String gt Bool Check whether an operator is an infix operator isConsId String String gt Bool 278 Check whether an identifier represents the list constructor isListId String String Bool Check whether an identifier represents a list
338. t fields The third component is read function to extract the values from the edit fields for a given cgi environment returned as Just v If the value is not legal Nothing is returned The second component of the result contains an HTML edit expression together with a WUI state to edit the value again Exported constructors data WTree A simple tree structure to demonstrate the construction of WUls for tree types Exported constructors e WLeaf a WTree a e WNode WTree a WTree a 222 Exported functions wuiHandler2button String WuiHandler HtmlExp Transform a WUI handler into a submit button with a given label string withRendering WuiSpec a gt HtmlExp HtmlExp WuiSpec a Puts a new rendering function into a WUI specification withError WuiSpec a String WuiSpec a Puts a new error message into a WUI specification withCondition WuiSpec a gt a Bool WuiSpec a Puts a new condition into a WUI specification withConditionJS WuiSpec a gt a Bool gt WuiSpec a Puts a new JavaScript implementation of the condition into a WUI specification withConditionJSName WuiSpec a gt a gt Bool String gt WuiSpec a Puts a new JavaScript implementation of the condition into a WUI specification transformWSpec a gt b b gt a gt WuiSpec a gt WuiSpec b Transforms a WUI specification from one type to another adaptWSpec a
339. t is layed out as words in a tuple If you want put the commas in front of their elements instead of at the end you should use tupled or in general encloseSep encloseSep Doc Doc Doc gt Doc Doc The document encloseSep 1 r s xs concatenates the documents xs seperated by s and encloses the resulting document by 1 and r The documents are rendered hori zontally if that fits the page Otherwise they are aligned vertically All seperators are put in front of the elements For example the combinator list can be defined with encloseSep list xs encloseSep lbracket rbracket comma xs test text list lt gt list map int 10 200 3000 Which is layed out with a page width of 20 as list 10 200 3000 But when the page width is 15 it is layed out as list 10 200 3000 encloseSepSpaced Doc gt Doc gt Doc gt Doc gt Doc The document encloseSepSpaced 1 r s xs concatenates the documents xs seper ated by s and encloses the resulting document by 1 and r In addition after each occurrence of s after 1 and before r a space is inserted The documents are rendered horizontally if that fits the page Otherwise they are aligned vertically All seperators are put in front of the elements hEncloseSep Doc gt Doc gt Doc gt Doc Doc 151 The document hEncloseSep 1 r s xs concatenates the documents xs seperated by s and encloses the r
340. t with vertical and horizontal scrollbars The argument contains the configuration options for the list box widget CanvasScroll Confltem Widget A canvas widget with vertical and horizontal scrollbars The argument contains the configuration options for the text edit widget EntryScroll ConfItem Widget An entry widget with a horizontal scrollbar The argument contains the configuration options for the entry widget 118 getOpenFile 10 String Pops up a GUI for selecting an existing file The file with its full path name will be 9999 returned or if the user cancels the selection getOpenFileWithTypes String String 10 String Pops up a GUI for selecting an existing file The parameter is a list of pairs of file types that could be selected A file type pair consists of a name and an extension for that 99 99 file type The file with its full path name will be returned or if the user cancels the selection getSaveFile 10 String Pops up a GUI for choosing a file to save some data If the user chooses an existing file she he will asked to confirm to overwrite it The file with its full path name will 99 99 be returned or if the user cancels the selection getSaveFileWithTypes String String 10 String Pops up a GUI for choosing a file to save some data The parameter is a list of pairs of file types that could be selected A file type pair consists
341. tCurry flatCurryFileName String String Transforms a name of a Curry program with or without suffix curry or lcurry into the name of the file containing the corresponding FlatCurry program flatCurryIntName String String Transforms a name of a Curry program with or without suffix curry or lcurry into the name of the file containing the corresponding FlatCurry program readFlatCurryFile String 10 Prog I O action which reads a FlatCurry program from a file in fey format In contrast to readFlatCurry this action does not parse a source program Thus the argument must be the name of an existing file with suffix fcy containing a FlatCurry program in fcy format and the result is a FlatCurry term representing this program readFlatCurrylnt String 10 Prog I O action which returns the interface of a Curry module i e a FlatCurry program containing only Public entities and function definitions without rules i e external functions The argument is the file name without suffix curry or lcurry and the result is a FlatCurry term representing the interface of this module writeFCY String Prog 10 Writes a FlatCurry program into a file in fcy format The first argument must be the name of the target file with suffix fey lookupFlatCurryFileInLoadPath String 10 Maybe String Returns the name of the Fla
342. tCurry file of a module in the load path if this file exists getFlatCurryFilelnLoadPath String IO String Returns the name of the FlatCurry file of a module in the load path if this file exists 262 A 5 8 Library FlatCurry Goodies 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 trans formation 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 trans formations on FlatCurry terms so the provided functions can be used to implement specific trans formations 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 Exported types type Update ab b gt b gt aa Exported functions trProg String String TypeDec1 FuncDec1 gt OpDec1 gt a gt Prog gt a transform program progName Prog gt String get name from program progImports Prog gt String get imports from program progTypes Prog gt TypeDecl1 get type declarations from program progFuncs Prog gt FuncDecl get functions from program progOps Prog gt OpDec1 get inf
343. ternary con structor The further arguments are the WUI specifications for the argument types wiiTuple WuiSpec a WuiSpec b WuiSpec c gt WuiSpec d gt WuiSpec e gt WuiSpec f gt WuiSpec g gt WuiSpec h WuiSpec i gt WuiSpec j WuiSpec k gt WuiSpec a b c d e f g h i j k WUI combinator for tuples of arity 11 wCons11 la lt b gt c gt d gt e gt fl gt g gt h gt iw gt j gt k gt 1l gt WuiSpec a gt WuiSpec b gt WuiSpec c gt WuiSpec d WuiSpec e gt WuiSpec f WuiSpec g gt WuiSpec h gt WuiSpec i WuiSpec j WuiSpec k WuiSpec 1 219 WUI combinator for constructors of arity 11 The first argument is the ternary con structor The further arguments are the WUI specifications for the argument types wi2Tuple WuiSpec a WuiSpec b WuiSpec c gt WuiSpec d WuiSpec e gt WuiSpec f gt WuiSpec g gt WuiSpec h WuiSpec i WuiSpec j WuiSpec k gt WuiSpec 1 gt WuiSpec a b c d e f g h i j k 1 WUI combinator for tuples of arity 12 wCons12 la lt b gt c gt d gt e gt fl gt g gt h gt i gt j gt k gt 1l gt m gt WuiSpec a WuiSpec b gt WuiSpec c WuiSpec d WuiSpec e gt WuiSpec f gt WuiSpec g WuiSpec h gt WuiSpec i WuiSpec j WuiSpec k WuiSpec 1 gt WuiSpec m WUI combinator for constructors of arity 12 The first argument is the ternary con structor The further argumen
344. text This is formatted as a horizontal line 307 B 3 Headers The are two forms to mark headers In the first form one can underline the main header in the source text by equal signs and the second level header by dashes First level header Alternatively and for more levels one can prefix the header line by up to six hash characters where the number of characters corresponds to the header level where level 1 is the main header Main header Level 2 header Level 3 H H Level 4 HH HH Level 5 HHHHHH Level 6 308 C Overview of the PAKCS Distribution A schematic overview of the various components contained in the distribution of PAKCS and the translation process of programs inside PAKCS is shown in Figure 3 on page 310 In this figure boxes denote different components of PAKCS and names in boldface denote files containing various intermediate representations during the translation process see Section D below The PAKCS distribution contains a front end for reading parsing and type checking Curry programs that can be also used by other Curry implementations The back end formerly known as Curry2Prolog compiles Curry programs into Prolog programs It also support constraint solvers for arithmetic constraints over real numbers and finite domain constraints and further libraries for GUI pro gramming meta programming etc Currently it does not implement encapsulated search in full generality
345. textstyle String String HtmlExp Provides a style for a basic text The style argument is the name of a style class defined in an external style sheet blockstyle String HtmlExp gt HtmlExp Provides a style for a block of HTML elements The style argument is the name of a style class defined in an external style sheet This element is used in contrast to style for larger blocks of HTML elements since a line break is placed before and after these elements inline HtmlExp gt HtmlExp Joins a list of HTML elements into a single HTML element Although this construction has no rendering it is sometimes useful for programming when several HTML elements must be put together block HtmlExp gt HtmlExp 205 Joins a list of HTML elements into a block A line break is placed before and after these elements button String gt CgiRef gt String IO HtmlForm HtmlExp Submit button with a label string and an event handler resetbutton String HtmlExp Reset button with a label string imageButton String gt CgiRef String 10 HtmlForm HtmlExp Submit button in form of an imag textfield CgiRef String HtmlExp Input text field with a reference and an initial contents password CgiRef HtmlExp Input text field where the entered text is obscured with a reference textarea CgiRef gt Int Int String HtmlExp Input text area with a ref
346. tim String HtmlExp Verbatim unformatted special characters lt gt amp are quoted address HtmlExp HtmlExp Address href String HtmlExp HtmlExp Hypertext reference anchor String HtmlExp HtmlExp An anchored text with a hypertext reference inside a document ulist HtmlExp HtmlExp Unordered list olist HtmlExp gt HtmlExp Ordered list litem HtmlExp HtmlExp A single list item usually not explicitly used dlist HtmlExp HtmlExp HtmlExp Description list 204 table HtmlExp gt HtmlExp Table with a matrix of items where each item is a list of HTML expressions headedTable HtmlExp gt HtmlExp Similar to table but introduces header tags for the first row addHeadings HtmlExp gt HtmlExp HtmlExp Add a row of items where each item is a list of HTML expressions as headings to a table If the first argument is not a table the headings are ignored hrule HtmlExp Horizontal rule breakline HtmlExp Break a line image String gt String HtmlExp Image styleSheet String HtmlExp Defines a style sheet to be used in this HTML document style String HtmlExp gt HtmlExp Provides a style for HTML elements The style argument is the name of a style class defined in a style definition see styleSheet or in an external style sheet see form and page parameters FormCSS and PageCSs
347. tion with qualified constructor names into the corresponding expression The string might contain logical variable and defined function encodings produced by showAnyQExpression In case of a successful parse the result is a one element list containing a pair of the expression and the remaining unparsed string readAnyQExpression String gt a Transforms a string containing an expression in standard prefix notation with qualified constructor names into the corresponding expression The string might contain logical variable and defined function encodings produced by showAnyQExpression A 3 Data Structures and Algorithms A 3 1 Library Array Implementation of Arrays with Braun Trees Conceptually Braun trees are always infinite Con sequently there is no test on emptiness Exported types data Array Exported constructors 175 Exported functions emptyErrorArray Array a Creates an empty array which generates errors for non initialized indexes emptyDefaultArray Int gt a gt Array a Creates an empty array call given function for non initialized indexes Array a gt Int a gt Array a Inserts a list of entries into an array update Array a gt Int gt a Array a Inserts a new entry into an array applyAt Array a gt Int gt a gt a gt Array a Applies a function to an element Array a gt Int gt a Yields the value at a given position listToDefaultArray
348. tiset Thus the same element can have several occurrences in the multiset deleteRBT a RedBlackTree a RedBlackTree a delete an element from a set Deletes only a single element from a multi set setRBT2list RedBlackTree a gt la Transforms a red black tree set into an ordered list of its elements unionRBT RedBlackTree a RedBlackTree a gt RedBlackTree a Computes the union of two red black tree sets This is done by inserting all elements of the first set into the second set intersectRBT RedBlackTree a RedBlackTree a RedBlackTree a Computes the intersection of two red black tree sets This is done by inserting all elements of the first set contained in the second set into a new set which order is taken from the first set sortRBT a gt a gt Bool gt a gt a Generic sort based on insertion into red black trees The first argument is the order for the elements A 3 9 Library Sort A collection of useful functions for sorting and comparing characters strings and lists Exported functions quickSort a a gt Bool gt a gt a Quicksort mergeSort a gt a Bool gt a gt la Bottom up mergesort leqList a gt a gt Bool gt a gt a gt Bool Less or equal on lists cmpList a gt a Ordering gt a a gt Ordering Comparison of lists legChar Char Char Bool Less or equal on characters
349. tiset of values and returns the chosen value and the remaining multiset of values Thus if we consider the operation chooseValue by chooseValue x fst choose x then set1 chooseValue is the identity on value sets i e set1 chooseValue s contains the same elements as the value set s chooseValue Values a gt a Chooses non deterministically some value in a multiset of values and returns the chosen value Thus seti chooseValue is the identity on value sets i e set1 chooseValue s contains the same elements as the value set s select Values a gt a Values a Selects indeterministically some value in a multiset of values and returns the selected value and the remaining multiset of values Thus select has always at most one value It fails if the value set is empty NOTE The usage of this operation is only safe i e does not destroy completeness if all values in the argument set are identical selectValue Values a a Selects indeterministically some value in a multiset of values and returns the selected value Thus selectValue has always at most one value It fails if the value set is empty NOTE The usage of this operation is only safe i e does not destroy completeness if all values in the argument set are identical It returns a single value even for infinite value sets in contrast to select or choose mapValues a gt b gt Values a gt Values b 167 Accumulates all elements
350. tmlPage PageParam HtmlPage Adds a parameter to an HTML page htxt String HtmlExp Basic text as HTML expression The text may contain special HTML chars like lt gt amp which will be quoted so that they appear as in the parameter string htxts String HtmlExpl A list of strings represented as a list of HTML expressions The strings may contain special HTML chars that will be quoted hempty HtmlExp An empty HTML expression 202 nbsp HtmlExp Non breaking Space hi HtmlExp HtmlExp Header 1 h2 HtmlExp HtmlExp Header 2 h3 HtmlExp gt HtmlExp Header 3 h4 HtmlExp HtmlExp Header 4 h5 HtmlExp gt HtmlExp Header 5 par HtmlExp gt HtmlExp Paragraph section HtmlExp gt HtmlExp Section header HtmlExp HtmlExp Header footer HtmlExp HtmlExp Footer emphasize HtmlExp HtmlExp Emphasize strong HtmlExp HtmlExp Strong more emphasized text bold HtmlExp HtmlExp Boldface italic HtmlExp gt HtmlExp Italic 203 nav HtmlExp HtmlExp Navigation code HtmlExp gt HtmlExp Program code center HtmlExp HtmlExp Centered text blink HtmlExp HtmlExp Blinking text teletype HtmlExp gt HtmlExp Teletype font pre HtmlExp gt HtmlExp Unformatted input i e keep spaces and line breaks and don t quote special characters verba
351. 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 http www informatik uni kiel de pakcs lib FlatCurry Types html and http www informatik uni kiel de pakcs lib AbstractCurry Types html 59 avoid some anomalities in the old concept Exported types data SearchTree A search tree for representing search structures Exported constructors e SearchBranch b SearchTree a b SearchTree a b e Solutions a SearchTree a b Exported functions getAllSolutions a gt Bool gt I0 la 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 getAllValues a gt 10 la Gets all values of an expression Since this is based on getAl1Solutions it inherits the same restrictions getOneSolution a gt Bool gt 10 Maybe a Gets one solution to a constraint currently v
352. ton wRadioBool HtmlExp gt HtmlExp WuiSpec Bool 224 A widget to select a Boolean value via a radio button The arguments are the lists of HTML expressions that are shown after the True and False radio buttons respectively wJoinTuple WuiSpec a gt WuiSpec b WuiSpec a b WUI combinator to combine two tuples into a joint tuple It is similar to wPair but renders both components as a single tuple provided that the components are already rendered as tuples i e by the rendering function renderTuple This combinator is useful to define combinators for large tuples wPair WuiSpec a WuiSpec b WuiSpec a b WUI combinator for pairs wCons2 a gt b gt c gt WuiSpec a WuiSpec b WuiSpec c WUI combinator for constructors of arity 2 The first argument is the binary con structor The second and third arguments are the WUI specifications for the argument types wCons2JS Maybe JSExp JSExp gt a gt b gt c WuiSpec a gt WuiSpec b gt WuiSpec c wTriple WuiSpec a WuiSpec b WuiSpec c gt WuiSpec a b c WUI combinator for triples wCons3 a b gt c gt d WuiSpec a WuiSpec b WuiSpec c WuiSpec d WUI combinator for constructors of arity 3 The first argument is the ternary construc tor The further arguments are the WUI specifications for the argument types wCons3JS Maybe JSExp JSExp gt a g
353. tor declaration consArgs ConsDecl TypeExpr get arguments of constructor declaration updCons String String gt String String Int gt Int gt Visibility gt Visibility gt TypeExpr TypeExpr gt ConsDecl gt ConsDecl update constructor declaration updConsName String String gt String String ConsDecl gt ConsDecl update name of constructor declaration 290 updConsArity Int Int ConsDecl ConsDecl update arity of constructor declaration updConsVisibility Visibility gt Visibility gt ConsDecl gt ConsDecl update visibility of constructor declaration updConsArgs TypeExpr gt TypeExpr ConsDecl ConsDecl update arguments of constructor declaration updQNamesInConsDecl String String gt String String ConsDecl gt ConsDecl update all qualified names in constructor declaration tVarIndex TypeExpr Int get index from type variable domain TypeExpr TypeExpr get domain from functional type range TypeExpr TypeExpr get range from functional type tConsName TypeExpr gt String String get name from constructed type tConsArgs TypeExpr TypeExpr get arguments from constructed type trTypeExpr Int gt a gt String String gt a gt a gt a gt a gt a TypeExpr gt a isTVar TypeExpr gt Bool is type expression a type variable isTC
354. tractCurry program untypedAbstractCurryFileName String String Transforms a name of a Curry program with or without suffix curry or lcurry into the name of the file containing the corresponding untyped AbstractCurry program readAbstractCurryFile String IO CurryProg 7 I O action which reads an AbstractCurry program from a file in acy format In contrast to readCurry this action does not parse a source program Thus the argument must be the name of an existing file with suffix acy containing an AbstractCurry program in acy format and the result is a Curry term representing this program It is currently predefined only in Curry2Prolog tryReadACYFile String IO Maybe CurryProg Tries to read an AbstractCurry file and returns e Left err where err specifies the error occurred e Right prog where prog is the AbstractCurry program writeAbstractCurryFile String CurryProg gt 10 Writes an AbstractCurry program into a file in acy format The first argument must be the name of the target file with suffix acy A 5 3 Library AbstractCurry Select This library provides some useful operations to select components in AbstractCurry programs i e it provides a collection of selector functions for AbstractCurry Exported functions imports CurryProg gt String Returns the imports module names of a given curry program functions CurryP
355. transaction is externally interrupted e g by killing the process some locks might never be removed However they can be explicitly removed by deleting the corresponding lock files reported at startup time runJustT Transaction a gt IO a Executes a possibly composed transaction on the current state of dynamic predicates as a single transaction Similarly to runT but a run time error is raised if the execution of the transaction fails runTNA Transaction a gt I0 Either a TError Executes a possibly composed transaction as a Non Atomic sequence of its individual database updates Thus the argument is not executed as a single transaction in contrast to runT i e no predicates are locked and individual updates are not undone in case of a transaction error This operation could be applied to execute a composed transaction without the overhead caused by the current implementation of transactions if one is sure that locking is not necessary e g if the transaction contains only database reads and transaction error raising A 2 15 Library Debug This library contains some useful operation for debugging programs Exported functions trace String gt a gt a Prints the first argument as a side effect and behaves as identity on the second argument traceld String String Prints the first argument as a side effect and returns it afterwards traceShow a gt b gt b Prints the first argument using show and ret
356. tring Bool Assertion assertEqual String gt a gt a Assertion a assertValues String gt a la Assertion a assertSolutions String a Bool a Assertion a assertl0 String gt IO a gt a Assertion a assertEquall0 String gt IO a gt IO a Assertion a The expression assertTrue s b is an assertion named s that the expression b has the value True Similarly the expression assertEqual s e ez asserts that the expressions e and ez must be equal i e e1 e2 must hold the expression assertValues s e vs asserts that vs is the multiset of all values of e and the expression assertSolutions s c us asserts that the constraint abstraction c has the multiset of solutions vs Furthermore the expression assertI0 s a v asserts that the I O action a yields the value v whenever it is executed and the expression assertEqualI0 s aj az asserts that the I O actions a and az yield equal values The name s provided as a first argument in each assertion is used in the protocol produced by the test tool One can define a test program by importing the module to be tested together with the module Assertion and defining top level functions of type Assertion in this module which must also be exported As an example consider the following program that can be used to test some list processing functions import List import Assertion testi assertEqual 1 2
357. ts are the WUI specifications for the argument types wJoinTuple WuiSpec a gt WuiSpec b WuiSpec a b WUI combinator to combine two tuples into a joint tuple It is similar to wPair but renders both components as a single tuple provided that the components are already rendered as tuples i e by the rendering function renderTuple This combinator is useful to define combinators for large tuples wList WuiSpec a WuiSpec a WUI combinator for list structures where the list elements are vertically aligned in a table wListWithHeadings String WuiSpec a WuiSpec a Add headings to a standard WUI for list structures wHList WuiSpec a WuiSpec a WUI combinator for list structures where the list elements are horizontally aligned in a table wMatrix WuiSpec a gt WuiSpec a WUI for matrices i e list of list of elements visualized as a matrix wMaybe WuiSpec Bool WuiSpec a a WuiSpec Maybe a WUI for Maybe values It is constructed from a WUI for Booleans and a WUI for the potential values Nothing corresponds to a selection of False in the Boolean WUI The value WUI is shown after the Boolean WUI wCheckMaybe WuiSpec a gt HtmlExp gt a WuiSpec Maybe a A WUI for Maybe values where a check box is used to select Just The value WUI is shown after the check box 220 wRadioMaybe WuiSpec a gt HtmlExp HtmlExp a WuiSpec Maybe a A WUI fo
358. turning an HTML expression for the edit fields and a WUI state containing the CgiRefs to extract the values from the edit fields The third component is read function to extract the values from the edit fields for a given cgi environment returned as Just v If the value is not legal Nothing is returned The second component of the result contains an HTML edit expression together with a WUI state to edit the value again Exported constructors data WTree A simple tree structure to demonstrate the construction of WUIs for tree types Exported constructors e WLeaf a WTree a e WNode WTree a WTree a 215 Exported functions wuiHandler2button String WuiHandler HtmlExp Transform a WUI handler into a submit button with a given label string withRendering WuiSpec a gt HtmlExp HtmlExp WuiSpec a Puts a new rendering function into a WUI specification withError WuiSpec a String WuiSpec a Puts a new error message into a WUI specification withCondition WuiSpec a gt a Bool WuiSpec a Puts a new condition into a WUI specification transformWSpec a gt b b gt a gt WuiSpec a gt WuiSpec b Transforms a WUI specification from one type to another adaptWSpec a b WuiSpec a gt WuiSpec b Adapt a WUI specification to a new type For this purpose the first argument must be a transformation mapping values from the old type to the new type This
359. uence of arbitrary XML data The se quence must not be used in repetitions and does not represent an XML element 236 repSeq3 a gt b gt c d gt XmlConv Repeatable e a XmlConv Repeatable f b XmlConv Repeatable g c gt XmlConv NotRepeatable NoElem d Creates an XML converter that represents a repetition of a sequence of repeatable XML data The repetition may be used in other repetitions and does not represent an XML element This combinator is provided because converters for repeatable sequences cannot be constructed by the seq combinators eSeg3 String gt a gt b gt c gt d gt XmlConv e f a gt XmlConv g h b gt XmlConv i j c gt XmlConv Repeatable Elem d Creates an XML converter for compound values represented as an XML element with children that correspond to the values components The element can be used in repe titions eRepSeq3 String gt a gt b gt c gt d XmlConv Repeatable e a gt XmlConv Repeatable f b XmlConv Repeatable g c XmlConv Repeatable Elem d Creates an XML converter for repetitions of sequences represented as an XML element that can be used in repetitions sega la gt b gt c gt d gt e gt XmlConv f g a gt XmlConv h ib gt XmlConv jk c XmlConv 1 m d gt XmlConv NotRepeatable NoElem e Creates an XML converter representing a sequence of arbitrary XML data The se quence must not be used in repetitions a
360. uld react on user events as well as messages written to the given handle runInitControlledGUI String Widget String gt GuiPort 10 gt GuiPort IO Reconfigureltem gt Handle gt 10 Runs a Widget in a new GUI window and process GUI events after executing an initial action on the GUI window In addition an event handler is provided that process messages received from an external message stream This operation is useful to run a GUI that should react on user events as well as messages written to the given handle runHandlesControlledGUI String gt Widget Handle GuiPort gt 10 Reconfigureltem Handle gt 10 O Runs a Widget in a new GUI window and process GUI events In addition a list of event handlers is provided that process inputs received from a corresponding list of handles to input streams Thus if the i th handle has some data available the i th event handler is executed with the i th handle as a parameter This operation is useful to run a GUI that should react on inputs provided by other processes e g via sockets runInitHandlesControlledGUI String Widget Handle GuiPort gt I0 ReconfigureItem GuiPort 10 Reconfigureltem gt Handle gt I0 Runs a Widget in a new GUI window and process GUI events after executing an initial action on the GUI window In addition a list of event handlers is provided that process inputs received from
361. ument after the function call is successfully evaluated and does not suspend Additionally the actual evaluated arguments must be dereferenced before they are accessed Thus an implementation of the external function for adding integers is as follows in the raw interface block prim_Int_plus 7 prim_Int_plus RY RX Result E0 E deref RX X deref RY Y Result is X Y EO E Here deref is a predefined predicate for dereferencing the actual argument into a constant and derefAll for dereferencing complex structures The Prolog code implementing the external functions must be accessible to the run time system of PAKCS by putting it into the directory containing the corresponding Curry module or into the 314 system directory pakcshome curry2prolog lib_src Then it will be automatically loaded into the run time environment of each compiled Curry program Note that arbitrary functions implemented in C or Java can be connected to PAKCS by using the corresponding interfaces of the underlying Prolog system 315 Index lt 142 103 73 101 67 71 73 100 67 71 28 compact 45 fcypp 45 Ta 100 67 71 fpopt 45 a 75 amp amp 75 pakcsrc 16 lt 75 lt 61 lt 75 lt 61 gt 12 gt 02 gt Ya gt 61 73 101 176 67 71 60 63 68 pan eee 183 add 10 browse 11 cd 11 coosy 12 dir 11 edit 11 ev
362. unction declaration Exported constructors e AFunc String String Int gt Visibility TypeExpr ARule a gt AFuncDecl a data ARule Annotated function rule Exported constructors e ARule a gt Int a AExpr a gt ARule a e AExternal a gt String ARule a data AExpr 283 Annotated expression Exported constructors e AVar a gt Int gt AExpr a e ALit a gt Literal gt AExpr a e AComb a gt CombType gt String String a gt AExpr a AExpr a e ALet a gt Int a AExpr a AExpr a gt AExpr a e AFree a gt Int a gt AExpr a gt AExpr a e AOr a gt AExpr a gt AExpr a gt AExpr a e ACase a gt CaseType gt AExpr a gt ABranchExpr a gt AExpr a e ATyped a gt AExpr a TypeExpr AExpr a data ABranchExpr Annotated case branch Exported constructors e ABranch APattern a gt AExpr a ABranchExpr a data APattern Annotated pattern Exported constructors e APattern a gt String String a gt Int a gt APattern a e ALPattern a gt Literal APattern a A 5 16 Library FlatCurry Annotated Pretty This library provides pretty printers for AnnotatedFlatCurry modules and all substructures e g expressions Note that annotations are ignored for pretty printing Exported functions ppProg AProg a gt Doc pretty print a FlatCurry module ppHeade
363. urns the second argument afterwards traceShowld a gt a 82 Prints the first argument using show and returns it afterwards tracel0 String gt I0 O Output a trace message from the IO monad assert Bool gt String gt a gt a Assert a condition w r t an error message If the condition is not met it fails with the given error message otherwise the third argument is returned assertI0 Bool gt String gt 10 Assert a condition w r t an error message from the 10 monad If the condition is not met it fails with the given error message A 2 16 Library Directory Library for accessing the directory structure of the underlying operating system Exported functions doesFileExist String IO Bool Returns true if the argument is the name of an existing file doesDirectoryExist String 10 Bool Returns true if the argument is the name of an existing directory fileSize String gt 10 Int Returns the size of the file getModificationTime String 10 ClockTime Returns the modification time of the file getCurrentDirectory 10 String Returns the current working directory setCurrentDirectory String gt 10 Sets the current working directory getDirectoryContents String 10 String Returns the list of all entries in a directory createDirectory String gt I0 Creates a new directory with the given name createDirectorylfMissing Bool gt String gt 10 83
364. urryWithImports 245 readCurryWithParseO0ptions 245 readFileWithXmlDocs 232 readFlatCurry 55 262 readFlatCurryFile 262 readFlatCurrylInt 262 readFlatCurryIntWithImports 279 readFlatCurryIntWithImportsInPath 279 readFlatCurryWithImports 279 readFlatCurryWithImportsInPath 279 readFlatCurryWithParseOptions 262 readFM 181 readGlobal 106 readGVar 107 readHex 163 readHtmlFile 211 readInt 163 readIORef 125 readNat 163 readOct 163 330 readPropertyFile 162 readQTerm 165 readQTermFile 165 readQTermListFile 165 readsAnyQExpression 175 readsAnyQTerm 175 readsAnyUnqualifiedTerm 174 readScan 304 readsQTerm 164 readsTerm 164 readsUnqualifiedTerm 164 readTerm 164 readUnqualifiedTerm 164 readUnsafeXmlFile 232 readUntypedCurry 245 readUntypedCurryWithParse0ptions 246 readXmlFile 232 recip 101 Reconfigureltem 111 red 157 RedBlackTree 188 redirect 201 registerCgiServer 211 registerPort 78 removeDirectory 84 removeEscapes 214 removeFile 84 removeRegionStyle 117 renameDirectory 84 renameFile 84 Rendering 215 222 renderList 221 229 renderTaggedTuple 221 229 renderTuple 221 229 rep 234 replace 138 replaceBaseName 97 replaceChildren 192 replaceChildrenl0 193 replaceDirectory 97 replaceExtension 95 replaceFileName 96 repSeql 235 repseq2 236 repSeq3 237 repSeq4 237 repseq5 238 repSeg6 238 RequiredSpec 282 requires 282 resetbutton 206 resu
365. utton3 Event MouseButton3 right mouse button pressed e KeyPress Event KeyPress any key is pressed e Return Event Return return key is pressed data ConfCollection The data type for possible configurations of widget collections e g columns rows Exported constructors e CenterAlign ConfCollection CenterAlign centered alignment e LeftAlign ConfCollection LeftAlign left alignment e RightAlign ConfCollection RightAlign right alignment e TopAlign ConfCollection TopAlign top alignment e BottomAlign ConfCollection BottomAlign bottom alignment data Menultem 112 The data type for specifying items in a menu Exported constructors e MButton GuiPort gt IO Reconfigureltem String Menultem MButton a button with an associated command and a label string e MSeparator Menultem MSeparator a separator between menu entries e MMenuButton String gt Menultem Menultem MMenuButton a submenu with a label string data Canvasltem The data type of items in a canvas The last argument are further options in Tcl Tk for testing Exported constructors e CLine Int Int String gt CanvasItem e CPolygon Int Int gt String CanvasItem e CRectangle Int Int gt Int Int gt String gt CanvasItem e COval Int Int gt Int Int gt String gt Canvas
366. value should be contained in the value list and is preselected The first argument is a mapping from values into strings to be shown in the selection widget wSelectInt Int gt WuiSpec Int A widget to select a value from a given list of integers provided as the argument The current value should be contained in the value list and is preselected wSelectBool String String WuiSpec Bool A widget to select a Boolean value via a selection box The arguments are the strings that are shown for the values True and False in the selection box respectively wCheckBool HtmlExp gt WuiSpec Bool A widget to select a Boolean value via a check box The first argument are HTML expressions that are shown after the check box The result is True if the box is checked wMultiCheckSelect a gt HtmlExp a WuiSpec a A widget to select a list of values from a given list of values via check boxes The current values should be contained in the value list and are preselected The first argument is a mapping from values into HTML expressions that are shown for each item after the check box wRadioSelect a gt HtmlExp la gt WuiSpec a A widget to select a value from a given list of values via a radio button The current value should be contained in the value list and is preselected The first argument is a mapping from values into HTML expressions that are shown for each item after the radio but
367. vas ConfItem gt Widget Canvas a canvas to draw pictures containing CanvasItems e CheckButton ConfItem Widget CheckButton a check button it has value 0 if it is unchecked and value 1 if it is checked 107 Entry Confltem gt Widget Entry an entry widget for entering single lines Label Confltem Widget Label a label for showing a text ListBox ConfItem gt Widget ListBox a widget containing a list of items for selection Message ConfItem Widget Message a message for showing simple string values MenuButton ConfItem gt Widget MenuButton a button with a pull down menu Scale Int gt Int gt ConfItem gt Widget Scale a scale widget to input values by a slider ScrollH WidgetRef gt ConfItem gt Widget ScrollH a horizontal scroll bar ScrollV WidgetRef gt ConfItem Widget ScrollV a vertical scroll bar TextEdit ConfItem Widget TextEdit a text editor widget to show and manipulate larger text paragraphs Row ConfCollection Widget Widget Row a horizontal alignment of widgets 108 e Col ConfCollection Widget Widget Col a vertical alignment of widgets e Matrix ConfCollection Widget Widget Matrix a 2 dimensional matrix alignment of widgets data Confltem The data type
368. vate Visibility data TypeDecl Data type for representing definitions of algebraic data types and type synonyms A data type definition of the form data t x1 xn c t1 tkc is represented by the FlatCurry term Type t i1 in Cons c ke t1 tkc where each ij is the index of the type variable xj Note the type variable indices are unique inside each type declaration and are usually numbered from 0 Thus a data type declaration consists of the name of the data type a list of type parameters and a list of constructor declarations Exported constructors e Type String String gt Visibility gt Int gt ConsDec1 TypeDecl e TypeSyn String String Visibility Int gt TypeExpr TypeDecl data ConsDecl A constructor declaration consists of the name and arity of the constructor and a list of the argument types of the constructor 256 Exported constructors e Cons String String gt Int Visibility TypeExpr ConsDecl data TypeExpr Data type for type expressions A type expression is either a type variable a function type or a type constructor application Note the names of the predefined type constructors are Int Float Bool Char 10 unit type tuple types list type Exported constructors e TVar Int TypeExpr e FuncType TypeExpr TypeExpr Typ
369. w ee eee ee es 281 A 5 14 Library PlatCurry Compact ce ee e 281 A 5 15 Library FlatCurry Annotated Types 000 0000 000 283 A 5 16 Library FlatCurry Annotated Pretty 0 00202000004 284 A 5 17 Library FlatCurry Annotated Goodies 0 000 eee eee 287 A 5 18 Library FlatCurry Annotated TypeSubst 2 4 4 300 A 5 19 Library FlatCurry Annotated Typelnference 2 4 301 A 5 20 Library CurryStringClassifier e 303 B Markdown Syntax 305 B 1 Paragraphs and Basic Formatting ccoo sasaa csaa cad ero eee eee 305 B 2 Lists and Block Formatting s s s se sados sa Pare ae me ee A es 306 Ba Headers cs o 5 Se ee es Bee ee a a A eee we o ati 308 C Overview of the PAKCS Distribution D Auxiliary Files E External Functions Index 309 311 312 316 Preface This document describes PAKCS formerly called PACS an implementation of the multi paradigm language Curry jointly developed at the University of Kiel the Technical University of Aachen and Portland State University Curry is a universal programming language aiming at the amalgamation of the most important declarative programming paradigms namely functional programming and logic programming Curry combines in a seamless way features from functional programming nested expressions lazy evaluation higher order functions logic programming log ical variables partial data structures built in search and concurrent
370. w informatik uni kiel de pakcs lib index html A 1 Constraints Ports Meta Programming A 1 1 Arithmetic Constraints The primitive entities for the use of arithmetic constraints are defined in the system module CLPR cf Section 1 3 i e in order to use them the program must contain the import declaration import CLPR Floating point arithmetic is supported in PAKCS via arithmetic constraints i e the equational constraint 2 3 x 5 5 is solved by binding x to 3 2 rather than suspending the evaluation of the addition as in corresponding constraints on integers like 3 x 5 All operations related to floating point numbers are suffixed by The following functions and constraints on floating point numbers are supported in PAKCS Float gt Float gt Float Addition on floating point numbers Float gt Float gt Float Subtraction on floating point numbers Float gt Float gt Float Multiplication on floating point numbers Float gt Float gt Float Division on floating point numbers lt Float gt Float gt Bool Comparing two floating point numbers with the less than relation gt Float gt Float gt Bool Comparing two floating point numbers with the greater than relation lt Float gt Float gt Bool Comparing two floating point numbers with the less than or equal relation gt Float gt
371. y Fixity gt Fixity gt OpDecl gt OpDecl update fixity of operator declaration 292 updOpPrecedence Int Int OpDecl gt OpDecl update precedence of operator declaration trFunc String String gt Int gt Visibility TypeExpr ARule a gt b gt AFuncDecl a gt b transform function funcName AFuncDecl a gt String String get name of function funcArity AFuncDecl a Int get arity of function funcVisibility AFuncDecl a Visibility get visibility of function funcType AFuncDecl a gt TypeExpr get type of function funcRule AFuncDecl a gt ARule a get rule of function updFunc String String gt String String gt Int gt Int gt Visibility gt Visibility gt TypeExpr gt TypeExpr gt ARule a gt ARule a gt AFuncDecl a gt AFuncDecl a update function updFuncName String String gt String String AFuncDecl a gt AFuncDecl a update name of function updFuncArity Int Int gt AFuncDecl a AFuncDecl a update arity of function updFuncVisibility Visibility Visibility gt AFuncDecl a gt AFuncDecl a update visibility of function updFuncType TypeExpr gt TypeExpr AFuncDecl a gt AFuncDecl a update type of function updFuncRule ARule a gt ARule a AFuncDecl a gt AFuncDecl a update rule of function 293 isExternal AFuncDecl a
372. ySetRBT 189 isEmptyTable 191 isEOF 122 isExternal 269 294 isExtSeparator 95 isFree 272 297 isFuncCall 273 298 isFuncPartCall 273 298 isFunctionalType 247 isFuncType 267 291 isGround 174 273 298 isHexDigit 59 isInfix0Of 138 isInfixOp 278 287 isIO0ReturnType 248 islOType 247 isJust 140 isKnown 90 isLatin1 58 isLeft 91 isLet 272 297 isLetter 304 325 isListld 279 287 isLit 272 297 isLower 59 isMeta 304 isModuleHead 304 isNothing 140 isOctDigit 59 isOr 272 297 isPathSeparator 95 isPolyType 247 isPosix 170 isPrefix0f 138 isPrelude 249 isqrt 120 isRelative 98 isRight 91 isRuleExternal 270 294 isSearchPathSeparator 95 isSmallComment 304 isSpace 59 isSuffix0f 138 isTCons 267 291 isText 304 isTupleld 279 287 isTVar 267 291 isTypeSyn 265 289 isUpper 59 isValid 98 isVar 173 272 296 isWindows 170 italic 157 203 joinDrive 96 joinModuleldentifiers 86 joinPath 97 JSBranch 127 jsConsTerm 128 JSExp 125 JSFDec1 127 JSStat 126 Key 130 keyOrder 180 KeyPred 130 keysFM 180 lab 184 lab 185 labEdges 186 labeling 73 LabelingOption 69 labNode 185 labNodes 186 labUEdges 187 labUNodes 187 langle 154 larrow 155 last 138 LayoutChoice 252 lbrace 154 lbracket 154 ldeclsOfRule 249 LEdge 181 lefts 91 leqChar 190 leqCharIgnoreCase 191 leqLexGerman 191 leqList 190 leqString 191 leqStr
373. ypes data Query Abstract datatype to represent database queries Exported constructors data TError The type of errors that might occur during a transaction Exported constructors e TError TErrorKind String TError data TErrorKind The various kinds of transaction errors Exported constructors e KeyNotExistsError TErrorKind e NoRelationshipError TErrorKind e DuplicateKeyError TErrorKind e KeyRequiredError TErrorKind e UniqueError TErrorKind e MinError TErrorKind e MaxError TErrorKind 79 e UserDefinedError TErrorKind e ExecutionError TErrorKind data Transaction Abstract datatype for representing transactions Exported constructors Exported functions queryAll a Dynamic Query a A database query that returns all answers to an abstraction on a dynamic expression queryOne a Dynamic Query Maybe a A database query that returns a single answer to an abstraction on a dynamic expres sion It returns Nothing if no answer exists queryOneWithDefault a gt a Dynamic gt Query a A database query that returns a single answer to an abstraction on a dynamic expres sion It returns the first argument if no answer exists queryJustOne a Dynamic Query a A database query that returns a single answer to an abstraction on a dynamic expres sion It fails if no answer exists dynamicExists Dynamic Query Bool A
Download Pdf Manuals
Related Search
Manual manual manualslib manual car manuale digitale manually meaning manual timesheet manual transmission manual wheelchair manual arts high school manually update your device drivers windows manual definition manual for courts martial manual labor manual lawn mower manual muscle testing manually register devices with autopilot manual muscle testing grades manual transfer switch manualidades manual blood pressure cuff manual handling manual transmission cars for sale manual digital manual pdf manual autopilot enrollment
Related Contents
12434 DE FR IT RC1 Cover.FH11 Philips PC tune-up kit SPC3520 Philips Laserfax 920 SINUS PENTA STOP & READ PARE Y LEA S`ARRÊT ER ET LIRE 7517 manual.cdr - Taylor Precision Products DXC-4 - RADProductsOnline PFP10016 Sony LA-100W camera lense Copyright © All rights reserved.
Failed to retrieve file