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

#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

#10284: Create a dedicated `TypeError` exception type -------------------------------------+------------------------------------- Reporter: kosmikus | Owner: kanetw Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by kanetw): * owner: => kanetw -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10284#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10284: Create a dedicated `TypeError` exception type -------------------------------------+------------------------------------- Reporter: kosmikus | Owner: kanetw Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by adamgundry): * cc: adamgundry (added) Comment: I think this is a good idea. kanetw, thanks very much for working on this and #10283! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10284#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10284: Create a dedicated `TypeError` exception type -------------------------------------+------------------------------------- Reporter: kosmikus | Owner: kanetw Type: feature request | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 7.10.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: phab:D866 -------------------------------------+------------------------------------- Changes (by kanetw): * status: new => patch * differential: => phab:D866 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10284#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10284: Create a dedicated `TypeError` exception type -------------------------------------+------------------------------------- Reporter: kosmikus | Owner: kanetw Type: feature request | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 7.10.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: phab:D866 -------------------------------------+------------------------------------- Comment (by kanetw): adamgundy, no problem! It's quite fun to do this stuff. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10284#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10284: Create a dedicated `TypeError` exception type -------------------------------------+------------------------------------- Reporter: kosmikus | Owner: kanetw Type: feature request | Status: patch Priority: normal | Milestone: Component: Core Libraries | Version: 7.10.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: phab:D866 -------------------------------------+------------------------------------- Changes (by simonpj): * cc: core-libraries-committee@… (added) * component: Compiler => Core Libraries Comment: Core Libraries folk: are you happy with this change? See Phab:D866 Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10284#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10284: Create a dedicated `TypeError` exception type -------------------------------------+------------------------------------- Reporter: kosmikus | Owner: kanetw Type: feature request | Status: patch Priority: normal | Milestone: Component: Core Libraries | Version: 7.10.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: phab:D866 -------------------------------------+------------------------------------- Comment (by ekmett): Makes sense to me. Erring on the side of improving the granularity of what you can catch is pretty much what we've done all along. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10284#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10284: Create a dedicated `TypeError` exception type -------------------------------------+------------------------------------- Reporter: kosmikus | Owner: kanetw Type: feature request | Status: patch Priority: normal | Milestone: Component: Core Libraries | Version: 7.10.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: phab:D866 -------------------------------------+------------------------------------- Comment (by snoyberg): +1 from me as well. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10284#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10284: Create a dedicated `TypeError` exception type
-------------------------------------+-------------------------------------
Reporter: kosmikus | Owner: kanetw
Type: feature request | Status: patch
Priority: normal | Milestone:
Component: Core Libraries | Version: 7.10.1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: None/Unknown | Unknown/Multiple
Blocked By: | Test Case:
Related Tickets: | Blocking:
| Differential Revisions: phab:D866
-------------------------------------+-------------------------------------
Comment (by Ben Gamari

#10284: Create a dedicated `TypeError` exception type -------------------------------------+------------------------------------- Reporter: kosmikus | Owner: kanetw Type: feature request | Status: closed Priority: normal | Milestone: Component: Core Libraries | Version: 7.10.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: phab:D866 -------------------------------------+------------------------------------- Changes (by kanetw): * status: patch => closed * resolution: => fixed -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10284#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10284: Create a dedicated `TypeError` exception type -------------------------------------+------------------------------------- Reporter: kosmikus | Owner: kanetw Type: feature request | Status: closed Priority: normal | Milestone: 7.12.1 Component: Core Libraries | Version: 7.10.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | typecheck/should_run/T10284 Blocked By: | Blocking: Related Tickets: | Differential Revisions: phab:D866 -------------------------------------+------------------------------------- Changes (by thomie): * testcase: => typecheck/should_run/T10284 * milestone: => 7.12.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10284#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10284: Create a dedicated `TypeError` exception type
-------------------------------------+-------------------------------------
Reporter: kosmikus | Owner: kanetw
Type: feature request | Status: closed
Priority: normal | Milestone: 8.0.1
Component: Core Libraries | Version: 7.10.1
Resolution: fixed | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
| typecheck/should_run/T10284
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): phab:D866
-------------------------------------+-------------------------------------
Comment (by RyanGlScott

#10284: Create a dedicated `TypeError` exception type -------------------------------------+------------------------------------- Reporter: kosmikus | Owner: kanetw Type: feature request | Status: merge Priority: normal | Milestone: 8.0.1 Component: Core Libraries | Version: 7.10.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | typecheck/should_run/T10284 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): phab:D866 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * cc: ekmett (added) * status: closed => merge -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10284#comment:13 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10284: Create a dedicated `TypeError` exception type -------------------------------------+------------------------------------- Reporter: kosmikus | Owner: kanetw Type: feature request | Status: closed Priority: normal | Milestone: 8.0.1 Component: Core Libraries | Version: 7.10.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | typecheck/should_run/T10284 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): phab:D866 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: merge => closed Comment: This has been merged to `ghc-8.0` as fc5ed862ef52efa6e02e291ce441a1300ccc6e9c. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10284#comment:14 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC