1
1
mirror of https://github.com/tweag/ormolu.git synced 2024-10-04 00:47:24 +03:00

Use isTrue/isFalse

This commit is contained in:
Brandon Chinn 2024-06-10 20:02:14 -07:00 committed by Mark Karpov
parent 94abee78ed
commit 0fb1b9cd6c
5 changed files with 8 additions and 7 deletions

View File

@ -105,7 +105,7 @@ library
base >=4.14 && <5,
binary >=0.8 && <0.9,
bytestring >=0.2 && <0.13,
choice >=0.1 && <0.3,
choice >=0.2.4.1 && <0.3,
containers >=0.5 && <0.8,
deepseq >=1.4 && <1.6,
directory ^>=1.3,
@ -176,7 +176,7 @@ test-suite tests
Cabal-syntax >=3.12 && <3.13,
QuickCheck >=2.14,
base >=4.14 && <5,
choice >=0.1 && <0.3,
choice >=0.2.4.1 && <0.3,
containers >=0.5 && <0.8,
directory ^>=1.3,
filepath >=1.2 && <1.6,

View File

@ -270,7 +270,7 @@ inferFixity ::
-- | The resulting fixity approximation
FixityApproximation
inferFixity debug rdrName (ModuleFixityMap m) =
if Choice.toBool debug
if Choice.isTrue debug
then
trace
(renderFixityJustification opName moduleName m result)

View File

@ -178,7 +178,7 @@ p_hsDoc hstyle needsNewline (L l str) = do
else newline >> txt "--"
space
unless (T.null x) (txt x)
when (Choice.toBool needsNewline) newline
when (Choice.isTrue needsNewline) newline
case l of
UnhelpfulSpan _ ->
-- It's often the case that the comment itself doesn't have a span

View File

@ -115,7 +115,7 @@ p_dataDecl style name tyVars getTyVarLoc p_tyVar fixity HsDataDefn {..} = do
if hasHaddocks dd_cons'
then newline
else
if Choice.toBool singleRecCon && compactLayoutAroundEquals
if Choice.isTrue singleRecCon && compactLayoutAroundEquals
then space
else breakpoint
equals
@ -126,7 +126,7 @@ p_dataDecl style name tyVars getTyVarLoc p_tyVar fixity HsDataDefn {..} = do
then newline >> txt "|" >> space
else space >> txt "|" >> space
sitcc' =
if hasHaddocks dd_cons' || not (Choice.toBool singleRecCon)
if hasHaddocks dd_cons' || Choice.isFalse singleRecCon
then sitcc
else id
sep s (sitcc' . located' (p_conDecl singleRecCon)) dd_cons'
@ -197,7 +197,7 @@ p_conDecl singleRecCon ConDeclH98 {..} =
switchLayout conDeclSpn $ do
p_rdrName con_name
breakpoint
inciIf (not (Choice.toBool singleRecCon)) (located l p_conDeclFields)
inciIf (Choice.isFalse singleRecCon) (located l p_conDeclFields)
InfixCon (HsScaled _ l) (HsScaled _ r) -> do
-- manually render these
let (lType, larg_doc) = splitDocTy l

View File

@ -7,6 +7,7 @@ packages:
extra-deps:
- ghc-lib-parser-9.10.1.20240511
- Cabal-syntax-3.12.0.0
- choice-0.2.4.1
nix:
packages: