[GHC] #11581: TypeError requires UndecidableInstances unnecessarily

GHC ghc-devs at haskell.org
Mon Feb 15 20:35:35 UTC 2016


#11581: TypeError requires UndecidableInstances unnecessarily
-------------------------------------+-------------------------------------
           Reporter:  rwbarton       |             Owner:
               Type:  feature        |            Status:  new
  request                            |
           Priority:  low            |         Milestone:
          Component:  Compiler       |           Version:  8.0.1-rc2
  (Type checker)                     |
           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:
-------------------------------------+-------------------------------------
 The example from the `TypeError` documentation
 {{{
 type family ByteSize x where
     ByteSize Word16   = 2
     ByteSize Word8    = 1
     ByteSize a        = TypeError (Text "The type " :<>: ShowType a :<>:
                                    Text " is not exportable.")
 }}}
 requires `UndecidableInstances`:
 {{{
 BS.hs:11:5: error:
     • The type family application ‘(TypeError ...)’
         is no smaller than the instance head
       (Use UndecidableInstances to permit this)
     • In the equations for closed type family ‘ByteSize’
       In the type family declaration for ‘ByteSize’
 }}}
 Obviously there's no real danger of undecidability here.

 I tried changing the declaration of `TypeError` to
 {{{
 type family TypeError :: ErrorMessage -> b where
 }}}
 but it didn't help. Same error. Is that a bug?

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


More information about the ghc-tickets mailing list