[GHC] #9548: Numerical type system problem
GHC
ghc-devs at haskell.org
Thu Sep 4 02:06:50 UTC 2014
#9548: Numerical type system problem
-------------------------------------+-------------------------------------
Reporter: vxanica | Owner:
Type: feature request | Status: new
Priority: normal | Milestone:
Component: libraries/base | Version: 7.8.3
Keywords: Number | Operating System:
Architecture: Unknown/Multiple | Unknown/Multiple
Difficulty: Unknown | Type of failure:
Blocked By: | None/Unknown
Related Tickets: | Test Case:
| Blocking:
| Differential Revisions:
-------------------------------------+-------------------------------------
Originally, in haskell 98 the factorial function
{{{#!hs
f 0 = 1
f n = n * f (n - 1)
}}}
has type Num a => a -> a, while after ghc 7.4 it requires Eq type class.
I suggest that Num type class should be redefined as
{{{#!hs
class Eq a => Num a where
...
}}}
Since all the numbers are equality checkable. we can be more aggressive to
have Order super class for numbers even complex numbers are not well
ordered.
I suppose that this is like the historical problem like Applicative should
be the super class of Monad.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9548>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list