[GHC] #15050: ScopedTypeVariables could allow more programs

GHC ghc-devs at haskell.org
Tue Apr 17 19:18:51 UTC 2018


#15050: ScopedTypeVariables could allow more programs
-------------------------------------+-------------------------------------
        Reporter:  nomeata           |                Owner:  (none)
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:  8.6.1
       Component:  Compiler          |              Version:  8.4.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 RyanGlScott):

 Another layer of inconsistency can be found between values and types. GHC
 accepts this:

 {{{#!hs
 data T a where
   MkT :: Bool -> T Bool

 f :: T a -> a
 f (MkT (y :: z)) = y
 }}}

 But not this:

 {{{#!hs
 type family F (t :: T a) :: a where
   F (MkT (y :: z)) = y
 }}}
 {{{
     • Expected kind ‘Bool’, but ‘(y :: z)’ has kind ‘z’
     • In the first argument of ‘MkT’, namely ‘(y :: z)’
       In the first argument of ‘F’, namely ‘(MkT (y :: z))’
       In the type family declaration for ‘F’
 }}}

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


More information about the ghc-tickets mailing list