on master help sign in
Also add parentheses around TH-quoted qualified operators
commit46a1c221ab9e4f1c7570f04b891aed983e205305 authormrkkrp <mark.karpov@tweag.io> dateSun 21 Jul 2019, 12:36 (7 years ago) parent560c498
3 files changed+6−2
data/examples/declaration/splice/quotes-out.hs+2 data/examples/declaration/splice/quotes.hs+2 src/Ormolu/Printer/Meat/Declaration/Value.hs+2−2
data/examples/declaration/splice/quotes-out.hs+2
@@ -3,3 +3,5 @@ foo = ''R
33bar = 'foo
44
55baz = ''(:#)
6+
7+baz' = ''(Foo.Bar.:#)
data/examples/declaration/splice/quotes.hs+2
@@ -3,3 +3,5 @@ foo = ''R
33bar = 'foo
44
55baz = ''(:#)
6+
7+baz' = ''(Foo.Bar.:#)
src/Ormolu/Printer/Meat/Declaration/Value.hs+2−2
@@ -14,7 +14,7 @@ import Bag (bagToList)
1414import BasicTypes
1515import Control.Monad
1616import Data.Bool (bool)
17−import Data.Char (isAlphaNum)
17+import Data.Char (isPunctuation)
1818import Data.Data hiding (Infix, Prefix)
1919import Data.List (intersperse, sortOn)
2020import Data.Text (Text)
@@ -810,7 +810,7 @@ p_hsBracket = \case
810810 -- turn makes it impossible to detect if there are parentheses around
811811 -- it, etc. So we have to add parentheses manually assuming they are
812812 -- necessary for all operators.
813− let isOperator = not (any isAlphaNum (showOutputable name))
813+ let isOperator = any isPunctuation (showOutputable name)
814814 wrapper = if isOperator then parens else id
815815 wrapper $ p_rdrName (noLoc name)
816816 TExpBr NoExt expr -> do