https://github.com/konn/polymorphic-foldl
An attempt to formalise Beautiful Folding more polymorphically
https://github.com/konn/polymorphic-foldl
Last synced: 2 months ago
JSON representation
An attempt to formalise Beautiful Folding more polymorphically
- Host: GitHub
- URL: https://github.com/konn/polymorphic-foldl
- Owner: konn
- License: bsd-3-clause
- Created: 2022-09-16T12:33:46.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-09-16T12:53:01.000Z (over 2 years ago)
- Last Synced: 2025-01-23T16:55:30.953Z (4 months ago)
- Language: Haskell
- Size: 10.7 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# An attempt to formalise Beautiful Folding more polymorphically
[Beautiful Folding][beauty] with more polymorphic combinators, inspired by [`foldl`][foldl] and [`folds`][folds].
## Goals
- Uniform treatment of pure/impure folds
- Type-level distinction between possibly-empty and non-empty (or, monoid vs. semigroup, resp.) folds
* Example: We should safely expect the inner fold of `foldByKeyMap`-like folds:
```hs
foldByKeyMap :: forall k a b m l. (Monad m, Ord k) => FolderM L1 m a b -> FolderM l m (k, a) (Map k b)
```
* We can still use monoidal folds in place of semigroup folds.[beauty]: http://squing.blogspot.com/2008/11/beautiful-folding.html
[foldl]: https://hackage.haskell.org/package/foldl
[folds]: https://hackage.haskell.org/package/folds