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 @@ -632,31 +632,13 @@ instance Pretty Expression where
632
632
convertTrailing Nothing = []
633
633
convertTrailing (Just (TrailingComment t)) = [LineComment (" " <> t)]
634
634
635
- -- Extract detached comments at the bottom.
636
- -- This uses a custom variant of span/spanJust/spanMaybe.
637
- -- Note that this is a foldr which walks from the bottom, but the lists
638
- -- are constructed in a way that they end up correct again.
639
- (binderComments, bindersWithoutComments) =
640
- foldr
641
- ( \ item (start, rest) -> case item of
642
- (Comments inner)
643
- | null rest ->
644
- -- Only move all non-empty-line trivia below the `in`
645
- let (comments, el) = break (== EmptyLine ) (reverse inner)
646
- in (reverse comments : start, Comments (reverse el) : rest)
647
- _ -> (start, item : rest)
648
- )
649
- ([] , [] )
650
- (unItems binders)
651
-
652
635
letPart = group $ pretty let_ <> hardline <> letBody
653
- letBody = nest $ prettyItems ( Items bindersWithoutComments)
636
+ letBody = nest $ prettyItems binders
654
637
inPart =
655
638
group $
656
639
pretty in_
657
640
<> hardline
658
- -- Take our trailing and inject it between `in` and body
659
- <> pretty (concat binderComments ++ preTrivia ++ convertTrailing trailComment)
641
+ <> pretty (preTrivia ++ convertTrailing trailComment)
660
642
<> pretty expr
661
643
pretty (Assert assert cond semicolon expr) =
662
644
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