|
Scala example source code file (BifoldableSyntax.scala)
The BifoldableSyntax.scala Scala example source codepackage scalaz package syntax /** Wraps a value `self` and provides methods related to `Bifoldable` */ final class BifoldableOps[F[_, _],A, B] private[syntax](val self: F[A, B])(implicit val F: Bifoldable[F]) extends Ops[F[A, B]] { //// def bifoldMap[M: Monoid](f: A => M)(g: B => M): M = F.bifoldMap(self)(f)(g) def bifoldRight[C](z: => C)(f: (A, => C) => C)(g: (B, => C) => C): C = F.bifoldRight(self, z)(f)(g) def bifoldLeft[C](z: C)(f: (C, A) => C)(g: (C, B) => C): C = F.bifoldLeft(self, z)(f)(g) def bifoldMap1[M: Semigroup](f: A => M)(g: B => M): Option[M] = F.bifoldMap1(self)(f)(g) def bifoldR[C](z: => C)(f: A => (=> C) => C)(g: B => (=> C) => C): C = F.bifoldR(self, z)(f)(g) def bifoldL[C](z: C)(f: C => A => C)(g: C => B => C): C = F.bifoldL(self, z)(f)(g) //// } sealed trait ToBifoldableOps0 { implicit def ToBifoldableOpsUnapply[FA](v: FA)(implicit F0: Unapply2[Bifoldable, FA]) = new BifoldableOps[F0.M,F0.A,F0.B](F0(v))(F0.TC) } trait ToBifoldableOps extends ToBifoldableOps0 { implicit def ToBifoldableOps[F[_, _],A, B](v: F[A, B])(implicit F0: Bifoldable[F]) = new BifoldableOps[F,A, B](v) implicit def ToBifoldableVFromKleisliLike[G[_], F[G[_], _, _],A, B](v: F[G, A, B])(implicit F0: Bifoldable[F[G, ?, ?]]) = new BifoldableOps[F[G, ?, ?], A, B](v)(F0) //// //// } trait BifoldableSyntax[F[_, _]] { implicit def ToBifoldableOps[A, B](v: F[A, B]): BifoldableOps[F, A, B] = new BifoldableOps[F, A, B](v)(BifoldableSyntax.this.F) def F: Bifoldable[F] //// //// } Other Scala examples (source code examples)Here is a short list of links related to this Scala BifoldableSyntax.scala source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.