
#10789: Notify user when a kind mismatch holds up a type family reduction -------------------------------------+------------------------------------- Reporter: goldfire | Owner: v0d1ch Type: feature request | Status: new Priority: normal | Milestone: 8.8.1 Component: Compiler | Version: 7.10.2 Resolution: | Keywords: newcomer, | TypeFamilies Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #13192 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): Sasa asks (on ghc-devs) With the help of @int_index I found the place in TcErrors.hs where the error printing occurs and I think the check that I need to add will look similar to this one https://github.com/ghc/ghc/blob/master/compiler/typecheck/TcErrors.hs#L1935. So I guess that we need to check if one of the kinds of two types we are comparing defaults to * (or Type if you will) and then add new warning that will be more descriptive as to why the failure happened. Maybe there is a way to check if what we are comparing are actually type families so that would make the job easier I guess. Richard replies I don't think the problem is particular to `Type` or defaulting. Instead, the problem is when * one of the two mismatched types is a type family application * and the type family has equations that pattern-match on an invisible parameter, * and it's that invisible-parameter matching that's gone awry. Now that I think about it, detecting these particular conditions might be tricky: you might need to edit code in `FamInstEnv` that does type family equation lookup to return diagnostic information if a match fails. (I would look at `reduceTyFamApp_maybe`, and perhaps it can return something more interesting than Nothing in the failure case.) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10789#comment:18 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler