Safe Haskell | None |
---|
Helpers for creating various kinds of Field
s.
They aren't directly needed for the Template Haskell code in Ganeti.THH, so better keep them in a separate module.
Synopsis
- numericalReadFn :: JSON a => (String -> Result a) -> [(String, JSValue)] -> JSValue -> Result a
- specialNumericalField :: Name -> Field -> Field
- timeAsDoubleField :: String -> Field
- integralField :: Q Type -> String -> Field
- timeStampFields :: [Field]
- serialFields :: [Field]
- uuidFields :: [Field]
- newtype TagSet = TagSet {
- unTagSet :: Set String
- emptyTagSet :: TagSet
- tagsFields :: [Field]
- fileModeAsIntField :: String -> Field
- processIdField :: String -> Field
Internal functions
numericalReadFn :: JSON a => (String -> Result a) -> [(String, JSValue)] -> JSValue -> Result a Source #
Wrapper around a special parse function, suitable as field-parsing function.
specialNumericalField :: Name -> Field -> Field Source #
Sets the read function to also accept string parsable by the given function.
timeAsDoubleField :: String -> Field Source #
Creates a new mandatory field that reads time as the (floating point)
number of seconds since the standard UNIX epoch, and represents it in
Haskell as ClockTime
.
integralField :: Q Type -> String -> Field Source #
A helper function for creating fields whose Haskell representation is
Integral
and which are serialized as numbers.
External functions and data types
timeStampFields :: [Field] Source #
Timestamp fields description.
serialFields :: [Field] Source #
Serial number fields description.
uuidFields :: [Field] Source #
UUID fields description.
emptyTagSet :: TagSet Source #
Empty tag set value.
tagsFields :: [Field] Source #
Tag field description.
Fields related to POSIX data types
fileModeAsIntField :: String -> Field Source #
Creates a new mandatory field that reads a file mode in the standard
POSIX file mode representation. The Haskell type of the field is FileMode
.
processIdField :: String -> Field Source #
Creates a new mandatory field that contains a POSIX process ID.