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 vararg (.) #25

Closed
Martoon-00 opened this issue Jan 12, 2017 · 8 comments
Closed

Add vararg (.) #25

Martoon-00 opened this issue Jan 12, 2017 · 8 comments

Comments

@Martoon-00
Copy link
Member

Maybe introduce some (.:), where f .: g applies f to result of g, g accepts several arguments and returns monadic action?
For example lift .: seems to be handy

@neongreen
Copy link
Contributor

I'm in favor of it.

@neongreen
Copy link
Contributor

neongreen commented Jan 12, 2017

(Though I suspect type inference might not be so good, even for monadic actions. It'll likely get complicated by the fact that (->) is a monad as well – so, e.g. lift .: forever might not work.)

@neongreen
Copy link
Contributor

Actually, maybe you should first check locally whether you even can write a (.:) that would work for your purposes.

@neongreen
Copy link
Contributor

(A possible candidate for an implementation: http://okmij.org/ftp/Haskell/polyvar-comp.lhs. There might be others.)

@Martoon-00
Copy link
Member Author

Oh really, I didn't provide that m a and r -> a would overlap.
Will try implementation at your your link, thanks

@chshersh
Copy link
Contributor

I don't like vararg (.). You can't say from code how many arguments it takes. It will become difficult to understand and maintain code. And you can have cryptic error messages. I better propose to add family of composition functions to specify number of arguments explicitly:
http://hackage.haskell.org/package/composition-1.0.2.1/docs/Data-Composition.html

I've already proposed to add such functions under origin issue. But @gromakovsky shared his concerns regarding performance degrade.
https://issues.serokell.io/issue/SRK-10#comment=96-242

@chshersh
Copy link
Contributor

chshersh commented Mar 8, 2017

Unfortunately, (.:) conflictis with aeson. So we should invent either our own syntax for multiple versions of (.), (.:), (.:.), (.::), etc. or do something else. But I really like those composition operators.

@chshersh
Copy link
Contributor

Implemented in this commit: 8c26301
I like it. I think issue can be closed.

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

No branches or pull requests

3 participants