Skip to content

Add FUN 'One Profunctor instance#308

Merged
sjoerdvisscher merged 2 commits intomasterfrom
sv/profunctor-fun-one-instance
Feb 17, 2021
Merged

Add FUN 'One Profunctor instance#308
sjoerdvisscher merged 2 commits intomasterfrom
sv/profunctor-fun-one-instance

Conversation

@sjoerdvisscher
Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
Collaborator

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
Copy Markdown
Contributor 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
Copy Markdown
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
Copy Markdown
Contributor 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
Copy Markdown
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.

3 participants