Fix whitespace regression on forall+constraint type sig

remotes/felixonmars/release
Lennart Spitzner 2019-11-08 12:08:16 +01:00
parent 9d0669d6a6
commit 974826f98f
2 changed files with 9 additions and 2 deletions

View File

@ -680,3 +680,7 @@ a = \x -> x
b = \ ~x -> x b = \ ~x -> x
c = \ !x -> x c = \ !x -> x
d = \(~x) -> x d = \(~x) -> x
#test type signature with forall and constraint
{-# LANGUAGE RankNTypes #-}
func :: forall b . Show b => b -> String

View File

@ -766,12 +766,15 @@ layoutTyVarBndrs = mapM $ \case
return $ (lrdrNameToText lrdrName, Just $ d) return $ (lrdrNameToText lrdrName, Just $ d)
#endif #endif
-- there is no specific reason this returns a list instead of a single
-- BriDoc node.
processTyVarBndrsSingleline processTyVarBndrsSingleline
:: [(Text, Maybe (ToBriDocM BriDocNumbered))] -> [ToBriDocM BriDocNumbered] :: [(Text, Maybe (ToBriDocM BriDocNumbered))] -> [ToBriDocM BriDocNumbered]
processTyVarBndrsSingleline bndrDocs = bndrDocs >>= \case processTyVarBndrsSingleline bndrDocs = bndrDocs >>= \case
(tname, Nothing) -> [docLit $ Text.pack " " <> tname] (tname, Nothing) -> [docSeparator, docLit tname]
(tname, Just doc) -> (tname, Just doc) ->
[ docLit $ Text.pack " (" <> tname <> Text.pack " :: " [ docSeparator
, docLit $ Text.pack "(" <> tname <> Text.pack " :: "
, docForceSingleline $ doc , docForceSingleline $ doc
, docLit $ Text.pack ")" , docLit $ Text.pack ")"
] ]