RE: Posible bug while optimizing? (Was: RULES for SPECIALIZ(E)ations)

2003-10-23 Thread Simon Peyton-Jones
while optimizing? (Was: RULES for SPECIALIZ(E)ations) | | An even simpler example, with just one module: | | --- | module Test where | | import Data.List (genericLength) | | {-# RULES | genericLength/length genericLength = length

Re: Posible bug while optimizing? (Was: RULES for SPECIALIZ(E)ations)

2003-10-22 Thread Juanma Barranquero
An even simpler example, with just one module: --- module Test where import Data.List (genericLength) {-# RULES genericLength/length genericLength = length #-} --- D:\...\hask

Re: Posible bug while optimizing? (Was: RULES for SPECIALIZ(E)ations)

2003-10-21 Thread Juanma Barranquero
But I'm getting an error on recompilations that I don't understand. It happens only with -O (or -On), AFAICS. On second (and less sleepy) thought, there's no mystery in it happening only with -O, as RULEs aren't used for non-optimizing compilations :) Still, it's weird to get an error on

RE: RULES for SPECIALIZ(E)ations

2003-10-20 Thread Simon Peyton-Jones
| | I suppose I'm being bitten by User's Guide 7.8.2: | | If more than one rule matches a call, GHC will choose one arbitrarily | to apply. | | even if a bit later it says: | | So a rule only matches if the types match too. | | Am I understanding right and it's that so? I think so.

RULES for SPECIALIZ(E)ations

2003-10-17 Thread Juanma Barranquero
I'm playing with rules, and I wonder if it is posible to define a rule that will trigger for a specialization of a function. (In the following examples, the functions are not necesarily useful or good-style... :) I have: count :: (Integral b) = (a - Bool) - [a] - b count = count' 0