This library defines the class ReadWrite
which is the basis to define
compact data representations for various types.
Furthermore, instances of this class are defined for various standard types
defined in the prelude.
data RWParameters
Writing RWParameters .
Constructors:
data RWType
Represents a type in the compact data representation.
Constructors:
Known instances:
Default RWParameters for writing compact data.
monoRWType
:: String -> RWType
Creates a representation of a monomorphic type.
readData
:: ReadWrite a => String -> Maybe a
Data reading and writing
Parses a compact data representation and returns the value.
If the parse failes (e.g. due to a type mismatch), Nothing
is returned.
This operation might fail if the input is not well-formed.
readDataFile
:: ReadWrite a => String -> IO (Maybe a)
Reads a file containing a compact data representation, parses the contents and returns the value.
If the parse failes (e.g. due to a type mismatch or a bad input format),
Nothing
is returned.
writeDataFile
:: ReadWrite a => String -> a -> IO ()
Writes some data to a file containing a compact data representation.
writeDataFileP
:: ReadWrite a => RWParameters -> String -> a -> IO ()
Writes some data to a file containing a compact data representation and use specific RWParameters .
showData
:: ReadWrite a => a -> String
Converts a given data value into a compact string representation.
This is rarely what you want. Use writeDataFile if you want to write the data into a file.
showDataP
:: ReadWrite a => RWParameters -> a -> String
Converts data to a compact string representation using specific RWParameters .
This is rarely what you want. Use writeDataFileP if you want to write the data into a file.
class ReadWrite
a
The class ReadWrite
contains the interface to be implemented
by compact readers and writers of data.
Methods:
|
|
Returns the type of the value. |
|
|
|