on master help sign in
Fix printing of the rewrite rule names
commitf55021d89b63f923f96276f47863366cc0cac3c1 authorUtku Demir <me@utdemir.com> dateWed 14 Aug 2019, 18:09 (7 years ago) parenta392aef
3 files changed+13−6
data/examples/declaration/rewrite-rule/basic-out.hs+6 data/examples/declaration/rewrite-rule/basic.hs+6 src/Ormolu/Printer/Meat/Declaration/Rule.hs+1−6
data/examples/declaration/rewrite-rule/basic-out.hs+6
@@ -27,3 +27,9 @@
2727"concat" xs `concat` ys = augment (\c n -> foldr c n xs) ys
2828"map/Double" fmap f xs = foldr (++) f xs
2929 #-}
30+
31+{-# RULES
32+"fb' >\\ (Request b' fb )" forall fb' b' fb.
33+ fb' >\\ (Request b' fb) =
34+ fb' b' >>= \b -> fb' >\\ fb b
35+ #-}
data/examples/declaration/rewrite-rule/basic.hs+6
@@ -25,3 +25,9 @@
2525"concat" xs `concat` ys = augment (\c n -> foldr c n xs) ys;
2626"map/Double" fmap f xs = foldr (++) f xs
2727 #-}
28+
29+{-# RULES
30+ "fb' >\\ (Request b' fb )" forall fb' b' fb .
31+ fb' >\\ (Request b' fb ) = fb' b' >>= \b -> fb' >\\ fb b;
32+#-}
33+
src/Ormolu/Printer/Meat/Declaration/Rule.hs+1−6
@@ -9,14 +9,12 @@ where
99
1010import BasicTypes
1111import Control.Monad
12−import FastString (unpackFS)
1312import GHC
1413import Ormolu.Printer.Combinators
1514import Ormolu.Printer.Meat.Common
1615import Ormolu.Printer.Meat.Declaration.Signature
1716import Ormolu.Printer.Meat.Declaration.Value
1817import Ormolu.Utils
19−import qualified Data.Text as T
2018
2119p_ruleDecls :: RuleDecls GhcPs -> R ()
2220p_ruleDecls = \case
@@ -43,10 +41,7 @@ p_ruleDecl = \case
4341 XRuleDecl NoExt -> notImplemented "XRuleDecl"
4442
4543p_ruleName :: (SourceText, RuleName) -> R ()
46−p_ruleName (_, name) = do
47− txt "\""
48− txt $ T.pack $ unpackFS $ name
49− txt "\""
44+p_ruleName (_, name) = atom $ HsString NoSourceText name
5045
5146p_ruleBndrs :: [LRuleBndr GhcPs] -> R ()
5247p_ruleBndrs [] = return ()