Hi again!. Does anyone know equivalent to: ```arro...
# arrow
a
Hi again!. Does anyone know equivalent to:
Copy code
arrow.core.andThen
in 1.0??
a
I did use andThen to add another step to a function type
I think it is not the same
s
The signature hasn’t changed, it moved to a different package
can you share a snippet?
a
sure
I was looking for that andThen @simon.vergauwen. to do function composition
Since higherkinds are deprecated in 1.0 i dont know if that is still available
Oh, you’re looking for the higher kind?
This is now being used underneath
andThen
and you no longer need to keep
AndThen
around
You can safely use
typealias AndThen<A> = () -> A
to replace it
a
i need to check that out. I dont get it right now. Thx
migrating to 1.0 old andThen use gives me an error. It was used over an exetenssion function so: MyClass.() -> Try<T> was the signature of the function I was using andThen over, like:
val a: MyClass.() -> Try<T> = createFunction().andThen()
now migrating to 1.0 it does not compile
i have checked old signature of andThen ans was:
infix fun <A, B, C> ((A) -> B).andThen(g: (B) -> C): (A) -> C
now it is:
public expect infix fun <P1, IP, R> ((P1) -> IP).andThen(f: (IP) -> R): (P1) -> R
So for example:
Copy code
val a: () -> String = { " 2323" }.andThen { s -> s }
val b: Myclass.() -> String = { " 2323" }.andThen { s -> s }
b does not comiple now in 1.0
cant figure out why
Ok. my fault. Extension function I was applying and Then to was refactored to suspend. That is why compiler was complaining because receiver of andThen was different. 😑.
😅 1
s
I think it’d be interesting to add
suspend
variants of those functions maybe? If you’re interested feel free to create a issue/PR 😉
a
sure Simon
I do not know if people would like it since if you are using suspend it implies it is an impure function. And may be it is not the best way to use function composition with side effect functions
for now I have just write my own
Ill think abou that