Skip to content
GitLab
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 5,252
    • Issues 5,252
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 561
    • Merge requests 561
  • 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 CompilerGlasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #15942
Closed
Open
Issue created Nov 23, 2018 by Icelandjack@IcelandjackReporter

Associated type family can't be used at the kind level within other parts of parent class

I want to run the following past you (using Visible Kind Applications but may be unrelated). The following compiles

{-# Language DataKinds           #-}
{-# Language KindSignatures      #-}
{-# Language TypeFamilies        #-}
{-# Language AllowAmbiguousTypes #-}

import Data.Kind

type G = Bool -> Type

data Fun :: G

class F (bool :: Bool) where
  type Not bool :: Bool
  foo :: Fun (Not bool)

but quantifying Bool invisibly all of a sudden I can't use Not

{-# Language DataKinds           #-}
{-# Language RankNTypes          #-}
{-# Language TypeApplications    #-}
{-# Language PolyKinds           #-}
{-# Language KindSignatures      #-}
{-# Language TypeFamilies        #-}
{-# Language AllowAmbiguousTypes #-}

import Data.Kind

type G = forall (b :: Bool). Type

data Fun :: G

class F (bool :: Bool) where
  type Not bool :: Bool
  foo :: Fun @(Not bool)
$ ghc-stage2 --interactive -ignore-dot-ghci 739_bug.hs
GHCi, version 8.7.20181017: http://www.haskell.org/ghc/  :? for help
[1 of 1] Compiling Main             ( 739_bug.hs, interpreted )

739_bug.hs:17:16: error:
    • Type constructor ‘Not’ cannot be used here
        (it is defined and used in the same recursive group)
    • In the first argument of ‘Fun’, namely ‘(Not bool)’
      In the type signature: foo :: Fun @(Not bool)
      In the class declaration for ‘F’
   |
17 |   foo :: Fun @(Not bool)
   |                ^^^
Failed, no modules loaded.

Is this restriction warranted

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