alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Scala example source code file (SplitSyntax.scala)

This example Scala source code file (SplitSyntax.scala) is included in the alvinalexander.com "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

split, splitops, tosplitops, tosplitops0, tosplitopsunapply

The SplitSyntax.scala Scala example source code

package scalaz
package syntax

/** Wraps a value `self` and provides methods related to `Split` */
final class SplitOps[F[_, _],A, B] private[syntax](val self: F[A, B])(implicit val F: Split[F]) extends Ops[F[A, B]] {
  ////
  final def -*-[C, D](k: F[C, D]): F[(A, C), (B, D)] =
    F.split(self, k)
  ////
}

sealed trait ToSplitOps0 {
  implicit def ToSplitOpsUnapply[FA](v: FA)(implicit F0: Unapply2[Split, FA]) =
    new SplitOps[F0.M,F0.A,F0.B](F0(v))(F0.TC)

}

trait ToSplitOps extends ToSplitOps0 with ToComposeOps {

  implicit def ToSplitOps[F[_, _],A, B](v: F[A, B])(implicit F0: Split[F]) =
    new SplitOps[F,A, B](v)


  implicit def ToSplitVFromKleisliLike[G[_], F[G[_], _, _],A, B](v: F[G, A, B])(implicit F0: Split[F[G, ?, ?]]) =
    new SplitOps[F[G, ?, ?], A, B](v)(F0)

  ////

  ////
}

trait SplitSyntax[F[_, _]] extends ComposeSyntax[F] {
  implicit def ToSplitOps[A, B](v: F[A, B]): SplitOps[F, A, B] = new SplitOps[F, A, B](v)(SplitSyntax.this.F)

  def F: Split[F]
  ////

  ////
}

Other Scala examples (source code examples)

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

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

#1 New Release!

FP Best Seller

 

new blog posts

 

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.