Revision a07343b2 htools/Ganeti/THH.hs

b/htools/Ganeti/THH.hs
453 453
  let felems = map (uncurry saveObjectField) (zip fnames fields)
454 454
      -- now build the OP_ID serialisation
455 455
      opid = [| [( $(stringE "OP_ID"),
456
                   $showJSONE $(stringE . deCamelCase $ sname) )] |]
456
                   JSON.showJSON $(stringE . deCamelCase $ sname) )] |]
457 457
      flist = listE (opid:felems)
458 458
      -- and finally convert all this to a json object
459 459
      flist' = [| $(varNameE "makeObj") (concat $flist) |]
......
621 621

  
622 622
saveObjectField :: Name -> Field -> Q Exp
623 623
saveObjectField fvar field
624
  | isContainer = [| [( $nameE , $showJSONE . showContainer $ $fvarE)] |]
624
  | isContainer = [| [( $nameE , JSON.showJSON . showContainer $ $fvarE)] |]
625 625
  | fisOptional = [| case $(varE fvar) of
626 626
                      Nothing -> []
627
                      Just v -> [( $nameE, $showJSONE v)]
627
                      Just v -> [( $nameE, JSON.showJSON v)]
628 628
                  |]
629 629
  | otherwise = case fieldShow field of
630
      Nothing -> [| [( $nameE, $showJSONE $fvarE)] |]
631
      Just fn -> [| [( $nameE, $showJSONE . $fn $ $fvarE)] |]
630
      Nothing -> [| [( $nameE, JSON.showJSON $fvarE)] |]
631
      Just fn -> [| [( $nameE, JSON.showJSON . $fn $ $fvarE)] |]
632 632
  where isContainer = fieldIsContainer field
633 633
        fisOptional  = fieldIsOptional field
634 634
        nameE = stringE (fieldName field)

Also available in: Unified diff