on master help sign in
More compact rendering of type family injectivity constraints
commit84c2a53349f92ea019e642bc922272198c084454 authorMark Karpov <markkarpov92@gmail.com> dateSat 1 Feb 2020, 19:42 (7 years ago) parenta37765c
3 files changed+10−9
CHANGELOG.md+3 data/examples/declaration/type-families/closed-type-family/multi-line-out.hs+2−4 src/Ormolu/Printer/Meat/Declaration/TypeFamily.hs+5−5
CHANGELOG.md+3
@@ -8,6 +8,9 @@
88 other cases of rendering of operators. [Issue
99 500](https://github.com/tweag/ormolu/issues/500).
1010
11+* More compact rendering of type family injectivity constraints. [Issue
12+ 482](https://github.com/tweag/ormolu/issues/482).
13+
1114## Ormolu 0.0.3.1
1215
1316* Fixed rendering of record updates with the record dot preprocessor syntax
data/examples/declaration/type-families/closed-type-family/multi-line-out.hs+2−4
@@ -1,7 +1,6 @@
11type family
22 Id a =
3− result
4− | result -> a where
3+ result | result -> a where
54 Id a =
65 a
76
@@ -10,8 +9,7 @@ type family
109 (a :: k)
1110 b
1211 c =
13− foo
14− | foo -> k b where
12+ foo | foo -> k b where
1513 G a b c =
1614 (a, b)
1715
src/Ormolu/Printer/Meat/Declaration/TypeFamily.hs+5−5
@@ -11,7 +11,7 @@ where
1111
1212import BasicTypes (LexicalFixity (..))
1313import Control.Monad
14−import Data.Maybe (isJust, isNothing)
14+import Data.Maybe (isNothing)
1515import GHC
1616import Ormolu.Printer.Combinators
1717import Ormolu.Printer.Meat.Common
@@ -36,11 +36,11 @@ p_famDecl style FamilyDecl {fdTyVars = HsQTvs {..}, ..} = do
3636 inci
3737 (p_rdrName fdLName)
3838 (located' p_hsTyVarBndr <$> hsq_explicit)
39− let rsig = p_familyResultSigL fdResultSig
40− unless (isNothing rsig && isNothing fdInjectivityAnn) space
39+ let resultSig = p_familyResultSigL fdResultSig
40+ unless (isNothing resultSig && isNothing fdInjectivityAnn) space
4141 inci $ do
42− sequence_ rsig
43− when (isJust rsig && isJust fdInjectivityAnn) breakpoint
42+ sequence_ resultSig
43+ space
4444 forM_ fdInjectivityAnn (located' p_injectivityAnn)
4545 case mmeqs of
4646 Nothing -> return ()