mirror of
https://github.com/digital-asset/daml.git
synced 2024-09-20 01:07:18 +03:00
Make records with less fields still abstract (#397)
This commit is contained in:
parent
14fdafede8
commit
a55c9cf7e5
@ -105,7 +105,7 @@ instanceTemplate abstract selector record field = ClsInstD noE $ ClsInstDecl noE
|
||||
|
||||
onDecl :: LHsDecl GhcPs -> [LHsDecl GhcPs]
|
||||
onDecl o@(L _ (GHC.TyClD _ x)) = o :
|
||||
[ noL $ InstD noE $ instanceTemplate (length fields >= 3 && length ctors == 1) field (unLoc record) typ
|
||||
[ noL $ InstD noE $ instanceTemplate (length ctors == 1) field (unLoc record) typ
|
||||
| let fields = nubOrdOn (\(_,_,x,_) -> GHC.occNameFS $ GHC.rdrNameOcc $ unLoc $ rdrNameFieldOcc x) $ getFields x
|
||||
, (record, _, field, typ) <- fields]
|
||||
where ctors = dd_cons $ tcdDataDefn x
|
||||
|
Loading…
Reference in New Issue
Block a user