• Simon Peyton Jones's avatar
    Fix top-level constraint handling (Trac #12921) · f5f6d423
    Simon Peyton Jones authored
    Some out-of-scope errors were not being reported if anyone
    throws an un-caught exception in the TcM monad.  That led to
    
      ghc: panic! (the 'impossible' happened)
    	initTc: unsolved constraints
    
    I fixed this
    
    * Splitting captureConstraints to use an auxilliary
      tryCaptureConstraints (which never fails)
    
    * Define a new TcSimplify.captureTopConstraints (replacing
      the old TcRnMonad.captureTopConstraints), which reports
      any unsolved out-of-scope constraints before propagating
      the exception
    
    That in turn allowed me to do some tidying up of the static-constraint
    machinery, reducing duplication.
    
    Also solves #13106.
    f5f6d423
TcSimplify.hs 90.7 KB