[GHC] #10054: Misleading error message from unsaturated type family application

GHC ghc-devs at haskell.org
Sun Feb 1 20:43:02 UTC 2015


#10054: Misleading error message from unsaturated type family application
-------------------------------------+-------------------------------------
        Reporter:  sherman           |                   Owner:
            Type:  bug               |                  Status:  closed
        Priority:  normal            |               Milestone:
       Component:  Compiler (Type    |                 Version:  7.8.3
  checker)                           |                Keywords:  type
      Resolution:  fixed             |  families, constraint kinds
Operating System:  MacOS X           |            Architecture:  x86_64
 Type of failure:  Incorrect         |  (amd64)
  warning at compile-time            |               Test Case:
      Blocked By:                    |                Blocking:
 Related Tickets:                    |  Differential Revisions:
-------------------------------------+-------------------------------------
Changes (by rwbarton):

 * status:  new => closed
 * resolution:   => fixed


Comment:

 Thanks for the report. As you correctly diagnosed, the program is invalid
 due to the undersaturated type family application in `Foo (Ap Show) a`.
 The fact that GHC does not report this error (and subsequently gets
 confused) was a regression introduced somewhere in the 7.8 line, but was
 fixed in 7.8.4.

 {{{
 rwbarton at morphism:/tmp$ ghc-7.8.1 Test
 [1 of 1] Compiling Main             ( Test.hs, Test.o )

 Test.hs:12:9:
     Type synonym ‘Ap’ should have 2 arguments, but has been given 1
     In the type signature for ‘test’:
       test :: Ap Show a => Foo (Ap Show) a
 rwbarton at morphism:/tmp$ ghc-7.8.3 Test
 [1 of 1] Compiling Main             ( Test.hs, Test.o )

 Test.hs:13:8:
     Could not deduce (Ap Show a) arising from a use of ‘MkFoo’
     from the context (Ap Show a)
       bound by the type signature for
                  test :: (Ap Show a) => Foo (Ap Show) a
       at Test.hs:12:9-36
     Relevant bindings include
       test :: Foo (Ap Show) a (bound at Test.hs:13:1)
     In the expression: MkFoo
     In an equation for ‘test’: test = MkFoo
 rwbarton at morphism:/tmp$ ghc-7.8.4 Test
 [1 of 1] Compiling Main             ( Test.hs, Test.o )

 Test.hs:12:9:
     Type synonym ‘Ap’ should have 2 arguments, but has been given 1
     In the type signature for ‘test’:
       test :: Ap Show a => Foo (Ap Show) a
 }}}

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


More information about the ghc-tickets mailing list