Gabriella439 / foldl

Composable, streaming, and efficient left folds
BSD 3-Clause "New" or "Revised" License
159 stars 51 forks source link

Data.Functor.Extend instances for Fold and FoldM. #167

Closed danidiaz closed 3 years ago

danidiaz commented 3 years ago

Because Fold is a Comonad, it's also an instance of Extend (from "semigroupoids").

FoldM is not a Comonad because we cant define extract, but it can be given an Extend instance. The implementation of duplicated is the same as the already-existing function duplicateM.

Gabriella439 commented 3 years ago

@danidiaz: Thank you! 🙂