How to make fixed-length vectors instance of Applicative?
问题 I recently learned about promotion and decided to try writing vectors. {-# LANGUAGE DataKinds, GADTs, KindSignatures #-} module Vector where data Nat = Next Nat | Zero data Vector :: Nat -> * -> * where Construct :: t -> Vector n t -> Vector ('Next n) t Empty :: Vector 'Zero t instance Functor (Vector n) where fmap f a = case a of Construct x b -> Construct (f x) (fmap f b) Empty -> Empty So far, everything is working. But I ran into a problem when trying to make Vector instance of