
#13649: RebindableSyntax causes type errors when 'fail' is not defined, even if not used. -------------------------------------+------------------------------------- Reporter: AaronFriel | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1-rc1 Resolution: | Keywords: | RebindableSyntax 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: | -------------------------------------+------------------------------------- Comment (by nomeata): That is indeed a good question. It seems that the type signature of `fail` is ignored completely. This might indicate that the renamer requires `fail` to be present, but that the type-checker does not see it. And `compiler/deSugar/DsExpr.hs` definitely does not emit a call to `fail` if the match can fail. In function `tcMonadFailOp` the `fail` part of a bind is only type-checked if the pattern can fail, using `isIrrefutableHsPat`. Potentially, the local function `getFailFunction` in {{{ rnStmt ctxt rnBody (L loc (BindStmt pat body _ _ _)) thing_inside }}} could do the same. Is that enough pointing-the-way for you to try to fix this? If you do, make a good note somewhere explaining the interplay of how the renamer, the type checker and the desugarer decide whether to assume a call to the `fail` function or not. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13649#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler