File tree 7 files changed +10
-28
lines changed
7 files changed +10
-28
lines changed Original file line number Diff line number Diff line change @@ -646,31 +646,13 @@ instance Pretty Expression where
646
646
convertTrailing Nothing = []
647
647
convertTrailing (Just (TrailingComment t)) = [LineComment (" " <> t)]
648
648
649
- -- Extract detached comments at the bottom.
650
- -- This uses a custom variant of span/spanJust/spanMaybe.
651
- -- Note that this is a foldr which walks from the bottom, but the lists
652
- -- are constructed in a way that they end up correct again.
653
- (binderComments, bindersWithoutComments) =
654
- foldr
655
- ( \ item (start, rest) -> case item of
656
- (Comments inner)
657
- | null rest ->
658
- -- Only move all non-empty-line trivia below the `in`
659
- let (comments, el) = break (== EmptyLine ) (reverse inner)
660
- in (reverse comments : start, Comments (reverse el) : rest)
661
- _ -> (start, item : rest)
662
- )
663
- ([] , [] )
664
- (unItems binders)
665
-
666
649
letPart = group $ pretty let_ <> hardline <> letBody
667
- letBody = nest $ prettyItems ( Items bindersWithoutComments)
650
+ letBody = nest $ prettyItems binders
668
651
inPart =
669
652
group $
670
653
pretty in_
671
654
<> hardline
672
- -- Take our trailing and inject it between `in` and body
673
- <> pretty (concat binderComments ++ preTrivia ++ convertTrailing trailComment)
655
+ <> pretty (preTrivia ++ convertTrailing trailComment)
674
656
<> pretty expr
675
657
pretty (Assert assert cond semicolon expr) =
676
658
group $
Original file line number Diff line number Diff line change 146
146
#6
147
147
148
148
d = 1 ;
149
+ #7
149
150
in
150
- #7
151
151
d
152
152
)
153
153
Original file line number Diff line number Diff line change 146
146
#6
147
147
148
148
d = 1 ;
149
+ #7
149
150
in
150
- #7
151
151
d
152
152
)
153
153
Original file line number Diff line number Diff line change @@ -148,8 +148,8 @@ rec {
148
148
[${ mkSectionName sectName } ]
149
149
''
150
150
+ toKeyValue { inherit mkKeyValue listsAsDuplicateKeys ; } sectValues ;
151
+ # map input to ini sections
151
152
in
152
- # map input to ini sections
153
153
mapAttrsToStringsSep "\n " mkSection attrsOfAttrs ;
154
154
155
155
# Generate an INI-style config file from an attrset
Original file line number Diff line number Diff line change @@ -151,8 +151,8 @@ rec {
151
151
[${ mkSectionName sectName } ]
152
152
''
153
153
+ toKeyValue { inherit mkKeyValue listsAsDuplicateKeys ; } sectValues ;
154
+ # map input to ini sections
154
155
in
155
- # map input to ini sections
156
156
mapAttrsToStringsSep "\n " mkSection attrsOfAttrs ;
157
157
158
158
# Generate an INI-style config file from an attrset
Original file line number Diff line number Diff line change 65
65
let
66
66
b = 0 ;
67
67
68
+ # foo
69
+ # bar
68
70
in
69
- # foo
70
- # bar
71
71
# baz
72
72
# qux
73
73
null ;
Original file line number Diff line number Diff line change 65
65
let
66
66
b = 0 ;
67
67
68
+ # foo
69
+ # bar
68
70
in
69
- # foo
70
- # bar
71
71
# baz
72
72
# qux
73
73
null ;
You can’t perform that action at this time.
0 commit comments