I'm trying to build a custom category:
type Cat i = i -> i -> Type
class Category (h :: Cat i) where
id :: h a a
(.) :: h b c -> h a b -> h a c
-------------------------------------------------
data HFun (l :: [Type]) (l' :: [Type]) where
HFunNil :: HFun '[] '[]
(:->:) :: (a -> b) -> HFun as bs -> HFun (a ': as) (b ': bs)
class Id x where
id :: x
instance Id (HFun '[] '[]) where
id = HFunNil
instance Id (HFun l l) => Id (HFun (a ': l) (a ': l)) where
id = Pr.id :->: id
instance Category HFun where
id = id
but this fails to compile with: No instance for (Id (HFun a a)) arising from a use of ‘id’ :( any help/suggestion is much appreciated