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 flap operator #59

Closed
chshersh opened this issue Aug 19, 2018 · 2 comments
Closed

Add flap operator #59

chshersh opened this issue Aug 19, 2018 · 2 comments
Assignees
Labels
new Bring something new into library (add function or type or interface)

Comments

@chshersh
Copy link
Contributor

chshersh commented Aug 19, 2018

This one:

(??) :: Functor f => f (a -> b) - a -> f b
@chshersh chshersh added the new Bring something new into library (add function or type or interface) label Aug 19, 2018
@chshersh chshersh added this to the v0.3.0: Combinators milestone Aug 19, 2018
@vrom911
Copy link
Member

vrom911 commented Sep 6, 2018

I've never seen this function before and I can't find this function anywhere, can you tell why it's needed? And why you need to make an operator? Should I implement the function first?

@chshersh
Copy link
Contributor Author

chshersh commented Sep 6, 2018

@vrom911 These are good points. We can have both flap and ?? operator available. I learned about this operator from this document:

For me it's mostly useful when I have a list of function and want to apply them to single element, like this:

ghci> [(+2), (*3)] ?? 5
[7, 15]

Or apply to function inside Maybe:

ghci> Just (+3) ?? 5
Just 8

I can't say that this operator is as useful as other common operators like <$>, <*>, <&>, etc. But some people like it, and it's still useful sometimes.

In the document I've send in this comment, this operator is called <@> but in Haskell world it's more popular under ?? name from lens library:

vrom911 added a commit that referenced this issue Sep 7, 2018
chshersh pushed a commit that referenced this issue Sep 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new Bring something new into library (add function or type or interface)
Projects
None yet
Development

No branches or pull requests

2 participants