Re: [Haskell-cafe] Bikeshedding request for GHCi's :type

I have collected feedback gleaned here, on the ticket, and on reddit and summarized here: https://ghc.haskell.org/trac/ghc/wiki/Design/GHCi/Type#Summaryoffeedbackabou...
That summary includes this concrete proposal:
1. Ask for concrete suggestions about names for the new commands.
2. Use these names on my current implementation (which prints out only one specialization)
3. Post a feature request looking for more specializations.
I simply don't have time to specify a design or implement an algorithm for printing out multiple specializations. Furthermore, my current implementation meets all specifications proffered for printing out multiple specializations, for all values of "multiple" that equal 1. It is easy to extend later.
Separately, there is a groundswell of support for :doc, but that's beyond the scope of my work on this point. (I personally would love :doc, too.)
So, what shall we name the two new commands?
1. A new command that specializes a type. (Currently with one specialization, but perhaps more examples in the future.)
2. A new command that preserves specialized type variables so that users of TypeApplications know what type parameters to pass in next.
I have suggested :type-def for (1) and :type-spec for (2). I don't strongly like either. :examples and :inst have been suggested for (1). Any other ideas?
Thanks!
Richard
On Apr 26, 2016, at 9:08 AM, Richard Eisenberg
Hi devs,
Over the weekend, I was pondering the Haskell course I will be teaching next year and shuddered at having to teach Foldable at the same time as `length`. So I implemented feature request #10963 (https://ghc.haskell.org/trac/ghc/ticket/10963), which allows for a way for a user to request a specialization of a type. It all works wonderfully, but there is a real user-facing design issue here around the default behavior of :type and whether or not to add new :type-y like commands. I have outlined the situation here: https://ghc.haskell.org/trac/ghc/wiki/Design/GHCi/Type
I'd love some broad input on this issue. If you've got a stake in how this all works, please skim that wiki page and comment on #10963.
Thanks! Richard _______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

On Mon, May 2, 2016, at 13:10, Richard Eisenberg wrote:
So, what shall we name the two new commands?
1. A new command that specializes a type. (Currently with one specialization, but perhaps more examples in the future.)
2. A new command that preserves specialized type variables so that users of TypeApplications know what type parameters to pass in next.
I have suggested :type-def for (1) and :type-spec for (2). I don't strongly like either. :examples and :inst have been suggested for (1). Any other ideas?
This might be overly pedantic of me, but :type-def seems way too similar to typedef, which means something entirely different in common parlance (even though we don't use that word in Haskell-land). We should at least call it :type-default; GHCi should be able to disambiguate the shorter :type-def. Also, I'd suggest making (1) and (2) optional flags for :type rather than new top-level commands. The shared prefix already suggests a common purpose, printing out the type of something, so why not make it even clearer that (1) and (2) are just specializations (heh) of :type? Eric

On May 2, 2016, at 4:36 PM, Eric Seidel
Also, I'd suggest making (1) and (2) optional flags for :type rather than new top-level commands. The shared prefix already suggests a common purpose, printing out the type of something, so why not make it even clearer that (1) and (2) are just specializations (heh) of :type?
Others have echoed this and I'm open to the idea. But I, personally, dislike this. All three commands are useful, and I expect I'll want to frequently interleave which one I want during a GHCi session. Controlling via a flag makes this awkward. But that's just my 2¢.
Eric _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe

What about :type for the normal behavior and :type! for specializations? With the notion that it could be extended to provide multiple specializations, I could also see :types (both meaning "display multiple example types" and serving as a mnemonic for :types[pecialization]) being viable.
On May 2, 2016, at 4:39 PM, Richard Eisenberg
wrote: On May 2, 2016, at 4:36 PM, Eric Seidel
wrote: Also, I'd suggest making (1) and (2) optional flags for :type rather than new top-level commands. The shared prefix already suggests a common purpose, printing out the type of something, so why not make it even clearer that (1) and (2) are just specializations (heh) of :type?
Others have echoed this and I'm open to the idea. But I, personally, dislike this. All three commands are useful, and I expect I'll want to frequently interleave which one I want during a GHCi session. Controlling via a flag makes this awkward.
But that's just my 2¢.
Eric _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe

+1 to ":types". Easy to remember as well: "Do I want one type, or multiple
types?".
On Mon, May 2, 2016 at 3:43 PM, Jack Henahan
What about :type for the normal behavior and :type! for specializations? With the notion that it could be extended to provide multiple specializations, I could also see :types (both meaning "display multiple example types" and serving as a mnemonic for :types[pecialization]) being viable.

On Mon, May 2, 2016, at 13:39, Richard Eisenberg wrote:
On May 2, 2016, at 4:36 PM, Eric Seidel
wrote: Also, I'd suggest making (1) and (2) optional flags for :type rather than new top-level commands. The shared prefix already suggests a common purpose, printing out the type of something, so why not make it even clearer that (1) and (2) are just specializations (heh) of :type?
Others have echoed this and I'm open to the idea. But I, personally, dislike this. All three commands are useful, and I expect I'll want to frequently interleave which one I want during a GHCi session. Controlling via a flag makes this awkward.
But that's just my 2¢.
Ah, I was talking about a different kind of flag this time. Instead of a GHCi-level flag (or maybe in addition to..), I was thinking about a flag specifically associated with an invocation of :type, e.g. ghci> :type length Foldable t => t a -> Int ghci> :type -default length [a] -> Int It's very nitpicky, I know, but I think the added grouping would be nice, in particular w.r.t. the output of :help. Eric

I'm inclined to agree with Richard on this. Flag based behavior pushes more
Complexity into the meaning of a command. Zero config is best config, and
thusly having easy way to distinguish these (using the power of names!) is
something I personally agree with
Perhaps just as importantly: ~/.ghci files are a thing, so it'd be easy for
folks to define custom short hands if they like. And we literally don't
know yet how instructional use will help refine what the end state should
be :)
On Monday, May 2, 2016, Richard Eisenberg
On May 2, 2016, at 4:36 PM, Eric Seidel
javascript:;> wrote: Also, I'd suggest making (1) and (2) optional flags for :type rather than new top-level commands. The shared prefix already suggests a common purpose, printing out the type of something, so why not make it even clearer that (1) and (2) are just specializations (heh) of :type?
Others have echoed this and I'm open to the idea. But I, personally, dislike this. All three commands are useful, and I expect I'll want to frequently interleave which one I want during a GHCi session. Controlling via a flag makes this awkward.
But that's just my 2¢.
Eric _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org javascript:; http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org javascript:; http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe

