[GHC] #12569: TypeApplications doesn't allow unticked list constructors.

GHC ghc-devs at haskell.org
Sun Sep 4 14:26:17 UTC 2016


#12569: TypeApplications doesn't allow unticked list constructors.
-------------------------------------+-------------------------------------
           Reporter:  vagarenko      |             Owner:
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.0.1
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 TypeApplications doesn't allow unticked list constructor even when it is
 unambiguous:

 {{{
 GHCi, version 8.0.1: http://www.haskell.org/ghc/  :? for help
 > :set -XDataKinds
 > :set -XTypeApplications
 > :set -XScopedTypeVariables
 > :set -XKindSignatures
 > let foo :: forall (xs :: [Nat]). (); foo = ()
 > foo @'[0]
 ()
 > foo @[0]

 <interactive>:17:6: error:
     * Expected kind `[Nat]', but `[0]' has kind `*'
     * In the type `[0]'
       In the expression: foo @[0]
       In an equation for `it': it = foo @[0]

 <interactive>:17:7: error:
     * Expected a type, but `0' has kind `Nat'
     * In the type `[0]'
       In the expression: foo @[0]
       In an equation for `it': it = foo @[0]
 }}}
 why `[0]` has kind `*` here?

 However this is legal:
 {{{
 > let foo :: forall (x :: Bool). (); foo = ()
 > foo @True
 ()
 > foo @'True
 ()
 }}}

 and this is wierd:
 {{{
 > :set -XPolyKinds
 > let foo :: forall (x :: k). (); foo = ()
 > foo @'True

 <interactive>:12:6: error:
     * Expected a type, but 'True has kind `Bool'
     * In the type `True'
       In the expression: foo @True
       In an equation for `it': it = foo @True
 > foo @True

 <interactive>:13:6: error:
     * Expected a type, but 'True has kind `Bool'
     * In the type `True'
       In the expression: foo @True
       In an equation for `it': it = foo @True
 }}}

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


More information about the ghc-tickets mailing list