Skip to content

Invisible kind not inferred

I am trying to model a generalized element where the domain of the arrow is implicit

{-# Language DataKinds                #-}
{-# Language PolyKinds                #-}
{-# Language RankNTypes               #-}
{-# Language StandaloneKindSignatures #-}
{-# Language TypeApplications         #-}
{-# Language TypeFamilies             #-}

import Data.Kind

type
 GeneralizedElement :: forall (a :: Type). Type -> Type
type family
 GeneralizedElement b where
 GeneralizedElement @a b = a -> b

foo :: GeneralizedElement @Bool Bool
foo = not

but if I remove @Bool ghc is unable to infer it, this may have happened to be me in a different context. But I am just checking to make sure it's intended, thanks!

..:17:7-9: error: …
    • Couldn't match type ‘a’ with ‘Bool’
      ‘a’ is a rigid type variable bound by
        the type signature for:
          foo :: forall a. Generalized Bool
        at ..:16:1-23
      Expected type: Generalized Bool
        Actual type: Bool -> Bool
    • In the expression: not
      In an equation for ‘foo’: foo = not
    • Relevant bindings include
        foo :: Generalized Bool (bound at ..:17:1)
   |
Compilation failed.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information