@@ -15,7 +15,7 @@ import Bag (bagToList)
1515import BasicTypes
1616import Control.Monad
1717import Data.Bool (bool)
18−import Data.Char (isPunctuation)
18+import Data.Char (isPunctuation, isSymbol)
1919import Data.Data hiding (Infix, Prefix)
2020import Data.List (intersperse, sortOn)
2121import Data.Text (Text)
@@ -843,8 +843,10 @@ p_hsBracket = \case
843843 -- turn makes it impossible to detect if there are parentheses around
844844 -- it, etc. So we have to add parentheses manually assuming they are
845845 -- necessary for all operators.
846− let isOperator = any isPunctuation (showOutputable (rdrNameOcc name))
847− && not (doesNotNeedExtraParens name)
846+ let isOperator = all
847+ (\i -> isPunctuation i || isSymbol i)
848+ (showOutputable (rdrNameOcc name))
849+ && not (doesNotNeedExtraParens name)
848850 wrapper = if isOperator then parens else id
849851 wrapper $ p_rdrName (noLoc name)
850852 TExpBr NoExt expr -> do