This is specifically not useful. In scalaz, we may use tags to get a *different* monoid:
Monoid[Int @@ Multiplication] Monoid[Boolean @@ Conjunction] Being two obvious examples. I think scalaz should roll with a non implicit conversion you can use when you definitely want it, or possibly have a separate tag annotation for those tags which are not meant to incur such different ops Chris > On 25 Sep 2016, at 17:35, Parakhonskiy Gleb <[email protected]> wrote: > > Hi everyone, > I suggest to add such thing to Monoid object. Basically it gives you a monoid > for a tagged type, given a monoid for this type. I found it quite useful, > and if you think that it makes sense, I can make PR. > > > > implicit def monoidOfTagged[T, A](implicit M0: Monoid[A]): Monoid[A @@ T] = > new Monoid[@@[A, T]] { > override def zero: @@[A, T] = Tag.of[T](M0.zero) > > override def append(f1: @@[A, T], f2: ⇒ @@[A, T]): @@[A, T] = > Tag.of[T](M0.append(Tag.unwrap(f1), Tag.unwrap(f2))) > } > > > > And one more suggestion. > You can always take out function from Monad - if it returns the value inside > this Monad: > > def ???[A, B, F[_]: Monad](f: F[A ⇒ F[B]]): A ⇒ F[B] = a ⇒ { > Monad[F].bind(f)(ff ⇒ ff(a)) > } > > It just feels a bit weird to have such high level function laying in the > Utils. I did not find such thing in scalaZ, so may be it makes sense to add > it as well. > > > Thanks for a great library! > Cheers, > Gleb > > > > > -- > You received this message because you are subscribed to the Google Groups > "scalaz" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/scalaz. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "scalaz" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/scalaz. For more options, visit https://groups.google.com/d/optout.
