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

Scala example source code file (CategorySyntax.scala)

This example Scala source code file (CategorySyntax.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

category, categoryops, categorysyntax, tocategoryops, tocategoryops0, tocategoryopsunapply, tocategoryvfromkleislilike, unapply2

The CategorySyntax.scala Scala example source code

package scalaz
package syntax

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


sealed trait ToCategoryOps0 {
  implicit def ToCategoryOpsUnapply[FA](v: FA)(implicit F0: Unapply2[Category, FA]) =
    new CategoryOps[F0.M,F0.A,F0.B](F0(v))(F0.TC)


trait ToCategoryOps extends ToCategoryOps0 with ToComposeOps {

  implicit def ToCategoryOps[F[_, _],A, B](v: F[A, B])(implicit F0: Category[F]) =
    new CategoryOps[F,A, B](v)

  implicit def ToCategoryVFromKleisliLike[G[_], F[G[_], _, _],A, B](v: F[G, A, B])(implicit F0: Category[F[G, ?, ?]]) =
    new CategoryOps[F[G, ?, ?], A, B](v)(F0)


trait CategorySyntax[F[_, _]] extends ComposeSyntax[F] {
  implicit def ToCategoryOps[A, B](v: F[A, B]): CategoryOps[F, A, B] = new CategoryOps[F, A, B](v)(CategorySyntax.this.F)

  def F: Category[F]


Other Scala examples (source code examples)

Here is a short list of links related to this Scala CategorySyntax.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.