[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 <ben@…>): In [changeset:"9a3e1657db4c0292fc06d6183a802af631c3666a/ghc"]: {{{ #!CommitTicketReference repository="ghc" revision="9a3e1657db4c0292fc06d6183a802af631c3666a" Deferred type errors now throw TypeError (#10284) Depends on D864. Previous behaviour was ErrorCall, which might mask issues in tests using -fdefer-type-errors Signed-off-by: David Kraeutmann <kane@kane.cx> Test Plan: Test whether the error thrown is indeed TypeError and not ErrorCall. Reviewers: hvr, nomeata, austin Reviewed By: nomeata, austin Subscribers: nomeata, simonpj, thomie Differential Revision: https://phabricator.haskell.org/D866 GHC Trac Issues: #10284 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10284#comment:8> 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: 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 <ryan.gl.scott@…>): In [changeset:"a7ad0b91e7dace173ed95f31b221628d50c175e8/ghc" a7ad0b9/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="a7ad0b91e7dace173ed95f31b221628d50c175e8" Make TypeError a newtype, add changelog entry Summary: Phab:D866 added the `TypeError` datatype to `Control.Exception` to represent the error that is thrown when `-fdefer-type-errors` is on, but a changelog entry for it was never added. In addition, it should probably be a newtype. Reviewers: austin, hvr, KaneTW, bgamari Reviewed By: KaneTW, bgamari Subscribers: thomie, KaneTW Differential Revision: https://phabricator.haskell.org/D1873 GHC Trac Issues: #10284 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10284#comment:12> 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: 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