Skip to content

`Any` appearing in a quantified constraint

If I say

{-# LANGUAGE QuantifiedConstraints, MultiParamTypeClasses #-}

module Bug where

class (forall a. a b ~ a c) => C b c

I get

Bug.hs:5:1: error:
    • Illegal type synonym family application ‘GHC.Types.Any
                                                 @*’ in instance:
        (a b :: GHC.Types.Any @*) ~ (a c :: GHC.Types.Any @*)
    • In the quantified constraint ‘forall (a :: k -> GHC.Types.Any).
                                    a b ~ a c’
      In the context: forall (a :: k -> GHC.Types.Any). a b ~ a c
      While checking the super-classes of class ‘C’
      In the class declaration for ‘C’
  |
5 | class (forall a. a b ~ a c) => C b c
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This is a specific case of #17567 (closed). Despite superficial similarity, this is unrelated to #16775 (closed).

Edited by Richard Eisenberg
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information