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,830
    • Issues 4,830
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 447
    • Merge requests 447
  • 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
  • #14042

Closed
Open
Created Jul 27, 2017 by Ryan Scott@RyanGlScottMaintainer

Datatypes cannot use a type family in their return kind

This typechecks:

{-# LANGUAGE TypeInType #-}

import Data.Kind

type Id (a :: Type) = a

data Foo :: Id Type

But changing the type synonym to a type family causes it to fail:

{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeInType #-}

import Data.Kind

type family Id (a :: Type) :: Type where
  Id a = a

data Foo :: Id Type
$ ghci Foo.hs
GHCi, version 8.2.1: http://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
[1 of 1] Compiling Main             ( Foo.hs, interpreted )

Foo.hs:9:1: error:
    • Kind signature on data type declaration has non-* return kind
        Id *
    • In the data declaration for ‘Foo’
  |
9 | data Foo :: Id Type
  | ^^^^^^^^

That error message is wrong, since Id * = *. And, besides, the definition should be accepted.

EDIT: This was originally about the error message. But #14042 (closed) changes the goal of the bug to fix the behavior.

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