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 FUN 'One Profunctor instance #308

Merged
merged 2 commits into from Feb 17, 2021

Conversation

sjoerdvisscher
Copy link
Member

I'm trying to add support for generating linear traversals to my one-liner package, and noticed this instance is missing. I could use the LinearArrow instance instead, but having this instance makes things a bit cleaner.

@aspiwack
Copy link
Member

Mmm… That's a good point. We must have used the LinearArrow newtype when FUN was not a thing. I'm kind of wondering if we should remove the LinearArrow newtype altogether, since FUN 'One does the trick, and that would save us some coerce.

Does it make some code less readable? We will have to experiment.

@b-mehta
Copy link
Contributor

b-mehta commented Feb 17, 2021

Mmm… That's a good point. We must have used the LinearArrow newtype when FUN was not a thing.

Can confirm this is what happened.

@sjoerdvisscher
Copy link
Member Author

In this case it is even possible to merge the (->) and FUN 'One instances into one FUN m instance, but that made it too magical imho.

@aspiwack
Copy link
Member

@b-mehta
thanks for the feedback. I'm thinking we can just kill LinearArrow then.

@sjoerdvisscher
I think the FUN m instance may not be super robust to changes in the future. So maybe let's avoid it for now, indeed.

@sjoerdvisscher
Copy link
Member Author

I removed the wrapper.

Note that it is now possible to combine over and overU:

over :: Optic_ (FUN m) s t a b -> (a %m-> b) -> s %m-> t

But I guess we should wait for this until we can combine traverseOf and traverseOfU too.

Copy link
Member

@aspiwack aspiwack left a comment

Choose a reason for hiding this comment

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

Thanks. Feel free to merge.

@sjoerdvisscher sjoerdvisscher merged commit 76b893d into master Feb 17, 2021
@sjoerdvisscher sjoerdvisscher deleted the sv/profunctor-fun-one-instance branch February 17, 2021 19: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.

None yet

3 participants