More compact rendering of type family injectivity constraints

This commit is contained in:
Mark Karpov 2020-02-01 19:42:13 +01:00
parent a37765cbcb
commit 84c2a53349
3 changed files with 10 additions and 9 deletions

View File

@ -8,6 +8,9 @@
other cases of rendering of operators. [Issue
500](https://github.com/tweag/ormolu/issues/500).
* More compact rendering of type family injectivity constraints. [Issue
482](https://github.com/tweag/ormolu/issues/482).
## Ormolu 0.0.3.1
* Fixed rendering of record updates with the record dot preprocessor syntax

View File

@ -1,7 +1,6 @@
type family
Id a =
result
| result -> a where
result | result -> a where
Id a =
a
@ -10,8 +9,7 @@ type family
(a :: k)
b
c =
foo
| foo -> k b where
foo | foo -> k b where
G a b c =
(a, b)

View File

@ -11,7 +11,7 @@ where
import BasicTypes (LexicalFixity (..))
import Control.Monad
import Data.Maybe (isJust, isNothing)
import Data.Maybe (isNothing)
import GHC
import Ormolu.Printer.Combinators
import Ormolu.Printer.Meat.Common
@ -36,11 +36,11 @@ p_famDecl style FamilyDecl {fdTyVars = HsQTvs {..}, ..} = do
inci
(p_rdrName fdLName)
(located' p_hsTyVarBndr <$> hsq_explicit)
let rsig = p_familyResultSigL fdResultSig
unless (isNothing rsig && isNothing fdInjectivityAnn) space
let resultSig = p_familyResultSigL fdResultSig
unless (isNothing resultSig && isNothing fdInjectivityAnn) space
inci $ do
sequence_ rsig
when (isJust rsig && isJust fdInjectivityAnn) breakpoint
sequence_ resultSig
space
forM_ fdInjectivityAnn (located' p_injectivityAnn)
case mmeqs of
Nothing -> return ()