on master help sign in
Fix printing of result type in closed type families

Apparently ‘KindSig’ always means double colon, while ‘TyVarSig’ always means equal sign.

commite966848e524b54b228b3183ab152d3be021291da authormrkkrp <mark.karpov@tweag.io> dateSat 26 Oct 2019, 15:30 (7 years ago) parent07a6728
3 files changed+8−5
data/examples/declaration/type-families/closed-type-family/with-equal-sign-out.hs+2 data/examples/declaration/type-families/closed-type-family/with-equal-sign.hs+2 src/Ormolu/Printer/Meat/Declaration/TypeFamily.hs+4−5
data/examples/declaration/type-families/closed-type-family/with-equal-sign-out.hsnew file+2
@@ -0,0 +1,2 @@
1+type family TF a b = result where
2+ TF a b = Int
data/examples/declaration/type-families/closed-type-family/with-equal-sign.hsnew file+2
@@ -0,0 +1,2 @@
1+type family TF a b = result where
2+ TF a b = Int
src/Ormolu/Printer/Meat/Declaration/TypeFamily.hs+4−5
@@ -37,7 +37,7 @@ p_famDecl style FamilyDecl {..} = do
3737 inci
3838 (p_rdrName fdLName)
3939 (located' p_hsTyVarBndr <$> hsq_explicit)
40− let rsig = p_familyResultSigL (isJust fdInjectivityAnn) fdResultSig
40+ let rsig = p_familyResultSigL fdResultSig
4141 unless (isNothing rsig && isNothing fdInjectivityAnn) $
4242 space
4343 inci $ do
@@ -59,19 +59,18 @@ p_famDecl style FamilyDecl {..} = do
5959p_famDecl _ (XFamilyDecl NoExt) = notImplemented "XFamilyDecl"
6060
6161p_familyResultSigL ::
62− Bool ->
6362 Located (FamilyResultSig GhcPs) ->
6463 Maybe (R ())
65−p_familyResultSigL injAnn l =
64+p_familyResultSigL l =
6665 case l of
6766 L _ a -> case a of
6867 NoSig NoExt -> Nothing
6968 KindSig NoExt k -> Just $ do
70− if injAnn then txt "=" else txt "::"
69+ txt "::"
7170 breakpoint
7271 located k p_hsType
7372 TyVarSig NoExt bndr -> Just $ do
74− if injAnn then txt "=" else txt "::"
73+ txt "="
7574 breakpoint
7675 located bndr p_hsTyVarBndr
7776 XFamilyResultSig NoExt ->