## Where communities thrive

• Join over 1.5M+ people
• Join over 100K+ communities
• Free without limits
##### Activity
Luka Jacobowitz
@LukaJCB
Ross A. Baker
@rossabaker

This passes:

case class Bad(a: Int) { override def equals(a: Any) = true }
checkAll("Semigroupal[Set]", SemigroupalTests[Set].semigroupal[Bad, Bad, Bad])

Bad is chosen to emphasize that there is no Functor[Set].

Ross A. Baker
@rossabaker
I got what I needed for Haskell Study Group at work today, but I could probably polish up that instance (and Map) for a PR next week.
Luka Jacobowitz
@LukaJCB
Nice, thanks Ross! :)
Vojtech Letal
@letalvoj
Is there a dual method for Monoid? Like for example:
If not... would it be accepted? And where it should be placed?
Jakub Kozłowski
@kubukoz
I kinda wish our encoding of Monoid was like Haskell's
with e.g. implicit Monoid[A] => implicit Monoid[A @@ Dual]
Fabio Labella
@SystemFw
well, that's doable
it's just dependent on choosing a newtype solution
Vojtech Letal
@letalvoj
@kubukoz is not it inconvenient to use?
Fabio Labella
@SystemFw
@letalvoj there are some smart convienence functions
e.g. foldMap ala Min [1,2,3]
Vojtech Letal
@letalvoj
@SystemFw in cats? I still do not see how you pass the dual monoid to foldMap[A:Monoid,B] if you are constrained by the A using Dual tag
Fabio Labella
@SystemFw
@letalvoj ah sorry, I assumed you meant in Haskell :grimacing:
Jakub Kozłowski
@kubukoz
yeah in Scala it's not that convenient I guess
Rob Norris
@tpolecat
 implicit class ParallelTraverseOps[F[_]: Traverse, A](fa: F[A]) {
def jankyParTraverse[G[_]: Concurrent, B](f: A => G[B]): G[F[B]] =
fa.traverse(a => f(a).start).flatMap(fs => fs.traverse(_.join))
}
thoughts?
Jakub Kozłowski
@kubukoz
I was actually thinking about something similar a few days ago
Fabio Labella
@SystemFw
we used to have the exact same thing in fs2
Jakub Kozłowski
@kubukoz
when I was asking for Traverse[Set], but well fsck there isn't one
Rob Norris
@tpolecat
haha
Fabio Labella
@SystemFw
removed when Parallel was introduced
but I'm kinda doubting that decision a bit
since parallel applies to Either and Validated as well
and a lot of people dont' want that polymorphism
Jakub Kozłowski
@kubukoz
crazy thought: deriving Parallel for every Concurrent?
Fabio Labella
@SystemFw
they literally want it to mean "run in parallel"
Rob Norris
@tpolecat
Right but I need something that's both Monad (Sync really) and Parallel and I'm not seeing it.
Fabio Labella
@SystemFw
Parallel relates a Monad and an Applicative
Jakub Kozłowski
@kubukoz
right
Fabio Labella
@SystemFw
so the first type param (which is the one you normally care about) is a monad
Rob Norris
@tpolecat
My F ends up being IO and there's no instance for it.
Christopher Davenport
@ChristopherDavenport
Par is all you need to indicate that generally.
Fabio Labella
@SystemFw
there is
Rob Norris
@tpolecat
oh?
Christopher Davenport
@ChristopherDavenport
F[_]: Sync : Par
Fabio Labella
@SystemFw
with cats-par, it's Par[IO]
with Parallel
Rob Norris
@tpolecat
oh what's cats-par?
Fabio Labella
@SystemFw
it's Parallel[IO, IO.Par]
Jakub Kozłowski
@kubukoz
Fabio Labella
@SystemFw
so in poly code you need two type params
Christopher Davenport
@ChristopherDavenport
My attempt to make Parallel not a giant PITA.
Fabio Labella
@SystemFw
def foo[F[_], G[_]](implicit ev: Parallel[F, G])
that's how you use it
however G is uniquely defined given F
and you don't normally care about which specific type it is, only that's related to F via Parallel
so it should really be a type member instead
Rob Norris
@tpolecat
Hm why isn't it a
right