Skip to content

Commit

Permalink
nondecreasing export list formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
expipiplus1 committed Aug 28, 2020
1 parent 4b673d1 commit 67b8710
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 21 deletions.
11 changes: 4 additions & 7 deletions src-literatetests/10-tests.blt
Original file line number Diff line number Diff line change
Expand Up @@ -1001,8 +1001,7 @@ module Main
, test7
, test8
, test9
)
where
) where

#test exports-with-comments
module Main
Expand All @@ -1016,8 +1015,7 @@ module Main
-- Test 5
, test5
-- Test 6
)
where
) where

#test simple-export-with-things
module Main (Test(..)) where
Expand All @@ -1035,7 +1033,7 @@ module Main
( Test(Test, a, b)
, foo -- comment2
) -- comment3
where
where

#test export-with-empty-thing
module Main (Test()) where
Expand Down Expand Up @@ -1286,8 +1284,7 @@ module Test
, test9
, test10
-- Test 10
)
where
) where

-- Test
import Data.List ( nub ) -- Test
Expand Down
3 changes: 1 addition & 2 deletions src-literatetests/15-regressions.blt
Original file line number Diff line number Diff line change
Expand Up @@ -831,8 +831,7 @@ module Main
, DataTypeII(DataConstructor)
-- * Haddock heading
, name
)
where
) where

#test type level list

Expand Down
9 changes: 3 additions & 6 deletions src-literatetests/30-tests-context-free.blt
Original file line number Diff line number Diff line change
Expand Up @@ -675,8 +675,7 @@ module Main
, test7
, test8
, test9
)
where
) where

#test exports-with-comments
module Main
Expand All @@ -690,8 +689,7 @@ module Main
-- Test 5
, test5
-- Test 6
)
where
) where

#test simple-export-with-things
module Main (Test(..)) where
Expand Down Expand Up @@ -913,8 +911,7 @@ module Test
, test8
, test9
, test10
)
where
) where

-- Test
import Data.List (nub) -- Test
Expand Down
15 changes: 9 additions & 6 deletions src/Language/Haskell/Brittany/Internal/Layouters/Module.hs
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,24 @@ layoutModule lmod@(L _ mod') = case mod' of
$ docSeq
[ appSep $ docLit $ Text.pack "module"
, appSep $ docLit tn
, docWrapNode lmod $ appSep $ case les of
, (docWrapNode lmod $ appSep $ case les of
Nothing -> docEmpty
Just x -> layoutLLIEs True x
Just x -> layoutLLIEs True x)
, docSeparator
, docLit $ Text.pack "where"
]
addAlternative
$ docLines
[ docAddBaseY BrIndentRegular $ docPar
(docSeq [appSep $ docLit $ Text.pack "module", docLit tn]
)
(docWrapNode lmod $ case les of
Nothing -> docEmpty
Just x -> layoutLLIEs False x
(docSeq [ docWrapNode lmod $ case les of
Nothing -> docEmpty
Just x -> layoutLLIEs False x
, docSeparator
, docLit $ Text.pack "where"
]
)
, docLit $ Text.pack "where"
]
]
: map layoutImport imports

0 comments on commit 67b8710

Please sign in to comment.