[jhc] How to fire jhc rules

Facundo Domínguez facundominguez at gmail.com
Mon Jan 17 23:45:33 CET 2011


Dear haskellers,
      In learning to use rules with jhc 0.7.6-3, I am trying to
compile the following test program with flags -f global-optimize -f
rules, but it seems I cannot get rule "hf" to fire. I've compiled the
program with ghc and the rule is applied in that case.

--------------------------
{-# NOINLINE f #-}
f x = x ++ "f"

{-# NOINLINE h #-}
h x = x++"h"

{-# RULES "hf" forall x. h (f x) = x  #-}

main = putStr (h (f "1"))
--------------------------

Rule "hf" is not preserving semantics so I can see if the rule is
applied by executing the result.

I would be thankful for any hint on how to get the rule applied as
well as how to get jhc to report which rules it has applied during
compilation.

Best,
Facundo



More information about the jhc mailing list