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 ex01 | |
import cats.Eq | |
import cats.laws.discipline.MonadTests | |
import ex01.Prob.Event | |
import ex01.ProbInstances._ | |
import org.scalacheck.{Gen, _} | |
import org.scalatest.FunSuite | |
import org.typelevel.discipline.scalatest.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
package ratio1 | |
import cats.Apply | |
import cats.instances.int._ | |
import cats.syntax.all._ | |
import eu.timepit.refined.cats._ | |
import eu.timepit.refined.refineMV | |
import eu.timepit.refined.scalacheck.numeric.chooseRefinedNum | |
import org.scalacheck.Gen._ | |
import org.scalacheck.Prop.forAll |
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 ratio1 | |
import cats.Eq | |
import eu.timepit.refined.refineV | |
import eu.timepit.refined.api.Refined | |
import eu.timepit.refined.boolean.Not | |
import eu.timepit.refined.generic.Equal | |
import eu.timepit.refined.{W, refineMV} | |
import shapeless.Nat._0 |
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.Arrow | |
import cats.data.{Cokleisli, NonEmptyList} | |
import cats.instances.function._ | |
import cats.syntax.compose._ | |
val f1 = Arrow[Function].lift(1d / (_: Int)) | |
f1(10) | |
val A = Arrow[Function] |
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.Arrow | |
sealed case class SimpleFunc[A, B](runF: A => B) | |
trait SimpleFuncInstances { | |
implicit val simpleFuncArrow: Arrow[SimpleFunc] = new Arrow[SimpleFunc] { | |
def lift[A, B](f: A => B): SimpleFunc[A, B] = SimpleFunc(f) | |
def first[A, B, C](fa: SimpleFunc[A, B]): SimpleFunc[(A, C), (B, C)] = | |
SimpleFunc { case (a, c) => (fa runF a , c) } |
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.Arrow | |
import cats.data.Kleisli | |
sealed case class SimpleFunc[A, B](runF: A => B) | |
import cats.syntax.arrow._ | |
import cats.syntax.compose._ | |
def arr[F[_, _]: Arrow, A, B](f: A => B): F[A, B] = Arrow[F] lift f | |
def split[F[_, _]: Arrow, A]: F[A, (A, A)] = arr(x => (x, x)) |
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.Monoid | |
import cats.arrow.Arrow | |
import cats.data.Kleisli | |
sealed case class SimpleFunc[A, B](runF: A => B) | |
import cats.syntax.arrow._ | |
import cats.syntax.compose._ | |
def arr[F[_, _]: Arrow, A, B](f: A => B): F[A, B] = Arrow[F] lift f |
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.syntax.option._ | |
// domain layer ----------------------------------------------------------- | |
import monix.eval.Task | |
case class Movie(id: Int, title: String) | |
trait MovieRepoComponent { | |
trait MovieRepo { | |
def getMovie(id: Int): Task[Option[Movie]] | |
} |
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.syntax.option._ | |
// domain layer ----------------------------------------------------------- | |
import monix.eval.Task | |
case class Movie(id: Int, title: String) | |
trait MovieRepo { | |
def getMovie(id: Int): Task[Option[Movie]] | |
} |
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.syntax.option._ | |
// domain layer ----------------------------------------------------------- | |
import monix.eval.Task | |
import cats.data.ReaderT | |
case class Movie(id: Int, title: String) | |
trait MovieRepo { | |
def getMovie(id: Int): Task[Option[Movie]] |