Revision 139c0683 htools/Ganeti/THH.hs
b/htools/Ganeti/THH.hs | ||
---|---|---|
283 | 283 |
decl_d <- mapM (\(cname, fields) -> do |
284 | 284 |
fields' <- mapM (buildConsField . snd) fields |
285 | 285 |
return $ NormalC (mkName cname) fields') cons |
286 |
return $ DataD [] tname [] decl_d [''Show, ''Read, ''Eq]
|
|
286 |
return $ DataD [] tname [] decl_d [''Show, ''Eq] |
|
287 | 287 |
|
288 | 288 |
-- | Generate the save function for a given type. |
289 | 289 |
genSaveSimpleObj :: Name -- ^ Object type |
... | ... | |
306 | 306 |
strADTDecl name constructors = |
307 | 307 |
DataD [] name [] |
308 | 308 |
(map (flip NormalC [] . mkName) constructors) |
309 |
[''Show, ''Read, ''Eq, ''Enum, ''Bounded, ''Ord]
|
|
309 |
[''Show, ''Eq, ''Enum, ''Bounded, ''Ord] |
|
310 | 310 |
|
311 | 311 |
-- | Generates a toRaw function. |
312 | 312 |
-- |
... | ... | |
529 | 529 |
fields' <- mapM (fieldTypeInfo "op") fields |
530 | 530 |
return $ RecC (mkName cname) fields') |
531 | 531 |
cons |
532 |
let declD = DataD [] tname [] decl_d [''Show, ''Read, ''Eq]
|
|
532 |
let declD = DataD [] tname [] decl_d [''Show, ''Eq] |
|
533 | 533 |
|
534 | 534 |
(savesig, savefn) <- genSaveOpCode tname "saveOpCode" cons |
535 | 535 |
(uncurry saveConstructor) |
... | ... | |
638 | 638 |
let fields'' = zip (repeat NotStrict) fields' |
639 | 639 |
return $ NormalC (mkName cname) fields'') |
640 | 640 |
cons |
641 |
let declD = DataD [] (mkName name) [] decl_d [''Show, ''Read, ''Eq]
|
|
641 |
let declD = DataD [] (mkName name) [] decl_d [''Show, ''Eq] |
|
642 | 642 |
(savesig, savefn) <- genSaveOpCode tname "opToArgs" |
643 | 643 |
cons saveLuxiConstructor |
644 | 644 |
req_defs <- declareSADT "LuxiReq" . |
... | ... | |
678 | 678 |
let name = mkName sname |
679 | 679 |
fields_d <- mapM (fieldTypeInfo field_pfx) fields |
680 | 680 |
let decl_d = RecC name fields_d |
681 |
let declD = DataD [] name [] [decl_d] [''Show, ''Read, ''Eq]
|
|
681 |
let declD = DataD [] name [] [decl_d] [''Show, ''Eq] |
|
682 | 682 |
ser_decls <- buildObjectSerialisation sname fields |
683 | 683 |
return $ declD:ser_decls |
684 | 684 |
|
... | ... | |
836 | 836 |
fields_p <- mapM (paramFieldTypeInfo field_pfx) fields |
837 | 837 |
let decl_f = RecC name_f fields_f |
838 | 838 |
decl_p = RecC name_p fields_p |
839 |
let declF = DataD [] name_f [] [decl_f] [''Show, ''Read, ''Eq]
|
|
840 |
declP = DataD [] name_p [] [decl_p] [''Show, ''Read, ''Eq]
|
|
839 |
let declF = DataD [] name_f [] [decl_f] [''Show, ''Eq] |
|
840 |
declP = DataD [] name_p [] [decl_p] [''Show, ''Eq] |
|
841 | 841 |
ser_decls_f <- buildObjectSerialisation sname_f fields |
842 | 842 |
ser_decls_p <- buildPParamSerialisation sname_p fields |
843 | 843 |
fill_decls <- fillParam sname field_pfx fields |
Also available in: Unified diff