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

GHC ghc-devs at haskell.org
Tue Jul 1 03:38:10 UTC 2014


#1965: Allow unconstrained existential contexts in newtypes
-------------------------------------+------------------------------------
        Reporter:  guest             |            Owner:
            Type:  feature request   |           Status:  new
        Priority:  normal            |        Milestone:  7.6.2
       Component:  Compiler          |          Version:  6.8.1
      Resolution:                    |         Keywords:
Operating System:  Unknown/Multiple  |     Architecture:  Unknown/Multiple
 Type of failure:  None/Unknown      |       Difficulty:  Unknown
       Test Case:                    |       Blocked By:
        Blocking:                    |  Related Tickets:
-------------------------------------+------------------------------------

Comment (by pumpkin):

 To be clear about what I'm looking for:

 {{{
 #!haskell
 data IntList where
   Nil :: IntList
   Cons :: Int -> IntList -> IntList

 data Nat = Z | S Nat

 data IntVec :: Nat -> * where
    NilV :: IntVec Z
    ConsV :: Int -> IntVec n -> IntVec (S n)

 -- N.B: not data
 newtype Exists (f :: k -> *) = forall x. Exists (f x)

 type IntVecList = Exists IntVec

 -- IntVec and IntVecList should be isomorphic! If Exists can't be a
 newtype, I have to pay a penalty for adding indices to my type :(
 }}}

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


More information about the ghc-tickets mailing list