Hi Richard,
I like your decision and plan.
Thank you a lot of work, for community.
About new command name for (1):
Most users, perhaps, have entered the `:t` rather than `:type`.
ghci> :t length
In the same way, how about a full name and abbreviation name for (1).
For example, we prepare `:type-default` and `:td`.
ghci> :td length
So they don't misunderstand that it is "typedef".
I also like `:type!` and `:types` with Jack :)
ghci> :t! length
Regards,
Takenobu
2016-05-03 5:10 GMT+09:00 Richard Eisenberg
I have collected feedback gleaned here, on the ticket, and on reddit and summarized here: https://ghc.haskell.org/trac/ghc/wiki/Design/GHCi/Type#Summaryoffeedbackabou...
That summary includes this concrete proposal: 1. Ask for concrete suggestions about names for the new commands. 2. Use these names on my current implementation (which prints out only one specialization) 3. Post a feature request looking for more specializations.
I simply don't have time to specify a design or implement an algorithm for printing out multiple specializations. Furthermore, my current implementation meets all specifications proffered for printing out multiple specializations, for all values of "multiple" that equal 1. It is easy to extend later.
Separately, there is a groundswell of support for :doc, but that's beyond the scope of my work on this point. (I personally would love :doc, too.)
So, what shall we name the two new commands?
1. A new command that specializes a type. (Currently with one specialization, but perhaps more examples in the future.)
2. A new command that preserves specialized type variables so that users of TypeApplications know what type parameters to pass in next.
I have suggested :type-def for (1) and :type-spec for (2). I don't strongly like either. :examples and :inst have been suggested for (1). Any other ideas?
Thanks! Richard
On Apr 26, 2016, at 9:08 AM, Richard Eisenberg
wrote: Hi devs,
Over the weekend, I was pondering the Haskell course I will be teaching next year and shuddered at having to teach Foldable at the same time as `length`. So I implemented feature request #10963 ( https://ghc.haskell.org/trac/ghc/ticket/10963), which allows for a way for a user to request a specialization of a type. It all works wonderfully, but there is a real user-facing design issue here around the default behavior of :type and whether or not to add new :type-y like commands. I have outlined the situation here: https://ghc.haskell.org/trac/ghc/wiki/Design/GHCi/Type
I'd love some broad input on this issue. If you've got a stake in how this all works, please skim that wiki page and comment on #10963.
Thanks! Richard _______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
participants (6)
-
Carter Schonwald
-
Eric Seidel
-
Jack Henahan
-
Richard Eisenberg
-
Takenobu Tani
-
William Yager