2 | module Data.Indexed.AddDep
4 | import Data.Witherable
5 | import Data.Witherable.Dependent
9 | record DepIndexed (t : Type -> Type) (i : Type) (a : i -> Type) where
10 | constructor AddDepIndex
11 | unDepIndex : t (DPair i a)
15 | (Functor t) => DepFunctor i (DepIndexed t i) where
16 | dmap f (AddDepIndex p) = AddDepIndex (dmap f <$> p)
19 | (Foldable t) => DepFoldable i (DepIndexed t i) where
20 | dfoldl f z (AddDepIndex p) = foldl (\u, (MkDPair x y) => f u x y) z p
21 | dfoldr f z (AddDepIndex p) = foldr (\(MkDPair x y), u => f x y u) z p
24 | (Traversable t) => DepTraversable i (DepIndexed t i) where
25 | dtraverse f (AddDepIndex p) = AddDepIndex <$> traverse (dtraverse f) p
28 | (Filterable t) => DepFilterable i (DepIndexed t i) where
29 | dmapMaybe f (AddDepIndex p) = AddDepIndex $
mapMaybe (dtraverse f) p
32 | [depIndexedWitherable] (Witherable t) => DepWitherable i (DepIndexed t i) where