RULES pragmas

Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk
Tue Jul 11 09:33:51 EDT 2006


I have a question about {-# RULES #-} pragmas.  Here is a very simple
attempt to use them:

    module Simplest where
    {-# RULES
    "simplestRule"       forall x.   id (id x) = x
      #-}
    myDefn = id (id 42)

I want to verify whether ghc-6.4.1 does actually fire this rule, but
have so far been unable to do so.  According to the manual (section
7.10.5), the flag -ddump-rules should list "simplestRule" if it has been
parsed correctly, and -ddump-simpl-stats should list the number of times
it has fired.  But it does not appear in either listing.

Reasoning that I have the syntax wrong, I have tried numerous variations
on the indentation, added type signatures, etc., all to no avail.

So what am I doing wrong?  And is there any way to ask the compiler to
give a warning if the RULES pragma contains errors?

Regards,
    Malcolm


More information about the Glasgow-haskell-users mailing list