Welcome! Got a question? Do you have -Ypartial-unification turned on? Other FAQs: http://typelevel.org/cats/faq.html
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)
(OptionT(a) orElse OptionT(b)).value
<+>
instead of orElse
, which is cooler. I mean, obviously.
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
def flatMap[A, B](fa: Graph[A])(f: A => Graph[B]): Graph[B]
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
mapN
s?
flatMap
s. not sure if there are compiler plugins that do otherwisemapN
will evaluate effects in the order in which they appear in the tupleApplicative
functions for Monad
s are usually written in terms of flatMap
A question
https://github.com/typelevel/cats/blob/master/core/src/main/scala/cats/data/WriterT.scala#L330
In here liftF requires an Applicative, but it just uses map, why it just don't require a Functor instance?
Cheers
Int
, and a target value, and you want to find the two values that add up to the target.def compute[A: Monoid, F[_]: Foldable: Comonad](fa: F[A], target: A): Option[String] =
fa.coflatten.foldMapK(f => {
val a = f.extract
f.foldMapK(b => Option.when((a |+| b) == target)(s"$a $b"))
})