jac: > Hi, > > I'd like to learn how to use ghc rewrite rules. I simply want to replace > a function called f by a function called g. I do not unterstand why the > rule f->g does not fire. > > Cheers, Jan > > > module Main where > > > {-# RULES > "f->g" forall x. f x = g x > #-} > > > main :: IO () > main = print (f 1) > > > {-# NOINLINE f #-} > f :: a -> Bool > f _ = False > > > g :: a -> Bool > g _ = True > >
Did you enable rewrite rules? $ ghc -fenable-rewrite-rules A.hs --make $ time ./A True ./A 0.01s user 0.00s system 88% cpu 0.011 total Using ghc-core: 1 RuleFired 1 f->g -- Don _______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users