|
Scala example source code file (Divisible.scala)
The Divisible.scala Scala example source codepackage scalaz //// /** `Divisible` is the contravariant analogue of `scalaz.Applicative` * * @see [[https://github.com/ekmett/contravariant/blob/v1.3.2/src/Data/Functor/Contravariant/Divisible.hs]] * @see [[https://youtu.be/cB8DapKQz-I?t=20m35s ZuriHac 2015 - Discrimination is Wrong: Improving Productivity]] */ //// trait Divisible[F[_]] extends Divide[F] { self => //// def conquer[A]: F[A] trait DivisibleLaw extends DivideLaw { def rightIdentity[A](fa: F[A])(implicit E: Equal[F[A]]): Boolean = E.equal(divide(fa, conquer[A])(delta), fa) def leftIdentity[A](fa: F[A])(implicit E: Equal[F[A]]): Boolean = E.equal(divide(conquer[A], fa)(delta), fa) } def divisibleLaw = new DivisibleLaw {} //// val divisibleSyntax = new scalaz.syntax.DivisibleSyntax[F] { def F = Divisible.this } } object Divisible { @inline def apply[F[_]](implicit F: Divisible[F]): Divisible[F] = F //// //// } Other Scala examples (source code examples)Here is a short list of links related to this Scala Divisible.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.