Skip to content

Changes since 0.4#26

Merged
echatav merged 30 commits intomainfrom
changes-since-0.4
Apr 20, 2026
Merged

Changes since 0.4#26
echatav merged 30 commits intomainfrom
changes-since-0.4

Conversation

@echatav
Copy link
Copy Markdown
Contributor

@echatav echatav commented Apr 14, 2026

  • made MonadTry imply BackusNaurForm since rule has failure tracing semantics; and Filterable since it's implied by MonadPlus.
  • move orphan instances and TemplateHaskell to Control.Lens.Grammar.Internal
  • Add applicativeG and monadG generators via Joker orphan & non-orphan instances
  • Add Megaparsec example for monadG.
  • Add more documentation for BackusNaurForms, motivating separately both with category theory and with failure semantics. It's strange but both are called "trace" and have different meanings which Bnfs combine.
  • Fix example typo in makeNestedPrisms
  • Simplify terminal method default

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR bumps the library to 0.5.0.0 and aligns the grammar/parsing APIs and docs around “failure” (vs “error”), while adding new generator helpers (applicativeG, monadG, readG) and reorganizing orphan instances / TH internals under Control.Lens.Grammar.Internal.

Changes:

  • Rename Parsec-style payloads/fields from ParsecError/parsecError to ParsecFailure/parsecFail across the LL(1) Parsector and its tests/docs.
  • Add generator helpers (applicativeG, monadG, readG) and supporting Joker / ReadP instances for token/regex/alternation.
  • Move orphan instances and TH internals into Control.Lens.Grammar.Internal.* and update imports/cabal exposure accordingly; add a Megaparsec example + test dependency.

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/Main.hs Updates Parsector assertions for parsecFail and adds a Megaparsec backend test via monadG.
src/Data/Profunctor/Monoidal.hs Removes orphan-instance “orphanage” section and tightens documentation wording.
src/Data/Profunctor/Grammar/Parsector.hs Renames error channel/types to “failure” and propagates the field rename through instances.
src/Data/Profunctor/Grammar.hs Updates MonadTry constraints for Parsor/Printor to reflect new MonadTry superclass requirements.
src/Data/Profunctor/Filtrator.hs Adds Filtrator (Joker f) instance and expands class-law docs.
src/Data/Profunctor/Distributor.hs Adds Alternator (Joker f) instance (notably optionP).
src/Control/Monad/Fail/Try.hs Expands MonadTry to imply Filterable + quantified BackusNaurForm, and adds MonadTry (Joker m a) / ReadP.
src/Control/Lens/PartialIso.hs Moves orphan instances out; imports the new internal orphanage + internal TH module.
src/Control/Lens/Grammar/Token.hs Adds Joker + ReadP Tokenized instances; reorganizes the (token -> Bool) instance.
src/Control/Lens/Grammar/Symbol.hs Simplifies terminal default and adds Joker + ReadP TerminalSymbol instances.
src/Control/Lens/Grammar/Kleene.hs Adds Joker + ReadP TokenAlgebra instances and updates module description.
src/Control/Lens/Grammar/Internal/Orphanage.hs New module consolidating orphan instances previously scattered across modules.
src/Control/Lens/Grammar/Internal/NestedPrismTH.hs Renames/moves nested prism TH internals into the new internal namespace and fixes example text.
src/Control/Lens/Grammar/Boole.hs Documentation tweak to scope Boolean algebra discussion.
src/Control/Lens/Grammar/BackusNaur.hs Expands BackusNaurForm documentation; adds Joker/ReadP instances; adjusts Bnf’s BackusNaurForm implementation.
src/Control/Lens/Grammar.hs Exposes applicativeG, readG, monadG; adds Megaparsec example; updates docs/examples to “failure”; switches IsList parsing to ReadP.
src/Control/Lens/Bifocal.hs Minor documentation wording update.
package.yaml Bumps version and adds megaparsec to test dependencies.
distributors.cabal Bumps version, exposes new internal modules, and adds megaparsec to test-suite deps.
CHANGELOG.md Adds 0.5.0.0 entry describing API/doc/internal changes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Control/Lens/Grammar.hs
Comment thread src/Control/Lens/Grammar.hs
Comment thread test/Main.hs
@echatav echatav merged commit 10f1960 into main Apr 20, 2026
1 check passed
@echatav echatav deleted the changes-since-0.4 branch April 20, 2026 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants