[GHC] #11581: TypeError requires UndecidableInstances unnecessarily

GHC ghc-devs at haskell.org
Sat Feb 20 17:38:26 UTC 2016


#11581: TypeError requires UndecidableInstances unnecessarily
-------------------------------------+-------------------------------------
        Reporter:  rwbarton          |                Owner:
            Type:  feature request   |               Status:  new
        Priority:  low               |            Milestone:
       Component:  Compiler (Type    |              Version:  8.0.1-rc2
  checker)                           |
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  GHC rejects       |            Test Case:  indexed-
  valid program                      |  types/should_compile/T11581
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by rwbarton):

 What exactly is the plan, though? This doesn't work even after a008eadf:
 {{{#!hs

 {-# LANGUAGE TypeFamilies, TypeInType, RankNTypes #-}

 module Arity where

 import GHC.Types
 import GHC.TypeLits hiding (TypeError)
 type family TypeError :: forall b. ErrorMessage -> b where {}

 type family T (a :: Type) :: Type where
   T t = TypeError (ShowType t)
 }}}
 {{{
 rwbarton at morphism:/tmp$ ~/ghc-newest/inplace/bin/ghc-stage2 -fprint-
 explicit-kinds Arity.hs
 [1 of 1] Compiling Arity            ( Arity.hs, Arity.o )

 Arity.hs:10:3: error:
     • The type family application ‘TypeError Type’
         is no smaller than the instance head
       (Use UndecidableInstances to permit this)
     • In the equations for closed type family ‘T’
       In the type family declaration for ‘T’
 }}}
 So I hope the plan involves changing the calculation of the arity of a
 type family to not include kind arguments that only appear in the result
 kind of the type family, or something like that.

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


More information about the ghc-tickets mailing list