Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Jun 14 11:29
    rachelcarmena synchronize #2376
  • Jun 14 11:29

    rachelcarmena on web-update

    Update arrow-site/docs/_data/si… (compare)

  • Jun 14 11:08
    rachelcarmena synchronize #2376
  • Jun 14 11:08

    rachelcarmena on web-update

    Remove playground: style (compare)

  • Jun 14 10:26
    rachelcarmena synchronize #2376
  • Jun 14 10:26

    rachelcarmena on web-update

    Update Setup content Remove playground (compare)

  • Jun 12 17:37
    rachelcarmena synchronize #2376
  • Jun 12 17:37

    rachelcarmena on web-update

    quickstart data quickstart titles dropdown nav and 42 more (compare)

  • Jun 11 12:16
    rachelcarmena synchronize #2376
  • Jun 11 12:16

    rachelcarmena on web-update

    Revert "edit page" This revert… (compare)

  • Jun 11 11:45
    israelperezglez synchronize #2376
  • Jun 11 11:45

    israelperezglez on web-update

    edit page (compare)

  • Jun 11 09:23
    israelperezglez synchronize #2376
  • Jun 11 09:23

    israelperezglez on web-update

    sponsored by doc header (compare)

  • Jun 11 08:07
    israelperezglez synchronize #2376
  • Jun 11 08:07

    israelperezglez on web-update

    brand docs (compare)

  • Jun 10 11:34
    israelperezglez synchronize #2376
  • Jun 10 11:34

    israelperezglez on web-update

    theme light code (compare)

  • Jun 10 10:09
    rachelcarmena synchronize #2409
  • Jun 10 10:09

    rachelcarmena on sv-core-js-support

    Specify type variance for `comp… Create CODE_OF_CONDUCT.md (#241… Add missing Gradle tasks (#2412) and 2 more (compare)

Luca Piccinelli
@lucapiccinelli
This message was deleted
Luca Piccinelli
@lucapiccinelli
ApplicativeFunctorKind<F, T> and MonadKind<F, T> both extends FunctorKind<F, T>, but MonadKind<F, T> doesn't extends ApplicativeFunctorKind<F, T>... that's because I never read about a Monad needing an ap method... but sincerely I don't actually know if a Monad is also an ApplicativeFunctor...
I know that ApplicativeFunctorKind is missing the pure method in its interface, but I'm working on it 😉. At the moment the pure is implemented in the concrete classes. apMapK method instead is only an implementation detail needed because mapK returns a Functor... but sometimes you need to continue with an ApplicativeFunctor
Luca Piccinelli
@lucapiccinelli
I'm curios about how did you generalize over testing property of laws (Functor, Monad and so on). I have a copy/paste of laws for every monad... and it sucks! Your property testing infrastructure is amazing.
Luca Piccinelli
@lucapiccinelli
I have one question. In Konad in my property testing, I was testing, for example, Result<Double>. A friend of mine, that is mentoring me a little on FP, noticed that I'm testing only a nice of the universe. In Arrow I found this
image.png
Then also you are testing only on strings and int, for example in the Either class. It would be very interesting for me having your opinion about that.
Paco
@pakoito
the content is irrelevant to the laws, you could put anything there and it'll behave the same
we never inspect the context, that's the point of genericity, we don't know or specialise for content, so we cannot operate on it
it only operates on the container
if we have to operate on the content, we pass a typeclass that specifies what the content does
i.e. IntMonoid or something
and that's also tested by laws
to do the laws on OOP style just use the interface you're applying to the class that specialises it, right?
instead of a typeclass
Luca Piccinelli
@lucapiccinelli
Thank you so much for your response!
John Coleman
@JohnSColeman

Hi,

Presently one can compose a set of functions that return nullables by using toOption to return None for a failed return. However with the loss of Option there will be no Option.applicative to use.

Can there be a Null.applicative? Without Option what can a null be lifted into to compose it?

Paco
@pakoito
@JohnSColeman Hi John! This chat isn't very active for discussions about future development. I'd suggest the #arrow channel on the kotlinlang slack
John Coleman
@JohnSColeman
@pakoito ok thank you

Given a list of validated, how can I split the list into 2 collections of the invalid and valid collections but unpacked from their Validated wrapppers?
Partition can help to split..

val (validatedTransformationJournals, validatedRuleModifications) = rules.map { it.validatedRuleModification() }
                .partition { it.isInvalid }

but having to do like this sucks:

            validatedTransformationJournals.forEach { validatedJournal ->
                validatedJournal.mapLeft { context.error("rule ID ${it.ruleId} - ${it.errors.joinToString(", ")}") }
            }
Paco
@pakoito
You're probably better off with a regular fold of a pair of two lists
then
  val (succ, fail) = list.fold(emptyList() to emptyList()) { ((succ, fail), value) -> 
    value.fold(
      { succ to (fail + it) },
      { (succ + it) to fail })
  }
Alexis Hernandez
@AlexITC
HI, I'm an arrow-ank user, and I wonder why is the repository archived
Stojan Anastasov
@LordRaydenMK
Alexis Hernandez
@AlexITC
Thanks!
Matthew Cachia
@mcac0006
Hi! I am having trouble figuring out how I can use a For comprehension on a three Either values I have. Is there something I can use out of the box (besides flatmap)? Thank you.
Paco
@pakoito
It depends on what version you're on. One of either { } or Either.fx { } should be available
once in that block, use bind to unpack the Eithers
if the three Eithers are independent from each other, Either.zip or Either.mapN is what you're after
Maureen Elsberry
@MaureenElsberry
Folks, the latest release of Arrow has quite a few major changes, like the deprecation of HKTs and most typeclasses. Here is the release post and migration guide: https://www.47deg.com/blog/arrow-0.13.0-release/
Marcin
@marcincharezinski
Hi, Can I somehow use traverse to remove none elements from map and flatten?
Marcin
@marcincharezinski
mapOf("key" to Some("value"), "secondKey" to None) .filterValues { it is Some<String> } // or { it !is None } or { it.isDefined() } .mapValues { (_, v) -> (v as Some<String>).t }
Paco
@pakoito
filterMap(::identity) should do it
jim108dev
@jim108dev
Hi everybody! Is there any reference implementation for Arrow and Android which up to date and maintained?
Alexis Hernandez
@AlexITC
Is there any plan to get this fixed? I see there was a PR in the seperated ank repository which the main arrow repo doesn't have: arrow-kt/arrow#472
Rohde Fischer
@rfftrifork

so, I might be asking a trivial question, but for once my searching skills are failing me :/ so here goes:

I have val as: List<A> = TODO()
I have a val aToB: (a: A) -> Either<C, B>

what I want is to stop on the first error and return Either<C, List<B>>.

For now I have as.traverse(Either.applicative(), aToB).fix().map { it.fix() }

but isn't there a "cleaner" way to do this, so I don't have to call fix?

Paco
@pakoito
In 0.13 there will be a traverseEither for this, so you don't have to fix() it
specialised for Iterable and Either, which
Uriel Salischiker
@urielsalis
Hi! Im getting
'java.lang.Object arrow.core.Either$Left.getA()' java.lang.NoSuchMethodError: 'java.lang.Object arrow.core.Either$Left.getA()' at io.kotest.assertions.arrow.either.MatchersKt$beLeft$1.test(matchers.kt:72) at io.kotest.assertions.arrow.either.MatchersKt$beLeft$1.test(matchers.kt:65) at io.kotest.matchers.ShouldKt.invokeMatcher(should.kt:36) at io.kotest.matchers.ShouldKt.should(should.kt:31) at io.kotest.assertions.arrow.either.MatchersKt.shouldBeLeft(matchers.kt:63)
When trying to run tests, any ideas of what I might be missing?
on build.gradle.kts I have implementation("io.arrow-kt:arrow-core:0.13.1") implementation("io.arrow-kt:arrow-syntax:0.13.1") kapt("io.arrow-kt:arrow-meta:0.13.1")
Stojan Anastasov
@LordRaydenMK
You might wanna specify the Arrow version for test explicitly. Afik kotest also includes arrow transitively so you might get different versions on the classpath
Moritz Lindner
@linde9821_gitlab

HI :) I Want to work with a for comprehension for the Either monad.

According to "Functional Kotlin" i can do this by

 Either.monad().binding {
// ...
}.ev()

But this doesnt work

My workaround is to build the Couroutine with

runBlocking {
  either {
    //...
  }
}

But i dont think this is the way iam supposed to do this

Stojan Anastasov
@LordRaydenMK
You can use either.eagerfor pure, eager code
Moritz Lindner
@linde9821_gitlab
thx
I guess the example from "Functional Kotlin" is deprecated?
Stojan Anastasov
@LordRaydenMK
Yup, typeclasses were deprecated in 0.12 and removed in 0.13
Moritz Lindner
@linde9821_gitlab
Alright thank you :)
Kieran Simpson
@kierans
I'm a new player to Arrow, however I've done some FP work before in JS using Crocks. My current project is porting a JS library using Crocks to Kotlin so Arrow really grabbed my interest. However I couldn't find an easy "beginners guide" to Arrow. The documentation does talk a lot about Monads which is great, but I'm after other documentation like how to compose functions together, and write point free functions. After doing some digging I managed to use f compose g in my code. However why is compose an infix function? That's the sort of documentation I'm after, and I'm hoping someone can point me in the right direction. :)