[GHC] #11581: TypeError requires UndecidableInstances unnecessarily

GHC ghc-devs at haskell.org
Wed Feb 17 09:22:20 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:
 Type of failure:  GHC rejects       |  Unknown/Multiple
  valid program                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by bgamari):

 * cc: diatchki (added)
 * failure:  None/Unknown => GHC rejects valid program


@@ -2,1 +2,1 @@
- {{{
+ {{{#!hs
@@ -21,1 +21,1 @@
- {{{
+ {{{#!hs

New description:

 The example from the `TypeError` documentation
 {{{#!hs
 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
 {{{#!hs
 type family TypeError :: ErrorMessage -> b where
 }}}
 but it didn't help. Same error. Is that a bug?

--

Comment:

 Iavor, perhaps you can comment here?

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


More information about the ghc-tickets mailing list