[GHC] #12882: Unexpected constraint when using ExistentialQuantification

GHC ghc-devs at haskell.org
Sun Nov 27 15:53:57 UTC 2016


#12882: Unexpected constraint when using ExistentialQuantification
-------------------------------------+-------------------------------------
        Reporter:  danilo2           |                Owner:
            Type:  bug               |               Status:  closed
        Priority:  normal            |            Milestone:
       Component:  Compiler (Type    |              Version:  8.0.1
  checker)                           |
      Resolution:  invalid           |             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 danilo2):

 rwbarton: hmm, I dont know so deeply how GHC solves the things under the
 hood, but I imagine GHC could easily allow such code:

 {{{
 class Foo a where foo :: a -> Int

 newtype ImplicitFoo a = Foo a => ImplicitFoo a

 getFoo :: ImplicitFoo a -> Int
 getFoo (ImplicitFoo a) = foo a
 }}}

 The constraint in the newtype just tells that if `ImplicitFoo` was ever
 constructed by somebody, the constraint was already met, so there is no
 need to check it again and pass along functions.

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


More information about the ghc-tickets mailing list