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

add Focus[X]() and .focus() for Iso/ApplyIso #1098

Merged
merged 3 commits into from
Feb 25, 2021
Merged

Conversation

julien-truffaut
Copy link
Member

Fix #1064

Use paren

I could make .focus work but not Focus[X]. The problem is that Focus uses the trick to partially apply type parameter

def apply[S] = new MkFocus[S]

class MkFocus[From] {
    def apply: Iso[From, From] = Iso.id
}

as a result Focus[X] is a MkFocus[X] not an Iso[X, X]. Adding paren to apply fixed the ambiguity.

Moved syntax

I had to move .focus() next to the macro extension .focus(_.foo.bar). When both extension methods where in different classes, it confuses the compiler.

The main issue is for Scala 2, we need define .focus() in the macro module.

Copy link
Collaborator

@kenbot kenbot left a comment

Choose a reason for hiding this comment

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

Just do the doco fix and you're good to go

Copy link
Collaborator

@kenbot kenbot left a comment

Choose a reason for hiding this comment

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

Lgtm

@julien-truffaut julien-truffaut merged commit a891a65 into master Feb 25, 2021
@julien-truffaut julien-truffaut deleted the focus-iso branch February 25, 2021 09:42
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.

Focus[X](_) as beginner-friendly version of Iso.id[X]
2 participants