[Haskell-cafe] rewrite rules
Simon Peyton-Jones
simonpj at microsoft.com
Tue Jun 23 11:59:13 EDT 2009
| I have a rewrite rule as follows:
|
| {-# RULES
| "transform/transform" forall (f::forall m. Monoid m => (a -> m) -> (b -
| > m))
| (g::forall m. Monoid m => (b -> m) -> (c
| -> m))
| (l::FMList c). transform f (transform g
| l) = transform (g.f) l
| #-}
|
| It fires on this code:
|
| print $ transform (. (*2)) (transform (. (+1)) (upto 10))
|
| But it doesn't fire on this code:
|
| print $ map (*2) (map (+1) (upto 10)))
That's odd. It works for me.
Specifically, I compiled the attached code with GHC 6.10, and I get two firings of transform/transform.
Does that not happen for you?
Simon
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Rules.hs
Type: application/octet-stream
Size: 658 bytes
Desc: Rules.hs
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20090623/d37dbba8/Rules.obj
More information about the Haskell-Cafe
mailing list