-- Adding another type class on Entity, but unable to put `GetMessage a`

import Data.Kind

main :: IO ()
main = pure ()

-- "Library"

-- making `a` the second variable
data Entity (c :: Type -> Constraint) a = (c a) => MkEntity a

class HasDataID a where
  getDependencies :: a -> Entity HasDataID b

instance HasDataID (Entity HasDataID a) where
  getDependencies (MkEntity x) = getDependencies x

data Foo = Foo Bar

data Bar = Bar

instance HasDataID Foo where
  getDependencies (Foo bar) = MkEntity bar


-- "User"

class GetMessage a where
  getMessage :: Int -> a -> String

instance GetMessage a => GetMessage (Entity HasDataID a) where
  getMessage int (MkEntity x) = getMessage int x