[Haskell-cafe] Best idiom for avoiding Defaulting warnings with ghc -Wall -Werror ??

Dave Bayer bayer at cpw.math.columbia.edu
Fri Jun 22 18:18:40 EDT 2007

On Jun 22, 2007, at 12:34 PM, Dave Bayer wrote:

> In particular, I always want defaulting errors, because sometimes I  
> miss the fact that numbers I can count on my fingers are defaulting  
> to Integer.

So no one took the bait to actually offer me a shorter idiom, but I  
thought about the above sentence, and had a big Homer Simpson "Doh!"  
revelation. In the acual code I was cleaning up, just write out the  
exponentiations, for example,

> evalBezier :: R -> Bezier -> [R]
> evalBezier t b = let s = 1-t in case b of
>     Line x y -> s*.x .+. t*.y
>     Cubic w x y z -> s*s*s*.w .+. 3*s*s*t*.x .+. 3*s*t*t*.y .+.  
> t*t*t*.z

To my taste, that's much prettier than half a dozen lines of  
declarations to get ^ to behave with ghc -Wall -Werror, and after all  
I'm just hand-unrolling the code for ^.

More information about the Haskell-Cafe mailing list