Module "ReadShowTerm.curry"

Library for converting ground terms to strings and vice versa.

Author: Michael Hanus

Version: April 2005


 Exported names:

Functions:
readQTerm | readQTermFile | readQTermListFile | readsQTerm | readsTerm | readsUnqualifiedTerm | readTerm | readUnqualifiedTerm | showQTerm | showTerm | writeQTermFile | writeQTermListFile


 Summary of exported functions:

showTerm  :: a -> String  deterministic 
          Transforms a ground(!) term into a string representation in standard prefix notation.
showQTerm  :: a -> String  deterministic 
          Transforms a ground(!) term into a string representation in standard prefix notation.
readsUnqualifiedTerm  :: [String] -> String -> [(a,String)]  deterministic flexible
          Transform a string containing a term in standard prefix notation without module qualifiers into the corresponding data term.
readUnqualifiedTerm  :: [String] -> String -> a  deterministic rigid
          Transforms a string containing a term in standard prefix notation without module qualifiers into the corresponding data term.
readsTerm  :: String -> [(a,String)]  deterministic 
          For backward compatibility.
readTerm  :: String -> a  deterministic rigid
          For backward compatibility.
readsQTerm  :: String -> [(a,String)]  deterministic 
          Transforms a string containing a term in standard prefix notation with qualified constructor names into the corresponding data term.
readQTerm  :: String -> a  deterministic rigid
          Transforms a string containing a term in standard prefix notation with qualified constructor names into the corresponding data term.
readQTermFile  :: String -> IO a  deterministic 
          Reads a file containing a string representation of a term in standard prefix notation and returns the corresponding data term.
readQTermListFile  :: String -> IO [a]  deterministic 
          Reads a file containing lines with string representations of terms of the same type and returns the corresponding list of data terms.
writeQTermFile  :: String -> a -> IO ()  deterministic 
          Writes a ground term into a file in standard prefix notation.
writeQTermListFile  :: String -> [a] -> IO ()  deterministic 
          Writes a list of ground terms into a file.

 Imported modules:

Char
Prelude

 Exported datatypes:


 Exported functions:

showTerm :: a -> String  deterministic 

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 -> String  deterministic 

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] -> String -> [(a,String)]  deterministic flexible

Transform 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!). 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 -> a  deterministic rigid

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 -> [(a,String)]  deterministic 

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 -> a  deterministic rigid

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 -> [(a,String)]  deterministic 

Transforms a string containing a term in standard prefix notation with qualified constructor names into the corresponding data term. 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.


readQTerm :: String -> a  deterministic rigid

Transforms a string containing a term in standard prefix notation with qualified constructor names into the corresponding data term.


readQTermFile :: String -> IO a  deterministic 

Reads a file containing a string representation of a term in standard prefix notation and returns the corresponding data term.


readQTermListFile :: String -> IO [a]  deterministic 

Reads a file containing lines with string representations of terms of the same type and returns the corresponding list of data terms.


writeQTermFile :: String -> a -> IO ()  deterministic 

Writes a ground term into a file in standard prefix notation.

Example call:  (writeQTermFile filename term)

Parameters:
filename - The name of the file to be written.
term - The term to be written to the file as a string.

writeQTermListFile :: String -> [a] -> IO ()  deterministic 

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.

Example call:  (writeQTermListFile filename terms)

Parameters:
filename - The name of the file to be written.
terms - The list of terms to be written to the file.


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