on master help sign in
Fix printing of the rewrite rule names
f55021dUtku Demir
data/examples/declaration/rewrite-rule/basic-out.hs+6
@@ -27,3 +27,9 @@
27"concat" xs `concat` ys = augment (\c n -> foldr c n xs) ys
27"concat" xs `concat` ys = augment (\c n -> foldr c n xs) ys
28"map/Double" fmap f xs = foldr (++) f xs
28"map/Double" fmap f xs = foldr (++) f xs
29 #-}
29 #-}
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 @@
25"concat" xs `concat` ys = augment (\c n -> foldr c n xs) ys;
25"concat" xs `concat` ys = augment (\c n -> foldr c n xs) ys;
26"map/Double" fmap f xs = foldr (++) f xs
26"map/Double" fmap f xs = foldr (++) f xs
27 #-}
27 #-}
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
9
9
10import BasicTypes
10import BasicTypes
11import Control.Monad
11import Control.Monad
12−import FastString (unpackFS)
13import GHC
12import GHC
14import Ormolu.Printer.Combinators
13import Ormolu.Printer.Combinators
15import Ormolu.Printer.Meat.Common
14import Ormolu.Printer.Meat.Common
16import Ormolu.Printer.Meat.Declaration.Signature
15import Ormolu.Printer.Meat.Declaration.Signature
17import Ormolu.Printer.Meat.Declaration.Value
16import Ormolu.Printer.Meat.Declaration.Value
18import Ormolu.Utils
17import Ormolu.Utils
19−import qualified Data.Text as T
20
18
21p_ruleDecls :: RuleDecls GhcPs -> R ()
19p_ruleDecls :: RuleDecls GhcPs -> R ()
22p_ruleDecls = \case
20p_ruleDecls = \case
@@ -43,10 +41,7 @@ p_ruleDecl = \case
43 XRuleDecl NoExt -> notImplemented "XRuleDecl"
41 XRuleDecl NoExt -> notImplemented "XRuleDecl"
44
42
45p_ruleName :: (SourceText, RuleName) -> R ()
43p_ruleName :: (SourceText, RuleName) -> R ()
46−p_ruleName (_, name) = do
44+p_ruleName (_, name) = atom $ HsString NoSourceText name
47− txt "\""
48− txt $ T.pack $ unpackFS $ name
49− txt "\""
50
45
51p_ruleBndrs :: [LRuleBndr GhcPs] -> R ()
46p_ruleBndrs :: [LRuleBndr GhcPs] -> R ()
52p_ruleBndrs [] = return ()
47p_ruleBndrs [] = return ()