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

GHC ghc-devs at haskell.org
Sat May 7 07:59:15 UTC 2016


#12030: GHCi Proposal: Display (Data.Kind.)Type instead of *
-------------------------------------+-------------------------------------
           Reporter:  Iceland_jack   |             Owner:
               Type:  feature        |            Status:  new
  request                            |
           Priority:  normal         |         Milestone:
          Component:  GHCi           |           Version:  8.1
           Keywords:  TypeInType     |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 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 and makes it seem scarier than it is. Symbols are
 harder to search for in general and to understand without documentation,
 `Type` on the other hand is descriptive.

 There are valid arguments against displaying `Type`:

 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.

 `*` 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>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list