• Josef Svenningsson's avatar
    Fix #15344: use fail when desugaring applicative-do · 6635a3f6
    Josef Svenningsson authored
    Applicative-do has a bug where it fails to use the monadic fail method
    when desugaring patternmatches which can fail. See #15344.
    
    This patch fixes that problem. It required more rewiring than I had expected.
    Applicative-do happens mostly in the renamer; that's where decisions about
    scheduling are made. This schedule is then carried through the typechecker and
    into the desugarer which performs the actual translation. Fixing this bug
    required sending information about the fail method from the renamer, through
    the type checker and into the desugarer. Previously, the desugarer didn't
    have enough information to actually desugar pattern matches correctly.
    
    As a side effect, we also fix #16628, where GHC wouldn't catch missing
    MonadFail instances with -XApplicativeDo.
    6635a3f6
TcHsSyn.hs 78.1 KB