Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,842
    • Issues 4,842
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 455
    • Merge requests 455
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #14869

Closed
Open
Created Feb 28, 2018 by Ryan Scott@RyanGlScottMaintainer

Documentation for isLiftedTypeKind is incorrect

I noticed recently that Template Haskell reifies Constraint as Type:

$ ~/Software/ghc2/inplace/bin/ghc-stage2 --interactive
GHCi, version 8.5.20180221: http://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
λ> :set -XTypeFamilies -XTemplateHaskell
λ> :m + Data.Kind Language.Haskell.TH
λ> type family Foo :: Constraint
λ> putStrLn $(reify ''Foo >>= stringE . pprint)
type family Ghci1.Foo :: *

The root of the issue can be traced back to the isLiftedTypeKind function, which TcSplice uses to distinguish Type from Constraint. At least, that's what its documentation claims:

 -- | This version considers Constraint to be distinct from *. Returns True
 -- if the argument is equivalent to Type and False otherwise.
 isLiftedTypeKind :: Kind -> Bool
 isLiftedTypeKind = is_TYPE is_lifted
   where
     is_lifted (TyConApp lifted_rep []) = lifted_rep `hasKey` liftedRepDataConKey
     is_lifted _                        = False

However, in practice this claim about treating Constraint and Type as distinct is false:

$ ~/Software/ghc2/inplace/bin/ghc-stage2 --interactive -package ghc
GHCi, version 8.5.20180221: http://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
λ> :m + TyCoRep TysWiredIn
λ> isLiftedTypeKind liftedTypeKind
True
λ> isLiftedTypeKind constraintKind
True

Either we should change the implementation of isLiftedTypeKind to match the documentation's claim, or change the documentation.

Edited Mar 10, 2019 by Ryan Scott
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking