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.
- 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]
- type TagSet = Set String
- tagsFields :: [Field]
- fileModeAsIntField :: String -> Field
- processIdField :: String -> Field
Internal functions
numericalReadFn :: JSON a => (String -> Result a) -> [(String, JSValue)] -> JSValue -> Result aSource
specialNumericalField :: Name -> Field -> FieldSource
Sets the read function to also accept string parsable by the given function.
timeAsDoubleField :: String -> FieldSource
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 -> FieldSource
External functions and data types
timeStampFields :: [Field]Source
Timestamp fields description.
serialFields :: [Field]Source
Serial number fields description.
uuidFields :: [Field]Source
UUID fields description.
tagsFields :: [Field]Source
Tag field description.
Fields related to POSIX data types
fileModeAsIntField :: String -> FieldSource
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 -> FieldSource
Creates a new mandatory field that contains a POSIX process ID.