[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:
> WHICH GOOD REASONS??

It is still there in the Haskell 2010 report.

The UHC user manual at
http://www.cs.uu.nl/groups/ST/Projects/ehc/ehc-user-doc.pdf
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
mynum.hs:3-11:
  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
http://hackage.haskell.org/platform/contents.html
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