[Haskell-cafe] Are there arithmetic composition of functions?

Richard O'Keefe ok at cs.otago.ac.nz
Tue Mar 20 03:37:50 CET 2012

On 20/03/2012, at 2:27 PM, Jerzy Karczmarczuk wrote:

> Richard O'Keefe:
>>     class (Eq a, Show a) => Num a
>>       where (+) (-) (*) negate abs signum fromInteger
>> where functions are for good reason not members of Eq or Show.
> This is an old song, changed several times. I have no intention to discuss, but please, Richard O'Keefe:

It is still there in the Haskell 2010 report.

The UHC user manual at
lists differences between UHC and both Haskell 98 and
Haskell 2010, but is completely silent about any change to
the interface of class Num, and in fact compiling a test
program that does 'instance Num Foo' where Foo is *not* an
instance of Eq or Show gives me this response:

[1/1] Compiling Haskell                  mynum                  (mynum.hs)
EH analyses: Type checking
  Predicates remain unproven:
    preds: UHC.Base.Eq mynum.Foo: 

This is with ehc-1.1.3, Revision 2422:2426M,
the latest binary release, downloaded and installed today.
The release date was the 31st of January this year.

GHC 7.0.3 doesn't like it either.  I know ghc 7.4.1 is
out, but I use the Haskell Platform, and the currently
shipping version says plainly at
that it provides GHC 7.0.4.

You may have no intention of discussing the issue,
but it seems to *me* that "this will not work in 2012
Haskell compiler mostly conforming to Haskell 2010
because Haskell 2010 says it shouldn't work" is a pretty
sound position to take.

More information about the Haskell-Cafe mailing list