[GHC] #1965: Allow unconstrained existential contexts in newtypes

GHC ghc-devs at haskell.org
Tue Mar 29 15:50:29 UTC 2016


#1965: Allow unconstrained existential contexts in newtypes
-------------------------------------+-------------------------------------
        Reporter:  guest             |                Owner:
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  6.8.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 ryantrinkle):

 Hmm, when I try to convert it to a newtype, like this:

 {{{
 newtype Some tag = forall t. This (tag t)
 }}}

 I get this error:

 {{{
 src/Data/Some.hs:17:20:
     A newtype constructor cannot have existential type variables
     This :: forall (k :: BOX) (tag :: k -> *) (t :: k).
             tag t -> Some tag
     In the definition of data constructor ‘This’
     In the newtype declaration for ‘Some’
 }}}


 Is there a different way of converting it to a newtype that I'm
 overlooking?

 Here's a link to the original source of that Some:
 https://hackage.haskell.org/package/dependent-sum-0.3.2.1/docs/src/Data-
 Some.html#Some .  The Hoogle output is more confusing to me than the
 original.

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


More information about the ghc-tickets mailing list