[jhc] How to fire jhc rules

John Meacham john at repetae.net
Tue Jan 18 01:18:45 CET 2011


Hmm... I'll have to take a look at it. you shouldn't need the
global-optimizer or rules flags. There was a subtle bug that kept
rules from firing in the same module in which they were declared if
compiled directly and the module was not found in the cache. could you
try moving the use of h and f to another module and trying variations
of --no-ho too see if it can work? you could also try the latest darcs
version.

2011/1/17 Facundo Domínguez <facundominguez at gmail.com>:
> 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
>
> _______________________________________________
> jhc mailing list
> jhc at haskell.org
> http://www.haskell.org/mailman/listinfo/jhc
>



More information about the jhc mailing list