[GHC] #9548: Numerical type system problem

#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

#9548: Numerical type system problem -------------------------------------+------------------------------------- Reporter: vxanica | Owner: Type: feature | Status: new request | Milestone: Priority: normal | Version: 7.8.3 Component: | Keywords: Number libraries/base | Architecture: Unknown/Multiple Resolution: | Difficulty: Unknown Operating System: | Blocked By: Unknown/Multiple | Related Tickets: Type of failure: | None/Unknown | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by ekmett): All numbers do not have a decidable notion of equality. {{{ instance Num b => Num (a -> b) }}} is the most common example, but computable reals and purely symbolic numeric types are other counter examples. GHC 7.4 deliberately made a breaking change away from the Haskell 98 standard to avoid forcing users to lie about equalities that couldn't exist. Going back on that decision would be a mistake. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9548#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9548: Numerical type system problem -------------------------------------+------------------------------------- Reporter: vxanica | Owner: Type: feature | Status: new request | Milestone: Priority: normal | Version: 7.8.3 Component: | Keywords: Number libraries/base | Architecture: Unknown/Multiple Resolution: | Difficulty: Unknown Operating System: | Blocked By: Unknown/Multiple | Related Tickets: Type of failure: | None/Unknown | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by dolio): I'm in the same camp as ekmett. Some numeric types do not have decidable equality, and the current state of affairs is not a mistake (or at least, is less mistaken than the old one). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9548#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9548: Numerical type system problem -------------------------------------+------------------------------------- Reporter: vxanica | Owner: Type: feature | Status: closed request | Milestone: Priority: lowest | Version: 7.8.3 Component: | Keywords: Number libraries/base | Architecture: Unknown/Multiple Resolution: wontfix | Difficulty: Easy (less than 1 Operating System: | hour) Unknown/Multiple | Blocked By: Type of failure: GHC | Related Tickets: rejects valid program | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by ekmett): * priority: normal => lowest * difficulty: Unknown => Easy (less than 1 hour) * status: new => closed * resolution: => wontfix * failure: None/Unknown => GHC rejects valid program -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9548#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC