Derive semigroup instance for F[A]

90 views Asked by At

It seems trivial to implement it on our own:

implicit def s[F[_]: Monad, A: Semigroup]: Semigroup[F[A]] = 
  Semigroup.instance((fa, fb) => for {
    fa <- fa
    fb <- fb
  } yield fa |+| fb)

But is it possible to derive it automatically? Kittens seems to work with case classes (at least I tried it for that case and it didn't work).

0

There are 0 answers