2 | module Data.Indexed.Fixed
4 | import Data.Witherable.Indexed
8 | record FixIndex {0 i : Type} (x : i) (f : Type -> Type) (a : Type) where
9 | constructor WithIndex
14 | Functor f => Functor (FixIndex x f) where
15 | map f (WithIndex m) = WithIndex $
map f m
18 | {x : i} -> Functor f => IndFunctor i (FixIndex x f) where
19 | imap f (WithIndex m) = WithIndex $
map (f x) m
22 | Foldable f => Foldable (FixIndex x f) where
23 | foldl f z (WithIndex m) = foldl f z m
24 | foldr f z (WithIndex m) = foldr f z m
27 | {x : i} -> Foldable f => IndFoldable i (FixIndex x f) where
28 | ifoldl f z (WithIndex m) = foldl (flip f x) z m
29 | ifoldr f z (WithIndex m) = foldr (f x) z m
32 | Traversable f => Traversable (FixIndex x f) where
33 | traverse f (WithIndex m) = WithIndex <$> traverse f m
36 | {x : i} -> Traversable f => IndTraversable i (FixIndex x f) where
37 | itraverse f (WithIndex m) = WithIndex <$> traverse (f x) m
40 | Filterable f => Filterable (FixIndex x f) where
41 | mapMaybe f (WithIndex m) = WithIndex $
mapMaybe f m
44 | {x : i} -> Filterable f => IndFilterable i (FixIndex x f) where
45 | imapMaybe f (WithIndex m) = WithIndex $
mapMaybe (f x) m
48 | Witherable f => Witherable (FixIndex x f) where
49 | wither f (WithIndex m) = WithIndex <$> wither f m
52 | {x : i} -> Witherable f => IndWitherable i (FixIndex x f) where
53 | iwither f (WithIndex m) = WithIndex <$> wither (f x) m