[GHC] #12708: RFC: Representation polymorphic Num

GHC ghc-devs at haskell.org
Sat Oct 15 20:56:29 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 goldfire):

 Replying to [comment:3 Iceland_jack]:
 > Should this not be allowed when `minBound :: () -> a` is allowed?

 Because `blah :: Int#` is not allowed? This would actually be OK, because
 methods -- even nullary ones, like `minBound` are actually functions that
 take dictionaries. So we're OK here.

 And to your question in comment:2:

 You won't be able to supply a default implementation of these functions
 because of the Golden Rule of Representation Polymorphism: You may never
 bind a variable whose type is representation polymorphic. Your default
 implementation violates this rule. I'm wondering if a `default` type
 signature can help, somehow, but I don't see how to write it: there's no
 way of saying `NotAVariable k` as a constraint.

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


More information about the ghc-tickets mailing list