Sort of random, but something in the <#CJLTWPH7S|c...
# arrow
r
Sort of random, but something in the #compose channel made me think of this. Do you think the arrow stdlib should include something like compose or andThen as utility functions?
Copy code
//left to right
infix fun <A, B, C> ((A) -> B).andThen(right : (B) -> C) : (A) -> C = {
    arg -> right(invoke(arg))
}

//right to left
infix fun <A, B, C> ((B) -> C).compose(right : (A) -> B) : (A) -> C = {
    arg -> invoke(right(arg))
}
s
I think they already are part of (a) Arrow library…
r
oh are they?
hmm must have missed that in the docs
Judging from that, in the arrow-syntax lib…?
r
Thanks!
s
And other ones can be found in is parent directory (eg currying and such 🙂 ) https://github.com/arrow-kt/arrow/tree/master/modules/core/arrow-syntax/src/main/kotlin/arrow/syntax/function
p
these were brought from Funktionale, so thank @dh44t!!!
👏 4
d
😅