2 | ||| Dependent version of `Foldable`
3 | ||| A minimal implementation includes `dfoldr`
6 | -- TODO what about dependent accumulator?
7 | ||| Dependent version of `foldr`
8 | dfoldr
15 | -- there seems to be a bug, this does not type-check. If you put the
16 | -- definition of `dfoldl` before `dfoldr`, then `dfoldr` does not type-check
17 | -- thus a default implementation of `dfoldl` is moved outside the interface
18 | -- definition
19 | --||| Dependent version of `foldl`
20 | --dfoldl
21 | -- : (impl : DFoldable f)
22 | -- => {0 el : t -> Type}
23 | -- -> ({0 x : t} -> acc -> el x -> acc)
24 | -- -> acc
25 | -- -> f el
26 | -- -> acc
27 | --dfoldl f z tr = dfoldr f' z tr @{impl} where
28 | -- f' : {0 x : t} -> el x -> acc -> acc
29 | -- f' el acc = f acc el
31 | -- separated from the interface definition due to weird errors
32 | ||| Default implementation of `dfoldl`
33 | ||| Separated from the interface definition due to what seems to be a compiler
34 | ||| bug.
36 | dfoldl
47 | -- separated from the interface definition due to weird errors
48 | -- (the errors occur in modules importing this one)
49 | export
53 | -- separated from the interface definition due to weird errors
54 | ||| `DFoldable` version of `foldlM`
55 | export
56 | dfoldlM
67 | -- separated from the interface definition due to weird errors
68 | ||| `DFoldable` version of `foldMap`
69 | export