checkDim :: forall n a. (DIM n) => Index -> SparseVector n a -> SparseVector n a
checkDim i v | i < 1 || i > d = error $ "Index out of bounds (" ++ show i ++ " not in (1," ++ show d ++ "))"
             | otherwise = v
   where
     d = natInt (Proxy :: Proxy n)
checkDim :: forall n a. (DIM n) => Index -> SparseVector n a -> SparseVector n a
checkDim i v | i < 1 || i > d = error $ "Index out of bounds (" ++ show i ++ " not in (1," ++ show d ++ "))"
             | otherwise = v
   where
     d = natInt (Proxy :: Proxy n)
checkDim i v | i < 1 || i > d = error $ "Index out of bounds (" ++ show i ++ " not in (1," ++ show d ++ "))"
             | otherwise = v
   where
     d = natInt (Proxy :: Proxy n)