simon.vergauwen
09/03/2019, 2:59 PMfix()
at the end, no?kluck
09/04/2019, 9:29 AMdata class Item(val name: String, val quantity: Int)
fun List<Item>.addItem(item: Item): List<Item> { ??? }
listOf(Item("apple", 3), Item("Pear", 1)).addItem(Item("apple", 2) // -> expected : listOf(Item("apple", 5), Item("Pear", 1))
What would be an FP version of addItem
?raulraja
09/04/2019, 3:43 PMIO<Unit>
then at the very edge where you need to perform the action you can call unsafeRunAsync
or any other variation of that method to run the program.
What attempt
does is turn IO<A>
into IO<Either<Throwable, A>>
forcing the receiver of the last typed value to deal in composition with the fact that the operation may have failed with an exception which can be found in the LeftBob Glamm
09/04/2019, 3:45 PMflatmap
over Dataset<C>
-> IO<Unit>
in this case, assuming that map
is intended for applying pure functions. I think that is the expected usage for those?PhBastiani
09/06/2019, 8:08 AMinline reified
in Arrow. For example, here :
inline fun <reified F> Free<ForAnkOps, ListK<File>>.run(interpreter: FunctionK<ForAnkOps, F>, MF: Monad<F>): Kind<F, ListK<File>> =
this.foldMap(interpreter, MF)
intuitively, this syntax is needed to typeclass instance look up. But how ?
I did not find this syntax described and used outside of Arrow.Bob Glamm
09/06/2019, 6:52 PMB
type of use
in bracketCase
through the ExitCase.Completed
part of release
, is there?raulraja
09/10/2019, 1:58 PMpakoito
09/12/2019, 11:01 AMnhaarman
09/16/2019, 11:24 AMmaven { url "<https://dl.bintray.com/arrow-kt/arrow-kt/>" }
repository. Will arrow not be published to maven central anymore?Danilo Herrera
09/16/2019, 7:36 PMKind<F, A>
? For instance, I have a List<Animal>
but want to return Kind<F, Animal>
. Example:
interface AnimalMapper<F> : MonadError<F, Throwable> {
fun Kind<F, FarmDto>.toAnimalsFromNetwork(): Kind<F, Animal> = flatMap { farmDto ->
catch {
farmDto.animalDtos.map {
Animal(
it.id,
it.name
)
}
}
}
}
This yields a type inference error. Expected Kind<F, Animal>
, but found Kind<F, List<Animal>>
David
09/17/2019, 12:40 AMtagless-final
example shown here: https://github.com/JorgeCastilloPrz/ArrowAndroidSamples/tree/master/tagless-final. Since my mathematical understanding of fp is low (I’ve been learning via gcanti’s fp-ts
library) and my understanding of corountines in Android also low I feel like I’ve bitten off more than I can chew! Having run into a few more fundamental problems, where is best to chat about the problems I’m hitting? Here or create an SO ticket?Fred Friis
09/18/2019, 12:48 AMYeray Cabello
09/18/2019, 7:56 AMlaimiux
09/18/2019, 6:00 PMEither.left && Either.right
within a RxJava
. For example request.map { Either.right(it) }.onErrorReturn { Either.left(it) }` doesn’t compilethanh
09/18/2019, 6:12 PMrequest.map { Either.right(it) as Either<E,A>}.onErrorReturn { Either.left(it) }
thanh
09/19/2019, 5:59 AMYeray Cabello
09/19/2019, 6:49 AMpakoito
09/19/2019, 9:02 AMpakoito
09/20/2019, 12:53 PMPedro Silva
09/20/2019, 2:14 PMfun CompletionStage<V>.asIO(): IO<V> = IO.async
then I won't be able to have fun <V> startThings(a: Async<V>) = object : MemSource<V>, Async<V> by a
. What am I missing that connects IO<F>
to Async<F>
?Danilo Herrera
09/20/2019, 2:59 PMIO.fx { ... }
? I tried starting the block with continueOn(<http://Dispatchers.IO|Dispatchers.IO>)
but for some reason it hangs.PhBastiani
09/20/2019, 3:18 PMSatyam Agarwal
09/24/2019, 8:29 AMBob Glamm
09/25/2019, 8:08 PMraulraja
09/27/2019, 11:19 AMpakoito
09/29/2019, 3:53 PMio.map { ei -> ei.map { l -> l.map { b -> toC(b) } } }
stojan
09/29/2019, 4:36 PMsealed class ValidationResult<out E, out A> {
data class Valid<A>(val a: A) : ValidationResult<Nothing, A>()
data class Invalid<E>(val e: E) : ValidationResult<E, Nothing>()
}
And I want to use `Valid`/`Invalid` without prefixing with ValidationResult
. How can I do that...
I tried
import ValidationResult.Valid
import ValidationResult.Invalid
but it doesn't work....
Error I am getting is (when trying to use just `Valid`:
error: unresolved reference: Valid
if (a is Valid && b is Valid) valid(f(a.a, b.a))
raulraja
10/01/2019, 10:56 AMtailrec
is designed so that recursive functions don’t blow up the stack but all async monads like IO are safe because they jump out of the stack before it fills up by moving the computation into the heap via ADTs and classes that hold computations in memory.stojan
10/01/2019, 7:47 PMKind<F, Option<Something>>
where F
is MonadError
? (arrow 0.10)?thanh
10/02/2019, 2:24 PMthanh
10/02/2019, 2:24 PMdcampogiani
10/02/2019, 2:24 PMcarbaj0
10/02/2019, 2:39 PMJose Antonio Jimenez
10/03/2019, 11:09 AM