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

Ian Lynagh igloo at earth.li
Mon Jun 25 14:31:09 EDT 2007


On Fri, Jun 22, 2007 at 11:37:15AM -0700, Dave Bayer wrote:
> 
> >       z = r Prelude.^ 3

I don't know if (^) in particular is what is causing you problems, but
IMO it has the wrong type; just as we have
    (!!)         ::                 [a] -> Int -> a
    genericIndex :: (Integral b) => [a] -> b   -> a
we should also have
    (^)          :: (Num a)             => a -> Int -> a
    genericPower :: (Num a, Integral b) => a -> b   -> a
(or some other function name).

I've mentioned this before, but until
    http://hackage.haskell.org/trac/haskell-prime/ticket/118
is resolved we don't know where to discuss it (the haskell-prime or
libraries list).


Incidentally, I am another person who wants to be warned when defaulting
happens because I don't want to actually use defaulting, but I would
have no objection to the warning being suppressed if someone has
explicitly given a "default" declaration (and thus, presumably, does
want to use defaulting).


Thanks
Ian



More information about the Haskell-Cafe mailing list