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,260
    • Issues 4,260
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 402
    • Merge Requests 402
  • 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
  • #9018

Closed
Open
Opened Apr 21, 2014 by Simon Peyton Jones@simonpjDeveloper

GHC suppresses too much kind information

GHC tends to hide important kind polymorphism in error messages and in GHCi. (I came across this when looking at #9017 (closed).) For example, try this:

bash$ cat Test.hs
{-# LANGUAGE PolyKinds #-}
module Test where
foo :: m a
foo = foo

bash$ ghci Test.hs
ghci> :t foo
foo :: m a
ghci> :i foo
foo :: m a

bash$ ghci Test.hs -XPolyKinds
ghci> :t foo
foo :: m a
ghci> :i foo
goo :: m a

bash$ ghci Test.hs -fprint-explicit-foralls -fprint-explicit-kinds
ghci> :t foo
foo :: foo :: forall (m :: * -> *) d. m d
ghci> :i foo
foo :: forall (k :: BOX) (m :: k -> *) (d :: k). m d

bash$ ghci Test.hs -XPolyKinds -fprint-explicit-foralls -fprint-explicit-kinds
ghci> :t foo
foo :: forall (k :: BOX) (m :: k -> *) (d :: k). m d
ghci> :i foo
foo :: forall (k :: BOX) (m :: k -> *) (d :: k). m d

Pretty confusing eh?

  • Without -fprint-explicit-foralls -fprint-explicit-kinds you don't see the kinds on the types at all.
  • Without -XPolyKinds in GHCi, when you say :t foo you are asking for the type of the expression foo (it could be an arbitrary expression). So foo is instantiated and then re-generalised; but without -XPolyKinds we don't get a poly-kinded type. Hence the difference in what is printed by :type and :info.

Here's a proposal: even without -fprint-explicit-foralls, we should print any foralls that bind a type variable whose kind includes a kind variable.

Trac metadata
Trac field Value
Version 7.8.2
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
Assignee
Assign to
7.8.3
Milestone
7.8.3
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#9018