[GHC] #8353: Easy way to defer type errors

#8353: Easy way to defer type errors ------------------------------------+------------------------------------- Reporter: goldfire | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: GHCi | Version: 7.6.3 Keywords: | Operating System: Unknown/Multiple Architecture: Unknown/Multiple | Type of failure: None/Unknown Difficulty: Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | ------------------------------------+------------------------------------- A number of comments I've heard recently have focused on the joy of `-fdefer-type-errors`, especially for newcomers to Haskell. However, in GHCi, one has to 1. be aware that `-fdefer-type-errors` exists 2. know the `:set ...` syntax to turn it on, and then 3. is stuck with this setting on until they turn it off Instead, I propose new `:load!` and `:reload!` commands (abbreviated to `:l!` and `:r!`) which turn on `-fdefer-type-errors` just for that one command. When a load or reload fails, the error message could suggest these alternate forms. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8353 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8353: Easy way to defer type errors -------------------------------------+------------------------------------- Reporter: goldfire | Owner: Type: feature | Status: new request | Milestone: Priority: normal | Version: 7.6.3 Component: GHCi | Keywords: Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: | Related Tickets: None/Unknown | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by thomie): * cc: hvr (added) Comment: Can you explain the "joy" of using '-fdefer-type-errors'? What is the intention of this ticket? Once #9497 is fixed, there will also be '-fdefer-typed-holes'. Would that change this ticket in any way? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8353#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8353: Easy way to defer type errors -------------------------------------+------------------------------------- Reporter: goldfire | Owner: Type: feature | Status: new request | Milestone: Priority: normal | Version: 7.6.3 Component: GHCi | Keywords: newcomer Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: | Related Tickets: None/Unknown | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by goldfire): * keywords: => newcomer Comment: Though I originally encountered my desire for this feature in a teaching setting, it happens in my own work, too. Say I have a big file with lots of definitions. Somewhere, there is a type error. To fix the type error, I need to check the types of other definitions in my file. But, I can't use GHCi to query my definitions, because the file has a type error. Urgh. So, today, I have to enable `-fdefer-type-errors`, load the file, see my type ''warnings'', and then query the definitions I need to fix everything up. A big annoyance of this workflow is that, now, `-fdefer-type-errors` is on and stays on until I reboot GHCi. None of this is the end of anybody's world, but I just think it would be easier for everyone -- particularly newcomers to Haskell -- if there were just a way to "force" loading, by enabling deferred type errors for one compilation. That's the proposal here. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8353#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8353: Easy way to defer type errors -------------------------------------+------------------------------------- Reporter: goldfire | Owner: Type: feature | Status: new request | Milestone: Priority: normal | Version: 7.6.3 Component: GHCi | Keywords: newcomer Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: | Related Tickets: None/Unknown | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by simonpj): You can say `:set -fno-defer-type-errors`. You don't need to reboot GHCi, do you? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8353#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8353: Easy way to defer type errors -------------------------------------+------------------------------------- Reporter: goldfire | Owner: Type: feature | Status: new request | Milestone: Priority: normal | Version: 7.6.3 Component: GHCi | Keywords: newcomer Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: | Related Tickets: None/Unknown | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by goldfire): Replying to [comment:3 simonpj]:
You can say `:set -fno-defer-type-errors`. You don't need to reboot GHCi, do you?
Oops. Of course. I still think this would be a nice feature. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8353#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8353: Easy way to defer type errors -------------------------------------+------------------------------------- Reporter: goldfire | Owner: Type: feature request | Status: patch Priority: normal | Milestone: Component: GHCi | Version: 7.6.3 Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: Phab:D960 -------------------------------------+------------------------------------- Changes (by triple): * status: new => patch * differential: => Phab:D960 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8353#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8353: Easy way to defer type errors -------------------------------------+------------------------------------- Reporter: goldfire | Owner: Type: feature request | Status: patch Priority: normal | Milestone: Component: GHCi | Version: 7.6.3 Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: Phab:D960 -------------------------------------+------------------------------------- Changes (by thomie): * cc: bgamari (added) Comment: Moving design discussion to Trac, so it gets some more attention. bgamari asks in Phab:D960:
Is there consensus that we want to expand the use of the ! suffix on GHCi commands? It seems to me like we might want to consider a slightly less cryptic (albeit more verbose) flag structure to expose this sort of functionality.
Currently we have: {{{ :ctags[!] [<file>] create tags file for Vi (default: "tags") (!: use regex instead of line number) :info[!] [<name> ...] display information about the given names (!: do not filter instances) :kind[!] <type> show the kind of <type> (!: also print the normalised type) }}} The patch in D960 adds: {{{ :load[!] [*]<module> ... load module(s) and their dependents (!: defer type errors) :reload[!] reload the current module set (!: defer type errors) }}} Seems all rather inconsistent, but not a huge problem either. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8353#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8353: Easy way to defer type errors -------------------------------------+------------------------------------- Reporter: goldfire | Owner: Type: feature request | Status: patch Priority: normal | Milestone: Component: GHCi | Version: 7.6.3 Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: Phab:D960 -------------------------------------+------------------------------------- Comment (by simonpj): It'd be good to get this one finished. I have no strong feelings. The user manual should document whatever happens though. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8353#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8353: Easy way to defer type errors -------------------------------------+------------------------------------- Reporter: goldfire | Owner: Type: feature request | Status: patch Priority: normal | Milestone: Component: GHCi | Version: 7.6.3 Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: Phab:D960 -------------------------------------+------------------------------------- Comment (by goldfire): For whatever it's worth, I haven't changed my mind about wanting this feature, nor the choice of concrete syntax. Thanks for putting together a patch! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8353#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8353: Easy way to defer type errors
-------------------------------------+-------------------------------------
Reporter: goldfire | Owner:
Type: feature request | Status: patch
Priority: normal | Milestone:
Component: GHCi | Version: 7.6.3
Resolution: | Keywords: newcomer
Operating System: Unknown/Multiple | Architecture:
Type of failure: None/Unknown | Unknown/Multiple
Blocked By: | Test Case:
Related Tickets: | Blocking:
| Differential Revisions: Phab:D960
-------------------------------------+-------------------------------------
Comment (by Thomas Miedema

#8353: Easy way to defer type errors -------------------------------------+------------------------------------- Reporter: goldfire | Owner: Type: feature request | Status: closed Priority: normal | Milestone: 7.12.1 Component: GHCi | Version: 7.6.3 Resolution: fixed | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | ghci/scripts/T8353 | Blocking: | Differential Revisions: Phab:D960 -------------------------------------+------------------------------------- Changes (by thomie): * status: patch => closed * testcase: => ghci/scripts/T8353 * resolution: => fixed * milestone: => 7.12.1 Comment: Thanks Benjamin. Hope to see you tackle another ticket soon. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8353#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC