simple rewrite rule example

Jan Christiansen jac at informatik.uni-kiel.de
Tue Jun 22 02:32:52 EDT 2010


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




More information about the Glasgow-haskell-users mailing list