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

GHC ghc-devs at haskell.org
Mon Aug 15 18:37:59 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 dfeuer):

 Replying to [comment:31 Iceland_jack]:
 >
 > {{{#!hs
 > data LanO j where
 >   LanO :: LanO (S i)
 >
 > data LanS j where
 >   LanS :: Fin i -> LanS (S i)
 > }}}
 >
 > `Fin` defined as

 > Do `LanO`, `LanS` satisfy the conditions to be newtypes?

 `LanO` does not, because its constructor takes no arguments. But that's
 perfectly fine; there's only one `LanO` value anyway. `LanS` does not
 either, because its constructor is lazy. If you wrote `LanS :: !(Fin i) ->
 LanS (S i)` then it would satisfy the conditions.

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


More information about the ghc-tickets mailing list