KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
As far as I can tell I wouldn't think it would make any difference that id1 and id2 are from a type class and id1' and id2' are not. I am running "ghc Rewrite" with the latest Haskell Platform (with both GHC version 7.0.4 and now 7.4.1 too), and I expect to1 to also fire. $ ghc Rewrite [1 of 1] Compiling RewriteProblems ( Rewrite.hs, Rewrite.o ) Rule fired: rewrite/ez' Rule fired: rewrite/to1' Rule fired: rewrite/ez Rule fired: rewrite/ez Rule fired: Class op id2 Rule fired: Class op id2 the example: {-# OPTIONS_GHC -O -ddump-rule-firings #-} module RewriteProblems where {-# RULES "rewrite/ez" forall a. id1 a = RDUnit "rewrite/to1" forall a. id2 (id2 a) = id1 a "rewrite/ez'" forall a. id1' a = RDUnit "rewrite/to1'" forall a. id2' (id2' a) = id1 a #-} class Ider a where id1 :: a -> a id2 :: a -> a data RewriteD = RDUnit instance Ider RewriteD where {-# INLINE[1] id1 #-} {-# INLINE[1] id2 #-} id1 a = RDUnit id2 a = RDUnit testThing1 :: RewriteD testThing1 = id1 RDUnit testThing2 :: RewriteD testThing2 = id2 (id2 RDUnit) testThing1' :: RewriteD testThing1' = id1' RDUnit testThing2' :: RewriteD testThing2' = id2' (id2' RDUnit) {-# INLINE[1] id1' #-} {-# INLINE[1] id2' #-} id1' :: RewriteD -> RewriteD id2' :: RewriteD -> RewriteD id1' a = RDUnit id2' a = RDUnit
Tags (comma-separated)
Save Edits
Cancel