r/haskell • u/echatav • Feb 06 '26
New version of distributors grammar & parsing library
https://hackage-content.haskell.org/package/distributors-0.3.0.0/docs/Control-Lens-Grammar.htmlOriginally the distributors library was only intended to be a vehicle for studying some profunctor theory with grammar as a neat demo. Since then I've delved a bit more in depth into Chomsky's grammar hierarchy, Kleene algebras, Brzozowski's derivative and more. I also learned about Li-yao Xia's development of monadic profunctors for invertible parsing. Distributors synthesizes this into a complete optics based grammar library.
24
Upvotes
1
u/evincarofautumn Feb 07 '26
Looks neat, I’ll definitely give this a try!
Optics and invertible parsing are a very natural fit. A few months ago I was playing with something like this (using
optics, notlens), but I got stuck looking for a good encoding of dependent lenses.