Conversation
and make MonadTry imply Filterable
There was a problem hiding this comment.
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/parsecErrortoParsecFailure/parsecFailacross the LL(1)Parsectorand its tests/docs. - Add generator helpers (
applicativeG,monadG,readG) and supportingJoker/ReadPinstances 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.
This reverts commit 77f9c43.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MonadTryimplyBackusNaurFormsincerulehas failure tracing semantics; andFilterablesince it's implied byMonadPlus.Control.Lens.Grammar.InternalapplicativeGandmonadGgenerators viaJokerorphan & non-orphan instancesmonadG.BackusNaurForms, motivating separately both with category theory and with failure semantics. It's strange but both are called "trace" and have different meanings whichBnfs combine.makeNestedPrismsterminalmethod default