| career | drupal | java | mac | mysql | perl | scala | uml | unix  

Scala example source code file (AssociativeSyntax.scala)

This example Scala source code file (AssociativeSyntax.scala) is included in the "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Scala by Example" TM.

Learn more about this Scala project at its project page.

Java - Scala tags/keywords

associativeops, associativesyntax, toassociativeops, toassociativeops0, toassociativeopsunapply, unapply2

The AssociativeSyntax.scala Scala example source code

package scalaz
package syntax

/** Wraps a value `self` and provides methods related to `Associative` */
final class AssociativeOps[F[_, _],A, B] private[syntax](val self: F[A, B])(implicit val F: Associative[F]) extends Ops[F[A, B]] {
  import Liskov._

  final def reassociateLeft[TT, C](implicit ev: F[A, B] <~< F[A, F[TT, C]]): F[F[A, TT], C] =

  final def reassociateRight[TT, C](implicit ev: F[A, B] <~< F[F[TT, C], B]): F[TT, F[C, B]] =


sealed trait ToAssociativeOps0 {
  implicit def ToAssociativeOpsUnapply[FA](v: FA)(implicit F0: Unapply2[Associative, FA]) =
    new AssociativeOps[F0.M,F0.A,F0.B](F0(v))(F0.TC)


trait ToAssociativeOps extends ToAssociativeOps0 {

  implicit def ToAssociativeOps[F[_, _],A, B](v: F[A, B])(implicit F0: Associative[F]) =
    new AssociativeOps[F,A, B](v)

  implicit def ToAssociativeVFromKleisliLike[G[_], F[G[_], _, _],A, B](v: F[G, A, B])(implicit F0: Associative[F[G, ?, ?]]) =
    new AssociativeOps[F[G, ?, ?], A, B](v)(F0)



trait AssociativeSyntax[F[_, _]]  {
  implicit def ToAssociativeOps[A, B](v: F[A, B]): AssociativeOps[F, A, B] = new AssociativeOps[F, A, B](v)(AssociativeSyntax.this.F)

  def F: Associative[F]


Other Scala examples (source code examples)

Here is a short list of links related to this Scala AssociativeSyntax.scala source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller


new blog posts


Copyright 1998-2021 Alvin Alexander,
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.