Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Focus withDefault feature, removed Eq constraint on withDefault everywhere #1094

Merged
merged 1 commit into from
Feb 23, 2021

Conversation

kenbot
Copy link
Collaborator

@kenbot kenbot commented Feb 23, 2021

Focus withDefault feature, resolving #1031

Of note:

  • Removed the Eq constraint from withDefault in std.option and in all the optics, because it adds an intolerable usability hurdle to Focus, and provides little value for the withDefault usecase on its own
  • Tweaked the FocusKeyword matcher in ParserBase to accomodate value parameters with no typeclass

@@ -46,6 48,9 @@ private[focus] trait ParserLoop {
case KeywordAs(Right(remainingCode, action)) => loop(remainingCode, action :: listSoFar)
case KeywordAs(Left(error)) => Left(error)

case KeywordWithDefault(Right(remainingCode, action)) => loop(remainingCode, action :: listSoFar)
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if there is a way to capture this pattern of KeyWord(Left(e)) => e

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No doubt, there's a few drops of juice left to squeeze out. It's not a priority for me at this point, it's completely sterile as far as unwanted code growth is concerned, and squeezing harder risks overfitting.

Copy link
Member

@julien-truffaut julien-truffaut left a comment

Choose a reason for hiding this comment

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

LGTM, great work Ken!

@julien-truffaut julien-truffaut merged commit ed800e3 into optics-dev:master Feb 23, 2021
@kenbot kenbot deleted the withdefault branch February 23, 2021 15:17
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