[GHC] #11990: Custom Type Error not getting triggered in the nested Type function call

GHC ghc-devs at haskell.org
Fri May 6 14:19:27 UTC 2016


#11990: Custom Type Error not getting triggered in the nested Type function call
-------------------------------------+-------------------------------------
        Reporter:  magesh.b          |                Owner:
            Type:  bug               |               Status:  merge
        Priority:  normal            |            Milestone:  8.0.2
       Component:  Compiler          |              Version:  8.0.1-rc3
      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 magesh.b):

 > If there are multiple `TypeErrors`, then we just report one of them.

 Consider the following class, whose instance has a contrived TypeError

 {{{
 class ShowHL (xs :: [*]) where
   showHL :: HList xs -> String

 instance (Show x, ShowHL xs, TypeError (ShowType x)) => ShowHL (x ': xs)
 where
   showHL (x :& xs) = show x ++ showHL xs
 }}}

 The error message emitted when this type class method is called with
 **showHL ('a' :& True :& Nil)** contains all the errors in one shot. This
 behavior is very useful and would this be retained after this fix?

 {{{
 MutiCE.hs:26:8: error:
     • Bool
     • In the expression: showHL testRec
       In an equation for ‘test’: test = showHL testRec

 MutiCE.hs:26:8: error:
     • Char
     • In the expression: showHL testRec
       In an equation for ‘test’: test = showHL testRec
 Failed, modules loaded: none.
 }}}

 I have attached the full source code which contains the test case for this
 behaviour

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


More information about the ghc-tickets mailing list