Arrow: ["Request"] Add applicative *> and <* to arrow

Created on 15 Dec 2019  路  2Comments  路  Source: arrow-kt/arrow

What would you like to see?

A version of *> and <* in the Apply typeclass. This has been asked more than once in slack now, so I think it'd be a good idea to add it.

It can be implemented with default implementations and should all be done inside Apply.

We do need to think about good names because we cannot use operators, apart from that the implementation should be straightforward: map(left, right) { (l, _) -> l } and map(left, right) { (_, r) -> r }

We also have a similar operator in Monad which is called followedBy (which is a good name for *>) so that should be replaced, but the implementation in Monad using flatMap { it } could be better than the default for *> so it might make sense to explicitly override it in Monad

enhancement help wanted noob friendly

Most helpful comment

I'll try to do this tomorrow 馃憤

All 2 comments

If followedBy fits the type signature, I'd say just move it. ap is implemented in terms of flatMap anyway

I'll try to do this tomorrow 馃憤

Was this page helpful?
0 / 5 - 0 ratings

Related issues

raulraja picture raulraja  路  5Comments

gortiz picture gortiz  路  3Comments

JorgeCastilloPrz picture JorgeCastilloPrz  路  5Comments

1Jajen1 picture 1Jajen1  路  3Comments

jmfayard picture jmfayard  路  4Comments