[GHC] #16287: :kind accepts bogus type

GHC ghc-devs at haskell.org
Tue Feb 5 11:55:13 UTC 2019


#16287: :kind accepts bogus type
-------------------------------------+-------------------------------------
        Reporter:  simonpj           |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.6.3
      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):

 From a quick glance, I would guess that the only reason for
 `check_syn_tc_app` calling `check_type` instead of `check_arg_type` is due
 to `LiberalTypeSynonyms`. For instance, consider this (where `T` is a type
 synonym)

 {{{
 λ> :set -XLiberalTypeSynonyms -XRankNTypes
 λ> type T a = a
 λ> :k T (forall a. a)
 }}}

 If you check `T`'s argument with `check_type` (as `check_syn_tc_app` does
 currently), then this will be accepted. If you check it with
 `check_arg_type`, however, it will be rejected:

 {{{
     Illegal polymorphic type: forall a. a
     GHC doesn't yet support impredicative polymorphism
 }}}

 The difference amounts to whether you set `ve_rank` to `synArgMonoType`
 (as `check_syn_tc_app` does before invoking `check_type`) or
 `tyConArgMonoType` (as `check_arg_type` does). Perhaps we can tweak
 `check_arg_type` so that it knows when to use `synArgMonoType`—it might be
 as simple as passing an extra `Bool` argument to `check_arg_type`
 indicating whether this is the argument to a type synonym or not.

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


More information about the ghc-tickets mailing list