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 452
    • Merge requests 452
  • 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
  • #7024
Closed
Open
Created Jun 22, 2012 by Richard Eisenberg@raeDeveloper

Problems with polymorphic kinds imported from module

There seems to be a problem when importing polymorphic kinds from a module in a cabalized package. One way to spot the problem is to cabal install singletons, import Singletons.Lib and run :t SNil in ghci. ghci reports a stack overflow. Another way to access (what I think is) the same error is to compile the following:

{-# LANGUAGE TypeFamilies, DataKinds, PolyKinds, TypeOperators,
             GADTs, RankNTypes #-}

import Singletons.Lib

type family Map (f :: k1 -> k2) (a :: [k1]) :: [k2]
type instance Map f '[] = '[]
type instance Map f (h ': t) = (f h) ': (Map f t)

sMap :: forall (f :: k1 -> k2) (b :: [k1]).
        (forall a. Sing a -> Sing (f a)) -> Sing b -> Sing (Map f b)
sMap _ SNil = SNil
sMap f (SCons h t) = SCons (f h) (sMap f t)

The error message is

    Couldn't match kind `BOX' against `[k1]'
    Kind incompatibility when matching types:
      k1 :: BOX
      b :: [k1]
    In the pattern: SNil
    In an equation for `sMap': sMap _ SNil = SNil

Neither of these problems surface when checking the type of SNil or compiling the above code when the singletons sources are at hand and are interpreted.

I tried to make a small test case for this but was unable to reproduce the error after a number of attempts, including using Template Haskell to generate the Sing instance for type-level lists, as is done in the singletons library.

This was all tested on 7.5.20120620. There's a good chance this bug is related to #7022 (closed).

Trac metadata
Trac field Value
Version 7.5
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking