LGTM, thanks.

On Mon, Feb 3, 2014 at 8:56 PM, Klaus Aehlig <[email protected]> wrote:

> 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: Klaus Aehlig <[email protected]>
> ---
>  src/Ganeti/THH.hs | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
>
> diff --git a/src/Ganeti/THH.hs b/src/Ganeti/THH.hs
> index 5346a8d..5eef9cb 100644
> --- a/src/Ganeti/THH.hs
> +++ b/src/Ganeti/THH.hs
> @@ -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 }
> --
> 1.9.0.rc1.175.g0b1dcb5
>
>

Reply via email to