This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package adcal_1222 | |
import adcal_1222.Amida._ | |
import cats.instances.AllInstances | |
import cats.kernel.laws.discipline.GroupTests | |
import cats.{Eq, Group} | |
import org.scalacheck.{Arbitrary, Gen} | |
import org.specs2.Specification | |
import org.typelevel.discipline.specs2.Discipline |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cats.Alternative | |
import cats.syntax.apply._ | |
import cats.syntax.semigroupk._ | |
import cats.syntax.option._ | |
import cats.instances.option._ | |
import cats.syntax.traverse._ | |
import cats.instances.list._ | |
trait Div[A] { | |
def div(n: Int): Option[A] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cats.data.Chain | |
import cats.instances.option._ | |
import cats.instances.tuple._ | |
import cats.syntax.bifoldable._ | |
import cats.syntax.bitraverse._ | |
import cats.syntax.option._ | |
import cats.syntax.traverse._ | |
import cats.{Applicative, Bitraverse, Eval} | |
import scala.language.higherKinds |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cats.Contravariant | |
import cats.implicits._ | |
case class Money(amount: Int) | |
case class Earnings(basic: Money) | |
case class Deductions(tax: Money) | |
case class Salary(earnings: Earnings, deductions: Deductions) | |
val salary: Salary = Salary(Earnings(Money(100)), Deductions(Money(10))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cats.arrow.Category | |
import cats.data.{Chain, Kleisli, Writer} | |
import cats.syntax.writer._ | |
import cats.syntax.compose._ | |
type ChainWriter[T] = Writer[Chain[String], T] | |
type KWriter[A, B] = Kleisli[ChainWriter, A, B] | |
//val chainInstance: Category[KWriter] = new Category[KWriter] { | |
// def id[A]: KWriter[A, A] = Kleisli[ChainWriter, A, A] { _.writer(Chain.empty) } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package adcal_1222 | |
import adcal_1222.TupleChain.TupleChain | |
import cats.data.Chain | |
import cats.instances.AllInstances | |
import cats.instances.tuple._ | |
import cats.laws.discipline.BitraverseTests | |
import cats.syntax.bifoldable._ | |
import cats.syntax.bitraverse._ | |
import cats.syntax.traverse._ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package representable01 | |
import cats.instances.AllInstances | |
import cats.laws.discipline.RepresentableTests | |
import cats.{Eq, Functor, Representable} | |
import org.scalacheck.{Arbitrary, Gen} | |
import org.specs2.Specification | |
import org.typelevel.discipline.specs2.Discipline | |
import cats.instances.stream._ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package representable01 | |
import cats.instances.AllInstances | |
import cats.laws.discipline.RepresentableTests | |
import cats.{Apply, Functor, Representable} | |
import org.scalacheck.{Arbitrary, Gen} | |
import org.specs2.Specification | |
import org.typelevel.discipline.specs2.Discipline | |
import cats.syntax.apply._ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cats.{Functor, Monoid, Representable} | |
import cats.instances.stream._ | |
import cats.syntax.representable._ | |
implicit val rep: Representable[Stream] { type Representation = Int } = new Representable[Stream] { | |
def F: Functor[Stream] = implicitly[Functor[Stream]] | |
type Representation = Int | |
def tabulate[A](f: Int => A) = { | |
def loop(n: Int): Stream[A] = f(n) #:: loop(n + 1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package scala_check | |
import scala.util.Try | |
import cats.syntax.either._ | |
import cats.Apply | |
import cats.syntax.apply._ | |
import shapeless.nat._ | |
import eu.timepit.refined.api.Refined | |
import eu.timepit.refined.W | |
import eu.timepit.refined.numeric.Interval.Closed |