[GHC] #10972: Add a :binfo (beginner info) GHCi command

#10972: Add a :binfo (beginner info) GHCi command -------------------------------------+------------------------------------- Reporter: kanetw | Owner: Type: feature | Status: new request | Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.10.2 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: #10963 Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- From goldfire:
Add a new command to GHCi, :binfo (for "beginner info") (please suggest a better name) that is like :info but presents different information. It suppresses in-scope instances, but attempts to specialize a function's type and presents specializations, using heuristics. So when we say :binfo find, we'll see Foldable t => (a -> Bool) -> t a -> Maybe a but also (a -> Bool) -> [a] -> Maybe a.
-- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10972 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10972: Add a :binfo (beginner info) GHCi command -------------------------------------+------------------------------------- Reporter: kanetw | Owner: kanetw Type: feature request | Status: new Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #10963 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by kanetw): * owner: => kanetw -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10972#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10972: Add a :binfo (beginner info) GHCi command -------------------------------------+------------------------------------- Reporter: kanetw | Owner: kanetw Type: feature request | Status: new Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #10963 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by kanetw): What kind of specializations should be displayed? Displaying every possible specialization is impractical even if we restrict to unary typeclasses (consider `Num`). I think specializing for types with special notation like `[]` or `(->)` would be most useful: {{{#!hs
:binfo find find :: Foldable t => (a -> Bool) -> t a -> Maybe a Specializations: t ~ [] -> find :: (a -> Bool) -> [a] -> Maybe a
:binfo first first :: Arrow a => a b c -> a (b, d) (c, d) Specializiations: a ~ (->) -> first :: (b -> c) -> (b, d) -> (c, d) }}}
Having something like `find :: (a -> Bool) -> Set a -> Maybe a` doesn't really help a lot in my opinion. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10972#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10972: Add a :binfo (beginner info) GHCi command -------------------------------------+------------------------------------- Reporter: kanetw | Owner: kanetw Type: feature request | Status: new Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #10963 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by goldfire): Here's an idea: use the `default` list. We could even add `(->)` to that list. It would be otherwise pointless, but by putting it in the list, we get the specialization behavior above. And it's user-customizable. So if, say, an instructor is using a custom list type or introducing the `Foldable Maybe` instance, that person could then just change the `default` list and get the new specializations. The `default` list also tends to be somewhat short, yielding about the right number of specializations in the output. We could also consider just adding this behavior to `:info`. Perhaps a quick user poll is in order? Nitpick: I would prefer we "specialise" instead of "specialize". Since we're writing the '''Glasgow''' Haskell Compiler, it seems we should use the variant of English spoken (wait -- English spoken in Glasgow is nigh incomprehensible, to me at least)... er... ''written'' in Glasgow. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10972#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10972: Add a :binfo (beginner info) GHCi command -------------------------------------+------------------------------------- Reporter: kanetw | Owner: kanetw Type: feature request | Status: new Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #10963 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by kanetw): I'll write out a specification soon[tm] (https://ghc.haskell.org/trac/ghc/wiki/Proposal/SpecializationInfo). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10972#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10972: Add a :binfo (beginner info) GHCi command -------------------------------------+------------------------------------- Reporter: kanetw | Owner: kanetw Type: feature request | Status: new Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #10963 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by goldfire): A few thoughts: we should only print out specialisations of class- constrained parameters (never parametric ones), and we have to worry about a combinatorial number of these if there are multiple constraints. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10972#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10972: Add a :binfo (beginner info) GHCi command -------------------------------------+------------------------------------- Reporter: kanetw | Owner: kanetw Type: feature request | Status: new Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #10963 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by George): +1 a good idea, will make existing books etc more useable with the latest software -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10972#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10972: Add a :binfo (beginner info) GHCi command -------------------------------------+------------------------------------- Reporter: kanetw | Owner: kanetw Type: feature request | Status: new Priority: normal | Milestone: 8.4.1 Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #10963 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * milestone: 8.2.1 => 8.4.1 Comment: This won't be happening for 8.2. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10972#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10972: Add a :binfo (beginner info) GHCi command -------------------------------------+------------------------------------- Reporter: kanetw | Owner: kanetw Type: feature request | Status: new Priority: normal | Milestone: 8.4.1 Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #10963 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by bgamari): KaneTW, what ever happened to this? I agree that it sounds like a very helpful feature for newcomers. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10972#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10972: Add a :binfo (beginner info) GHCi command -------------------------------------+------------------------------------- Reporter: kanetw | Owner: kanetw Type: feature request | Status: new Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #10963 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * milestone: 8.4.1 => 8.6.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10972#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10972: Add a :binfo (beginner info) GHCi command -------------------------------------+------------------------------------- Reporter: kanetw | Owner: kanetw Type: feature request | Status: new Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #10963 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by kanetw): It kind of fell by the wayside. I'll put it on my to-do list. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10972#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC