on master help sign in
Fix rendering of type signatures concerning several identifiers

Previously an extra space were erroneously inserted if the first identifier happened to be one character long.

commitae789a41b00bcdf8a620bdce957d7520e4ae7577 authorMark Karpov <markkarpov92@gmail.com> dateSun 26 Apr 2020, 22:36 (6 years ago) parent83d6dcb
3 files changed+19−4
data/examples/declaration/signature/type/multi-value-out.hs+5 data/examples/declaration/signature/type/multi-value.hs+5 src/Ormolu/Printer/Meat/Declaration/Signature.hs+9−4
data/examples/declaration/signature/type/multi-value-out.hs+5
@@ -2,6 +2,11 @@ foo, bar :: Int
22foo = 1
33bar = 2
44
5+a, b, c :: Int
6+a = 1
7+b = 2
8+c = 3
9+
510foo,
611 bar,
712 baz ::
data/examples/declaration/signature/type/multi-value.hs+5
@@ -2,6 +2,11 @@ foo, bar :: Int
22foo = 1
33bar = 2
44
5+a, b, c :: Int
6+a = 1
7+b = 2
8+c = 3
9+
510foo,
611 bar,
712 baz :: Int
src/Ormolu/Printer/Meat/Declaration/Signature.hs+9−4
@@ -48,11 +48,12 @@ p_typeSig indentTail (n : ns) hswc = do
4848 p_rdrName n
4949 if null ns
5050 then p_typeAscription hswc
51− else bool id inci indentTail $ do
51+ else do
5252 comma
5353 breakpoint
54− sep (comma >> breakpoint) p_rdrName ns
55− p_typeAscription hswc
54+ bool id inci indentTail $ do
55+ sep (comma >> breakpoint) p_rdrName ns
56+ p_typeAscription hswc
5657
5758p_typeAscription ::
5859 LHsSigWcType GhcPs ->
@@ -74,7 +75,11 @@ p_patSynSig ::
7475 R ()
7576p_patSynSig names hsib = do
7677 txt "pattern"
77− let body = p_typeSig False names HsWC {hswc_ext = NoExtField, hswc_body = hsib}
78+ let body =
79+ p_typeSig
80+ False
81+ names
82+ HsWC {hswc_ext = NoExtField, hswc_body = hsib}
7883 if length names > 1
7984 then breakpoint >> inci body
8085 else space >> body