Commit 4e4821bd authored by Klaus Aehlig's avatar Klaus Aehlig
Browse files

Add function providing the canonical andRestArguments



The field catching the remaining fields will always be of the same
shape, so add a function for this to make usage simple.
Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarPetr Pudlak <pudlak@google.com>
parent db9583f2
......@@ -48,6 +48,7 @@ module Ganeti.THH ( declareSADT
, genLuxiOp
, Field (..)
, simpleField
, andRestArguments
, specialNumericalField
, withDoc
, defaultField
......@@ -127,6 +128,20 @@ simpleField fname ftype =
, fieldDoc = ""
}
-- | Generate an AndRestArguments catch-all field.
andRestArguments :: String -> Field
andRestArguments fname =
Field { fieldName = fname
, fieldType = [t| M.Map String JSON.JSValue |]
, fieldRead = Nothing
, fieldShow = Nothing
, fieldExtraKeys = []
, fieldDefault = Nothing
, fieldConstr = Nothing
, fieldIsOptional = AndRestArguments
, fieldDoc = ""
}
withDoc :: String -> Field -> Field
withDoc doc field =
field { fieldDoc = doc }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment