Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,273
    • Issues 4,273
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 413
    • Merge Requests 413
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Security & Compliance
    • Security & Compliance
    • Dependency List
    • License Compliance
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #12030

Closed
Open
Opened May 07, 2016 by Icelandjack@IcelandjackReporter

GHCi Proposal: Display (Data.Kind.)Type instead of *

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 ‘*’ 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:

($) ::
  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 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.

Edited Mar 10, 2019 by Icelandjack
Assignee
Assign to
8.6.1
Milestone
8.6.1 (Past due)
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#12030