Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • 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,864
    • Issues 4,864
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 458
    • Merge requests 458
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #17503
Closed
Open
Created Nov 21, 2019 by Sebastian Graf@sgraf812Developer

Allow data family instances with type family applications in the data family's result kind

In #17021 (closed) we fixed the situation where an unlifted newtype instance of a data family with a type family application in its result kind led to a panic. That was fixed, but non--XUnliftedNewtypes code is still rejected with an error message:

{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PolyKinds #-}

module Lib where

import GHC.Exts

type family Id x where
  Id x = x

data family Foo (r :: RuntimeRep) :: TYPE (Id r)

data instance Foo 'LiftedRep = Foo Int

is rejected with

test2.hs:11:44: error:
    • Type constructor ‘Id’ cannot be used here
        (perhaps you intended to use DataKinds)
    • In the first argument of ‘TYPE’, namely ‘(Id r)’
      In the kind ‘TYPE (Id r)’
      In the data family declaration for ‘Foo’
   |
11 | data family Foo (r :: RuntimeRep) :: TYPE (Id r)
   |

Note that this would work if we would make Foo a newtype instance instead, and activated -XUnliftedNewtypes. I'm not sure whether that's a bug or a feature.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking