From c3905ecf47d02fa209381a7b6ceb87e5c44b778a Mon Sep 17 00:00:00 2001 From: rossabaker Date: Thu, 21 Nov 2024 21:00:07 +0000 Subject: [PATCH] deploy: 1cc04eca9f2bc934c869a7c5054b15f6702866fb --- ADOPTERS.html | 2 +- datatypes/contt.html | 12 ++++++------ datatypes/eval.html | 4 ++-- datatypes/freeapplicative.html | 2 +- datatypes/freemonad.html | 4 ++-- datatypes/state.html | 4 ++-- typeclasses/bifoldable.html | 4 ++-- typeclasses/bifunctor.html | 2 +- typeclasses/bimonad.html | 2 +- typeclasses/contravariant.html | 16 ++++++++-------- typeclasses/eq.html | 2 +- typeclasses/semigroup.html | 12 ++++++------ typeclasses/show.html | 6 +++--- 13 files changed, 36 insertions(+), 36 deletions(-) diff --git a/ADOPTERS.html b/ADOPTERS.html index ed02fc0f17..8c4a2ef5a1 100644 --- a/ADOPTERS.html +++ b/ADOPTERS.html @@ -248,6 +248,7 @@

Adopters

  • Colisweb
  • CompStak
  • Coya
  • +
  • Criteo
  • Datum Brain
  • Disney
  • Dripower LTD
  • @@ -278,7 +279,6 @@

    Adopters

  • innFactory GmbH
  • Intent HQ
  • iofod
  • -
  • IPONWEB
  • Iterators
  • ITV
  • Kaluza
  • diff --git a/datatypes/contt.html b/datatypes/contt.html index c0bd850c5a..9853b68752 100644 --- a/datatypes/contt.html +++ b/datatypes/contt.html @@ -286,7 +286,7 @@

    ContT

    Succeeded(user.id) } } -// eval: Eval[UserUpdateResult] = cats.Later@68edb6dd +// eval: Eval[UserUpdateResult] = cats.Later@196ba180

    Finally we can run the resulting Eval to actually execute the computation:

    eval.value
     // Persisting updated user to the DB: User(100,Bob,150)
    @@ -308,7 +308,7 @@ 

    // anotherComputation: ContT[Eval, UserUpdateResult, Map[String, String]] = FromFn( // runAndThen = Single( -// f = cats.data.ContT$$Lambda$14430/0x00007f6330685398@32a2b5ea, +// f = cats.data.ContT$$Lambda$14325/0x00007f8b80680988@2b6918be, // index = 0 // ) // ) @@ -319,7 +319,7 @@

    Succeeded(userFields("id").toInt) } } -// anotherEval: Eval[UserUpdateResult] = cats.Eval$$anon$5@6435b180 +// anotherEval: Eval[UserUpdateResult] = cats.Eval$$anon$5@4833986d anotherEval.value // Persisting these fields to the DB: Map(id -> 100, name -> Bob, age -> 150) @@ -336,7 +336,7 @@

    // updateUserModel: ContT[Eval, UserUpdateResult, User] = FromFn( // runAndThen = Single( -// f = cats.data.ContT$$Lambda$14430/0x00007f6330685398@9a086f1, +// f = cats.data.ContT$$Lambda$14325/0x00007f8b80680988@59dc86b, // index = 0 // ) // ) @@ -370,7 +370,7 @@

    updateUserModel flatMap persistToDb flatMap publishEvent // chainOfContinuations: ContT[Eval, UserUpdateResult, UserUpdateResult] = FromFn( // runAndThen = Single( -// f = cats.data.ContT$$Lambda$14434/0x00007f6330685d20@6c75cdce, +// f = cats.data.ContT$$Lambda$14329/0x00007f8b80681310@658c89b3, // index = 0 // ) // ) @@ -381,7 +381,7 @@

    finalResult } } -// eval: Eval[UserUpdateResult] = cats.Eval$$anon$5@d9681f0 +// eval: Eval[UserUpdateResult] = cats.Eval$$anon$5@399d7a4d eval.value // Updated user model diff --git a/datatypes/eval.html b/datatypes/eval.html index 94df882dcb..97e393275e 100644 --- a/datatypes/eval.html +++ b/datatypes/eval.html @@ -257,7 +257,7 @@

    println("Running expensive calculation...") 1 + 2 * 3 } -// lazyEval: Eval[Int] = cats.Later@198aec11 +// lazyEval: Eval[Int] = cats.Later@7d1822b2 lazyEval.value // Running expensive calculation... @@ -276,7 +276,7 @@

    println("Running expensive calculation...") 1 + 2 * 3 } -// always: Eval[Int] = cats.Always@6d1e4aaf +// always: Eval[Int] = cats.Always@968fed2 always.value // Running expensive calculation... diff --git a/datatypes/freeapplicative.html b/datatypes/freeapplicative.html index 0bb56e8d0e..4ef2b9a437 100644 --- a/datatypes/freeapplicative.html +++ b/datatypes/freeapplicative.html @@ -275,7 +275,7 @@

    val validator = prog.foldMap[FromString](compiler)
    -// validator: FromString[Boolean] = cats.instances.Function1Instances$$anon$7$$Lambda$14592/0x00007f6330747958@2ed270c6
    +// validator: FromString[Boolean] = cats.instances.Function1Instances$$anon$7$$Lambda$14487/0x00007f8b806fdbd0@2dcd20cf
     validator("1234")
     // res0: Boolean = false
     validator("12345")
    diff --git a/datatypes/freemonad.html b/datatypes/freemonad.html
    index 720431e16a..522926bd41 100644
    --- a/datatypes/freemonad.html
    +++ b/datatypes/freemonad.html
    @@ -718,7 +718,7 @@ 

    import TeletypeOps._ val state = program.foldMap(interpreter) -// state: TeletypeState[Unit] = cats.data.IndexedStateT@654b3f57 +// state: TeletypeState[Unit] = cats.data.IndexedStateT@57939ad4 val initialState = Nil // initialState: Nil.type = List() val (stored, _) = state.run(initialState).value @@ -789,7 +789,7 @@

    val evaluated = hoisted.foldMap(tryInterpreter) // evaluated: OptTry[Int] = OptionT(value = Success(value = Some(value = 12))) diff --git a/datatypes/state.html b/datatypes/state.html index ca01c94344..6905f7f194 100644 --- a/datatypes/state.html +++ b/datatypes/state.html @@ -474,7 +474,7 @@

    _ <- close _ <- open } yield () -// valid: IndexedStateT[Eval, Closed.type, Open.type, Unit] = cats.data.IndexedStateT@3ec27384

    +// valid: IndexedStateT[Eval, Closed.type, Open.type, Unit] = cats.data.IndexedStateT@7bd99933

    Note that the inferred type of valid correctly models that this computation can be executed only with an initial Closed state.

    valid.run(Open)
     // error: type mismatch;
    @@ -483,7 +483,7 @@ 

    valid.run(Closed) -// res6: Eval[(Open.type, Unit)] = cats.Eval$$anon$1@3549b089

    +// res6: Eval[(Open.type, Unit)] = cats.Eval$$anon$1@3cc1731a diff --git a/typeclasses/bifoldable.html b/typeclasses/bifoldable.html index 61515d607f..53a9bb7758 100644 --- a/typeclasses/bifoldable.html +++ b/typeclasses/bifoldable.html @@ -338,7 +338,7 @@

    s, acc) => acc.map(_ |+| s), (s, acc) => acc.map(_ |+| s) ) -// right: Eval[String] = cats.Eval$$anon$1@1e6233e8 +// right: Eval[String] = cats.Eval$$anon$1@56c1d329 left === expected // res2: Boolean = true @@ -354,7 +354,7 @@

    s, acc) => acc.map(_ |+| s), (s, acc) => acc.map(_ |+| s) ) -// reversedRight: Eval[String] = cats.Eval$$anon$1@bd84e09 +// reversedRight: Eval[String] = cats.Eval$$anon$1@4c39345a reversedRight.value === expected // res4: Boolean = false diff --git a/typeclasses/bifunctor.html b/typeclasses/bifunctor.html index 75bf71135b..8462743339 100644 --- a/typeclasses/bifunctor.html +++ b/typeclasses/bifunctor.html @@ -246,7 +246,7 @@

    error => DomainError(error.getMessage), dateTime => dateTime.toEpochSecond ) -// res0: Either[DomainError, Long] = Right(value = 1731756269L) +// res0: Either[DomainError, Long] = Right(value = 1732222779L)

    Bifunctor also defines a convenience function called leftMap, which is defined as follows:

    def leftMap[A, B, C](fab: F[A, B])(f: A => C): F[C, B] = bimap(fab)(f, identity)

    There is no rightMap however - use map instead. The reasoning behind this is that in Cats, the instances of diff --git a/typeclasses/bimonad.html b/typeclasses/bimonad.html index cf96fda34f..729438e0c2 100644 --- a/typeclasses/bimonad.html +++ b/typeclasses/bimonad.html @@ -263,7 +263,7 @@

    override def tailRecM[A, B](a: A)(fn: A => NonEmptyList[Either[A, B]]): NonEmptyList[B] = ??? } -// nelBimonad: Bimonad[NonEmptyList] = repl.MdocSession$MdocApp$$anon$1@2672b8d6 +// nelBimonad: Bimonad[NonEmptyList] = repl.MdocSession$MdocApp$$anon$1@57db4c2f

    Note the equivalence:

    nelBimonad.pure(true).extract === NonEmptyList.one(true).head
     // res0: Boolean = true
    diff --git a/typeclasses/contravariant.html b/typeclasses/contravariant.html index 3e87d210f4..b5e1ec0db0 100644 --- a/typeclasses/contravariant.html +++ b/typeclasses/contravariant.html @@ -246,7 +246,7 @@

    implicit val showSalary: Show[Salary] = showMoney.contramap(_.size) -// showSalary: Show[Salary] = cats.Show$$anon$2$$Lambda$15388/0x00007f63309f5210@5045fb72 +// showSalary: Show[Salary] = cats.Show$$anon$2$$Lambda$15283/0x00007f8b8099eb60@65cb90ae Salary(Money(1000)).show // res0: String = "$1000" @@ -266,7 +266,7 @@

    import scala.math.Ordered._ implicit val moneyOrdering: Ordering[Money] = Ordering.by(_.amount) -// moneyOrdering: Ordering[Money] = scala.math.Ordering$$anon$5@7da963f1 +// moneyOrdering: Ordering[Money] = scala.math.Ordering$$anon$5@7d2df189 Money(100) < Money(200) // res3: Boolean = true @@ -276,17 +276,17 @@

    class A class B extends A val b: B = new B -// b: B = repl.MdocSession$MdocApp$B@2e6ceb8a +// b: B = repl.MdocSession$MdocApp$B@257332ff val a: A = b -// a: A = repl.MdocSession$MdocApp$B@2e6ceb8a +// a: A = repl.MdocSession$MdocApp$B@257332ff val showA: Show[A] = Show.show(a => "a!") -// showA: Show[A] = cats.Show$$$Lambda$15387/0x00007f63309f4d98@1abcc77a +// showA: Show[A] = cats.Show$$$Lambda$15282/0x00007f8b8099e6e8@2f6cf955 val showB1: Show[B] = showA.contramap(b => b: A) -// showB1: Show[B] = cats.Show$$anon$2$$Lambda$15388/0x00007f63309f5210@394d0914 +// showB1: Show[B] = cats.Show$$anon$2$$Lambda$15283/0x00007f8b8099eb60@2ded14a val showB2: Show[B] = showA.contramap(identity[A]) -// showB2: Show[B] = cats.Show$$anon$2$$Lambda$15388/0x00007f63309f5210@1ad64254 +// showB2: Show[B] = cats.Show$$anon$2$$Lambda$15283/0x00007f8b8099eb60@3bb8e5ea val showB3: Show[B] = Contravariant[Show].narrow[A, B](showA) -// showB3: Show[B] = cats.Show$$$Lambda$15387/0x00007f63309f4d98@1abcc77a +// showB3: Show[B] = cats.Show$$$Lambda$15282/0x00007f8b8099e6e8@2f6cf955

    Subtyping relationships are "lifted backwards" by contravariant functors, such that if F is a lawful contravariant functor and B <: A then F[A] <: F[B], which is expressed by Contravariant.narrow.

    diff --git a/typeclasses/eq.html b/typeclasses/eq.html index 867a057180..b1e7092ef2 100644 --- a/typeclasses/eq.html +++ b/typeclasses/eq.html @@ -257,7 +257,7 @@

    Eq

    implicit val eqFoo: Eq[Foo] = Eq.fromUniversalEquals -// eqFoo: Eq[Foo] = cats.kernel.Eq$$anonfun$fromUniversalEquals$2@6a23956e +// eqFoo: Eq[Foo] = cats.kernel.Eq$$anonfun$fromUniversalEquals$2@4c1daaab Foo(10, "") === Foo(10, "") diff --git a/typeclasses/semigroup.html b/typeclasses/semigroup.html index 32514aa9a8..dc26d73c4e 100644 --- a/typeclasses/semigroup.html +++ b/typeclasses/semigroup.html @@ -269,23 +269,23 @@

    import cats.Semigroup import cats.syntax.all._
    Semigroup[Int]
    -// res8: Semigroup[Int] = cats.kernel.instances.IntGroup@68cad8c3
    +// res8: Semigroup[Int] = cats.kernel.instances.IntGroup@3eb96cbc
     Semigroup[String]
    -// res9: Semigroup[String] = cats.kernel.instances.StringMonoid@290266b0
    +// res9: Semigroup[String] = cats.kernel.instances.StringMonoid@746c207

    Instances for type constructors regardless of their type parameter such as List (++) and Set (union)...

    Semigroup[List[Byte]]
    -// res10: Semigroup[List[Byte]] = cats.kernel.instances.ListMonoid@3976d8f0
    +// res10: Semigroup[List[Byte]] = cats.kernel.instances.ListMonoid@6f531f67
     Semigroup[Set[Int]]
    -// res11: Semigroup[Set[Int]] = cats.kernel.instances.SetSemilattice@36397054
    +// res11: Semigroup[Set[Int]] = cats.kernel.instances.SetSemilattice@580c6a2d
     
     trait Foo
     Semigroup[List[Foo]]
    -// res12: Semigroup[List[Foo]] = cats.kernel.instances.ListMonoid@3976d8f0
    +// res12: Semigroup[List[Foo]] = cats.kernel.instances.ListMonoid@6f531f67

    And instances for type constructors that depend on (one of) their type parameters having instances such as tuples (pointwise combine).

    Semigroup[(List[Foo], Int)]
    -// res13: Semigroup[(List[Foo], Int)] = cats.kernel.Monoid$$anon$2@80bba90
    +// res13: Semigroup[(List[Foo], Int)] = cats.kernel.Monoid$$anon$2@2d25211c

    Example usage: Merging maps

    Consider a function that merges two Maps that combines values if they share diff --git a/typeclasses/show.html b/typeclasses/show.html index c498634618..eedb1ea204 100644 --- a/typeclasses/show.html +++ b/typeclasses/show.html @@ -229,7 +229,7 @@

    Show

    Most often, this is unwanted behaviour, as the standard implementation of toString on non case classes is mostly gibberish. Consider the following example:

    (new {}).toString
    -// res0: String = "repl.MdocSession$MdocApp$$anon$1@6b6ba71a"
    +// res0: String = "repl.MdocSession$MdocApp$$anon$1@11e5099c"

    The fact that this code compiles is a design flaw of the Java API. We want to make things like this impossible, by offering the toString equivalent as a type class, instead of the root of the class hierarchy. In short, Show allows us to only have String-conversions defined for the data types we actually want.

    @@ -245,12 +245,12 @@

    Show

    case class Person(name: String, age: Int) implicit val showPerson: Show[Person] = Show.show(person => person.name) -// showPerson: Show[Person] = cats.Show$$$Lambda$15387/0x00007f63309f4d98@51e64d28 +// showPerson: Show[Person] = cats.Show$$$Lambda$15282/0x00007f8b8099e6e8@249d87b6 case class Department(id: Int, name: String) implicit val showDep: Show[Department] = Show.fromToString -// showDep: Show[Department] = cats.Show$$$Lambda$14425/0x00007f633064e6a8@1f0d0c52 +// showDep: Show[Department] = cats.Show$$$Lambda$14320/0x00007f8b806498d0@65f951ad

    This still may not seem useful to you, because case classes already automatically implement toString, while show would have to be implemented manually for each case class. Thankfully with the help of a small library called kittens a lot of type class instances including Show can be derived automatically!

    Cats also offers Show syntax to make working with it easier.