Making rule application less fragile

John Meacham john at repetae.net
Fri Mar 14 13:28:31 EDT 2008


Note also that you are attaching your rule to 'fmap', however, since
your rule only applies to the 'Parser' monad (if I am reading it
properly) then 'fmap' will have been replaced by the 'fmap' in the
Functor Parser instance. So you would probably be better off doing
something like

instance Functor Parser where
        fmap = parserFmap

{-# RULES forall x . parserFmap S.pack ( ...

Also, you have to be careful attaching rules to functions you don't
define, as you don't know how it will interact with other rules, inline
pragmas or whatnot that might already be attached to that function.

        John


-- 
John Meacham - ⑆repetae.net⑆john⑈


More information about the Glasgow-haskell-users mailing list