[GHC] #683: RULES for recursive functions don't work properly

Simon Marlow simonmarhaskell at gmail.com
Wed Feb 8 06:19:07 EST 2006


Bulat Ziganshin wrote:
> Hello GHC,
> 
> Tuesday, February 07, 2006, 8:03:49 PM, you wrote:
> 
> G> someone mentioned to me that this expression:
> 
> G>    mapM_ action [n..m]
> 
> G>  isn't being optimised properly, so I thought I'd look into it.  Sure
> 
> may be, what's me :)  i use specially written function as faster
> version of this idiom and suggested Simon Marlow to substitute "mapM
> [n..m]" with call to my function using RULE mechanism

The point is that it should already be optimised - both mapM_ and [n..m] 
work with foldr/build optimisation, but due to the problem reported in 
that ticket, foldr/build isn't working fully on this example.  Better to 
fix the cause of the problem than work around it with a special RULE.

Cheers,
	Simon


More information about the Glasgow-haskell-users mailing list