Safe Haskell | Safe |
---|---|
Language | Haskell98 |
A class for translating to and from Datum
.
- class Datem a where
- d_get_err :: Datem a => Datum -> a
- datum_int32 :: Datum -> Maybe Int32
- datum_int64 :: Datum -> Maybe Int64
- datum_float :: Datum -> Maybe Float
- datum_double :: Datum -> Maybe Double
- datum_ascii :: Datum -> Maybe ASCII
- datum_string :: Datum -> Maybe String
- datum_blob :: Datum -> Maybe ByteString
- datum_timestamp :: Datum -> Maybe Time
- datum_midi :: Datum -> Maybe MIDI
- datum_sequence :: Datum -> Maybe [Word8]
Documentation
Class for translating to and from Datum
.
There are instances for the direct Datum
field types.
d_put (1::Int32) == Int32 1 d_put (1::Int64) == Int64 1 d_put (1::Float) == Float 1 d_put (1::Double) == Double 1 d_put (Char8.pack "str") == ASCII_String (Char8.pack "str") d_put (Lazy.pack [37,37]) == Blob (blob_pack [37,37]) d_put (MIDI 0 0 0 0) == Midi (MIDI 0 0 0 0)
There are also instances for standard Haskell types.
d_put (1::Int) == Int64 1 d_put (1::Integer) == Int64 1
Type specialised
datum_int32 :: Datum -> Maybe Int32 Source #
Type specialised d_get
.
map datum_int32 [Int32 1,Float 1] == [Just 1,Nothing]
datum_ascii :: Datum -> Maybe ASCII Source #
Type specialised d_get
.
datum_ascii (d_put (Char8.pack "string")) == Just (Char8.pack "string")
datum_blob :: Datum -> Maybe ByteString Source #
Type specialised d_get
.
datum_timestamp :: Datum -> Maybe Time Source #
Maybe
variant of d_timestamp
.