[NumericPrelude] Bug in Numeric Prelude or GHC?

Henning Thielemann lemming at henning-thielemann.de
Sat Jun 18 19:25:58 BST 2011


On Sat, 18 Jun 2011, Grigory Sarnitskiy wrote:

> And I have:
>
> *Main> negate b :: Expression Integer
> (-1) b
> *Main> zero - b :: Expression Integer
> 0 + (-1) b
> *Main> -b :: Expression Integer
>
> <interactive>:1:1:
>    No instance for (GHC.Num.Num (Expression Integer))
>      arising from a use of syntactic negation
>    Possible fix:
>      add an instance declaration for (GHC.Num.Num (Expression Integer))
>    In the expression: - b :: Expression Integer
>    In an equation for `it': it = - b :: Expression Integer
>
> I hoped that providing negate for my type would be enough to us -x instead of negate x. So I wonder is it a GHC issue of numeric-prelude's one?
>
> I'm using numeric-prelude 0.2.1, GHC 7.0.3, Ubuntu 11.04 64 bit.

Up to GHC-6.12 you needed to put
{-# LANGUAGE NoImplicitPrelude #-}
on top  of your module.



More information about the Numeric-Prelude mailing list