on master help sign in
Fix type signature declarations for multiple values
1e6f4cdmrkkrp
data/examples/declaration/signature/type/multi-value-out.hsnew file+6
@@ -0,0 +1,6 @@
1+foo, bar :: Int
2+
3+foo
4+ , bar
5+ , baz
6+ :: Int
data/examples/declaration/signature/type/multi-value.hsnew file+5
@@ -0,0 +1,5 @@
1+foo, bar :: Int
2+
3+foo,
4+ bar,
5+ baz :: Int
src/Ormolu/Printer/Meat/Declaration/Signature.hs+10−3
@@ -35,9 +35,16 @@ p_typeSig
35 :: [Located RdrName] -- ^ Names (before @::@)
35 :: [Located RdrName] -- ^ Names (before @::@)
36 -> LHsSigWcType GhcPs -- ^ Type
36 -> LHsSigWcType GhcPs -- ^ Type
37 -> R ()
37 -> R ()
38−p_typeSig names hswc = do
38+p_typeSig [] _ = return () -- should not happen though
39+p_typeSig (n:ns) hswc = do
39− spaceSep p_rdrName names
40+ p_rdrName n
41+ if null ns
42+ then p_typeAscription hswc
43+ else inci $ do
44+ vlayout (return ()) newline
45+ comma
46+ velt (withSep comma p_rdrName ns)
40− p_typeAscription hswc
47+ p_typeAscription hswc
41
48
42p_typeAscription
49p_typeAscription
43 :: LHsSigWcType GhcPs
50 :: LHsSigWcType GhcPs