[GHC] #10284: Create a dedicated `TypeError` exception type

GHC ghc-devs at haskell.org
Fri Apr 10 15:01:17 UTC 2015


#10284: Create a dedicated `TypeError` exception type
-------------------------------------+-------------------------------------
              Reporter:  kosmikus    |             Owner:
                  Type:  feature     |            Status:  new
  request                            |         Milestone:
              Priority:  normal      |           Version:  7.10.1
             Component:  Compiler    |  Operating System:  Unknown/Multiple
              Keywords:              |   Type of failure:  None/Unknown
          Architecture:              |        Blocked By:
  Unknown/Multiple                   |   Related Tickets:
             Test Case:              |
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------
 Ticket #10283 discusses using `-fdefer-type-errors` to test that certain
 programs do not type check.

 In practice, this involves evaluating certain expressions to WHNF at run-
 time can checking whether they trigger an exception. Currently, it seems
 the exception to catch is an `ErrorCall` exception. It would be nice if we
 could very specifically catch type errors though. It's entirely possible
 that a critical test case that I want to be a type error mistakenly type-
 checks and then calls `error`. In such a situation, it's hard to
 distinguish such a true run-time error from a deferred type error. It
 would be much nicer if something like `TypeError` would be thrown instead
 of `ErrorCall`.

 Yes, it's currently possible to look at the text of the `ErrorCall` and
 check for certain text fragments in there, but that sounds extremely
 fragile to me.

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


More information about the ghc-tickets mailing list