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.
Author: Lasse Züngel
Version: July 2024
defaultParams
:: RWParameters
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. |
readDataFile
:: ReadWrite a => String -> IO (Maybe a)
Reads a file containing a compact data representation, parses the contents and returns the value. |
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. |
showDataP
:: ReadWrite a => RWParameters -> a -> String
Converts data to a compact string representation using specific RWParameters . |
Writing RWParameters .
Constructors:
RWParameters
:: Int -> Int -> RWParameters
Fields:
minStrLen
:: Int
alphabetLen
:: Int
Represents a type in the compact data representation.
Constructors:
RWType
:: String -> [RWType] -> RWType
Default RWParameters for writing compact data.
|
Creates a representation of a monomorphic type.
|
Data reading and writing
Parses a compact data representation and returns the value.
If the parse failes (e.g. due to a type mismatch), This operation might fail if the input is not well-formed. |
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),
|
Writes some data to a file containing a compact data representation. |
Writes some data to a file containing a compact data representation and use specific RWParameters . |
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. |
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. |