Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Fabio Labella
@SystemFw
for which the comparison with functors would make sense
elyphas
@elyphas
@SystemFw , thank you very much.
Fabio Labella
@SystemFw
a representation (in layman's terms) is a vector space that you map another structure to, and a functor is a mapping between categories
elyphas
@elyphas
ah ok
too much math, out of my hands at this moment. :)
I am reading about Yoneda lemma. and this crossed on my way,
@SystemFw , thank you! :)
Rob Norris
@tpolecat
too much math
Impossible
Soren
@srnb_gitlab
@tpolecat Promise me you'll find a monad transformer so we can get a PolecatT?
elyphas
@elyphas
@tpolecat ; really? is more easy?
Fabio Labella
@SystemFw
@elyphas just to be clear, you don't need any of this stuff to be proficient at pure FP
elyphas
@elyphas
@SystemFw , ah ok,
Rob Norris
@tpolecat
I'm kidding. Math is fun but you don't need to know any of this stuff.
But I do think the amount of category theory you can learn in an hour or two ends up being helpful to see some symmetries that otherwise wouldn't be apparent.
But I also think the marginal cost is very high once you get past chapter 1.
At least that's how it has worked out for me.
Fabio Labella
@SystemFw

being helpful to see some symmetries that otherwise wouldn't be apparent.

btw on this, CT can definitely be useful to see how two things you already understand actually relate to each other / are two examples of the same thing, but it's rarely what you want to tackle something you don't understand yet (at least in programming, at least at the typical level of proficiency in CT)

with the right explanations and by reading/writing code, you can understand and use ~all of pure FP without knowing any CT (though most people will pick up some of it almost by accident)
Rob Norris
@tpolecat
Agree with all of that.
Fabio Labella
@SystemFw
but definitely don't fall in the trap of thinking you need to digest a CT book to approach cats or cats-effect
elyphas
@elyphas
:)
thank you both,
Alex Henning Johannessen
@ahjohannessen
Is there some combinator for val a = F[Option[X]]; val b = F[Option[X]] that does a orElse b, now I do (a, b).mapN((a1, b1) => a1.orElse(b1)) - I guess it is something with traverse :D
Rob Norris
@tpolecat
You can do that with OptionT.
(OptionT(a) orElse OptionT(b)).value
You can say <+> instead of orElse, which is cooler. I mean, obviously.
Anton Sviridov
@keynmol
This is offtopic: does anyone here use quiver and/or know who maintains it? I want to publish it for 2.13 but not sure who to contact
Soren
@srnb_gitlab
Ooh! I just did graph stuff here a bit ago

https://gitter.im/typelevel/cats?at=5f64ae7df51808513b4fd4ab

@keynmol it seems https://github.com/getnelson/quiver is the fork you want, no clue who/how to contact tho

Anton Sviridov
@keynmol
ah ok, that's the one I fixed to work with 2.13
Soren
@srnb_gitlab
Honestly I think it'd be useful to create a cats-centric graph library but I'm not at all familiar with the part of graph theory that would say whether or not there's a GraphT monad transformer
And that'd probably be pretty important
Luka Jacobowitz
@LukaJCB
what would a graph monad’s behaviour be?
def flatMap[A, B](fa: Graph[A])(f: A => Graph[B]): Graph[B]
Anton Sviridov
@keynmol
A is probably not going to be the edge or node type, otherwise there's only so much you can do structurally to fit this signature

Quiver is based on a comonad of graph decompositions and it solved my use case without any monadic craziness.

Lack of maintained graph libraries in the ecosystem suggests that either this usecase is super narrow, or people are using a Java library instead

Soren
@srnb_gitlab
The graph decomposition comonad is something I do know about
Anton Sviridov
@keynmol
I linked that blog post just in case, I myself attempted to read it a few times and never got through it :)
Fabio Labella
@SystemFw
ideas here:
  • find someone that wants to maintain quiver (which is inspired by fgl btw)
  • flesh out the scala port of alga
Paul Snively
@paul-snively
I would bet that Tim Perrett would wish to maintain quiver.
Maybe Rúnar, who wrote it in the first place.
Anton Sviridov
@keynmol
I've created an issue on the nelson fork, hopefully Tim (I've seen Ross Baker there, too) will respond. I have all sorts of cross platform/scala versions publishing and just want to make sure there's actually a release process :)
Adam Rosien
@arosien
i've wanted to play with alga, looks cool.
Soren
@srnb_gitlab
  1. is there a way to automatically optimize non-dependent for-comprehensions into a mapN?
  2. is using mapN fine for things that need to be ordered?
  3. is using mapN going to give me a speed increase over a for-comprehension when using an effect type?
Ignore how badly written the project is in general; Is it useful to turn the steps not dependent on eachother into mapNs?
Raas Ahsan
@RaasAhsan
  1. AFAIK there isn't, for comprehensions always desugar into a series of nested flatMaps. not sure if there are compiler plugins that do otherwise
  2. mapN will evaluate effects in the order in which they appear in the tuple
  3. likely not, Applicative functions for Monads are usually written in terms of flatMap
Soren
@srnb_gitlab
@RaasAhsan What about IO? Isn't there this thing where mapN on IO/Task parallelize?
Raas Ahsan
@RaasAhsan
it will for Parallel operations like parMapN, but the regular Applicative instances will evaluate sequentially