well-typed / optics

Optics as an abstract interface
374 stars 24 forks source link

PoC: Add non-empty folds #483

Open phadej opened 1 year ago

phadej commented 1 year ago

As Foldable1 is in base-4.18 and there is a light compatibility package, we can do this somewhat easily.

This breaks symmetry of hierarchy,as there is no NeTraversal, but it's much less useful than non-empty folds (i.e. to semigroups).

This (softly) needs a Foldable1WithIndex to be added to indexed-traversable, which I'll do some time in the future (after GHC-9.6 updates are somewhat settled).

Partly implements #34

phadej commented 1 year ago

Updated with a proof-of-concept of indexed folds too.

I'll leave this at this state until someone else asks for non-empty folds, but I'm probably going to release indexed-traversable-0.1.3 in near future.

phadej commented 9 months ago

indexed-traversable-0.1.3 has been released (some time ago already)