Hey, quick question. IO<A> and suspend () -&...
# arrow
t
Hey, quick question. IO<A> and suspend () ->A are isomorphic does that mean that after arrow meta well be able to do for example
Copy code
val useFunc: suspend (A)->B = TODO()
val releaseFunc: suspend (A)->Unit = TODO()
something.bracket(
    use = useFunc,
    release = releaseFunc
)
?
a
technically yes, we can proof that we can go from suspend to IO because this one wraps suspend, so we should be technically able to implicitly project the api over it if it would make sense
t
👍 thanks for clarification
s
That’s the plan @than_, but this can already be achieved today with more boilerplate in Arrow. If you require
AS
to wrap
suspend
. And thus we could also implement it without proofs. Typeclasses support would be sufficient.
p
Copy code
use = { IO(useFunc) },
release = { IO(releaseFunc) },
t
sure thats what I'm using now. but having half of codebase using IO and half suspend feels weird
p
fair hahah
t
it was more of "where are we heading" question 🙂 thanks for replies
r
we are heading toward as close to suspend as possible for effectful operations but will preserve wrapping where it’s necessary and support wrapped style as well as many people prefer it over suspend. In general we want to stay close to the lang and eliminate wrapping where there are better options like suspend, union types, refined types coercion to nullable types etc.
👍 1
wrapping is a style people are used to coming from Scala and langs where there is no
suspend
which effectively tracks the IO effect.
👍 1