[GHC] #12708: RFC: Representation polymorphic Num

GHC ghc-devs at haskell.org
Fri Oct 14 22:32:15 UTC 2016


#12708: RFC: Representation polymorphic Num
-------------------------------------+-------------------------------------
        Reporter:  Iceland_jack      |                Owner:
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Core Libraries    |              Version:  8.0.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by Iceland_jack):

 (I am concerned that it seems the instance resolution defaults to `Type`..
 if I remove the instances (and qualify the `fromInteger` views)

 {{{#!hs
 --   × × × REMOVED × × ×
 -- instance P.Num  a => Num  (a :: Type) where
 -- instance P.Show a => Show (a :: Type) where
 }}}

 the types of `show` and `(+)` are (let's give it a module name `UU`)

 {{{#!hs
 UU.fromInteger :: UU.Num  a => Integer -> a
 (UU.+)         :: UU.Num  a => a -> a -> a
 UU.show        :: UU.Show a => a -> String
 }}}

 whereas with those instances it seems to default to the `Type`, is this
 intended!

 {{{#!hs
 UU.fromInteger :: Prelude.Num a => Integer -> a
 (UU.+)         :: Prelude.Num a => a -> a -> a
 (UU.show')     :: Prelude.Show a => a -> String
 }}}
 )

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12708#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list