[GHC] #12030: GHCi Proposal: Display (Data.Kind.)Type instead of *

GHC ghc-devs at haskell.org
Thu Aug 4 02:51:59 UTC 2016


#12030: GHCi Proposal: Display (Data.Kind.)Type instead of *
-------------------------------------+-------------------------------------
        Reporter:  Iceland_jack      |                Owner:
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  GHCi              |              Version:  8.1
      Resolution:                    |             Keywords:  TypeInType
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Description changed by Iceland_jack:

@@ -16,2 +16,2 @@
- `*` throws students off and makes it seem scarier than it is. Symbols are
- harder to search for in general and to understand without documentation,
+ `*` throws students off in my experience, makes it seem scarier than it
+ is. Symbols are harder to search for and understand without documentation,
@@ -20,1 +20,1 @@
- There are valid arguments against displaying `Type`:
+ There are arguments against:
@@ -22,5 +22,4 @@
- 1. It's a recent feature subject to change.
- 2. Although symbols are more difficult to search for, `*` is established
- in educational materials, logs, blogs and questions.
- 3. By default `Type` is not in scope so a user cannot ask for information
- in GHCi.
+ 1. It's a recent feature that is subject to change.
+ 2. `*` is established in questions online, educational material, logs and
+ blogs.
+ 3. `Type` is not in scope by default: user cannot query GHCi.

New description:

 This is premature but what the darn,

 {{{
 >>> :kind Maybe
 Maybe :: Type -> Type
 >>> :kind StateT
 StateT :: Type -> (Type -> Type) -> Type -> Type
 >>> :kind Eq
 Eq :: Type -> Constraint

 >>> :info Functor
 class Functor (f :: Type -> Type) where
 ...
 }}}

 `*` throws students off in my experience, makes it seem scarier than it
 is. Symbols are harder to search for and understand without documentation,
 `Type` on the other hand is descriptive.

 There are arguments against:

 1. It's a recent feature that is subject to change.
 2. `*` is established in questions online, educational material, logs and
 blogs.
 3. `Type` is not in scope by default: user cannot query GHCi.

 `*` is established and searching for “Haskell asterisk” yields a lot
 resources but [https://support.google.com/websearch/answer/2466433?hl=en
 ‘*’ is also a wildcard] in Google and ignored by GitHub. With time `Type`
 would be a good search term but currently it's chicken-and-the-egg.

 Previous versions of GHCi error on `:kind *` and `:info *` only shows
 multiplication so that wouldn't be a huge difference but we can qualify by
 default:

 {{{
 >>> :kind Maybe
 Maybe :: Data.Kind.Type -> Data.Kind.Type
 >>> :kind StateT
 StateT :: Data.Kind.Type -> (Data.Kind.Type -> Data.Kind.Type) ->
 Data.Kind.Type -> Data.Kind.Type
 >>> :kind Eq
 Eq :: Data.Kind.Type -> Constraint

 >>> :info Functor
 class Functor (f :: Data.Kind.Type -> Data.Kind.Type) where
 ...
 }}}

 or display `*` normally and only when `TypeInType` is set do we display
 `Type`. I don't love it (and love `GHC.Types.Type` slightly less) but
 there is a precedent for unqualified names, browsing the Prelude for
 example:

 {{{#!hs
 ($) ::
   forall (r :: GHC.Types.RuntimeRep) a (b :: TYPE r).
   (a -> b) -> a -> b
 undefined ::
   forall (r :: GHC.Types.RuntimeRep) (a :: TYPE r).
   GHC.Stack.Types.HasCallStack =>
   a
 }}}

 __If__ the consensus is that this will happen sometime down the line
 consider that each passing release means many more books and blog posts
 get written using `*`.

 I wasn't planning on resulting to scare tactics but
 [https://www.peoria.com/spaw/spawimages/members/member60763/shoot_this_dog.jpg
 here we are]...

 ----

 If needed a migration plan can be drafted like the
 Semigroup/FTP/AMP/BBP/MonadFail/expanding Float/... proposals, possibly
 culminating in `Type` fully replacing `*` and being imported by default.
 I'm sure there are some further reaching consequences to this and better
 arguments against.

--

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12030#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list