From f55021d89b63f923f96276f47863366cc0cac3c1 Mon Sep 17 00:00:00 2001 From: Utku Demir Date: Wed, 14 Aug 2019 18:09:51 +1200 Subject: [PATCH] Fix printing of the rewrite rule names --- data/examples/declaration/rewrite-rule/basic-out.hs | 6 ++++++ data/examples/declaration/rewrite-rule/basic.hs | 6 ++++++ src/Ormolu/Printer/Meat/Declaration/Rule.hs | 7 +------ 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/data/examples/declaration/rewrite-rule/basic-out.hs b/data/examples/declaration/rewrite-rule/basic-out.hs index 6ad86c8..5408c14 100644 --- a/data/examples/declaration/rewrite-rule/basic-out.hs +++ b/data/examples/declaration/rewrite-rule/basic-out.hs @@ -27,3 +27,9 @@ "concat" xs `concat` ys = augment (\c n -> foldr c n xs) ys "map/Double" fmap f xs = foldr (++) f xs #-} + +{-# RULES +"fb' >\\ (Request b' fb )" forall fb' b' fb. + fb' >\\ (Request b' fb) = + fb' b' >>= \b -> fb' >\\ fb b + #-} diff --git a/data/examples/declaration/rewrite-rule/basic.hs b/data/examples/declaration/rewrite-rule/basic.hs index 54c980c..9d6758f 100644 --- a/data/examples/declaration/rewrite-rule/basic.hs +++ b/data/examples/declaration/rewrite-rule/basic.hs @@ -25,3 +25,9 @@ "concat" xs `concat` ys = augment (\c n -> foldr c n xs) ys; "map/Double" fmap f xs = foldr (++) f xs #-} + +{-# RULES + "fb' >\\ (Request b' fb )" forall fb' b' fb . + fb' >\\ (Request b' fb ) = fb' b' >>= \b -> fb' >\\ fb b; +#-} + diff --git a/src/Ormolu/Printer/Meat/Declaration/Rule.hs b/src/Ormolu/Printer/Meat/Declaration/Rule.hs index 6c6caf9..034c849 100644 --- a/src/Ormolu/Printer/Meat/Declaration/Rule.hs +++ b/src/Ormolu/Printer/Meat/Declaration/Rule.hs @@ -9,14 +9,12 @@ where import BasicTypes import Control.Monad -import FastString (unpackFS) import GHC import Ormolu.Printer.Combinators import Ormolu.Printer.Meat.Common import Ormolu.Printer.Meat.Declaration.Signature import Ormolu.Printer.Meat.Declaration.Value import Ormolu.Utils -import qualified Data.Text as T p_ruleDecls :: RuleDecls GhcPs -> R () p_ruleDecls = \case @@ -43,10 +41,7 @@ p_ruleDecl = \case XRuleDecl NoExt -> notImplemented "XRuleDecl" p_ruleName :: (SourceText, RuleName) -> R () -p_ruleName (_, name) = do - txt "\"" - txt $ T.pack $ unpackFS $ name - txt "\"" +p_ruleName (_, name) = atom $ HsString NoSourceText name p_ruleBndrs :: [LRuleBndr GhcPs] -> R () p_ruleBndrs [] = return ()