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 shapeless.ops.coproduct.{IsCCons, Selector, Unifier} | |
import shapeless.{:+:, CNil, Coproduct} | |
// Party Types ------------------------- | |
sealed trait PartyType | |
sealed trait Region extends PartyType | |
sealed trait Division extends PartyType | |
sealed trait Doctor extends PartyType |
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 shapeless.Nat._ | |
import shapeless.ops.nat.ToInt | |
import shapeless.syntax.sized._ | |
import shapeless.{Nat, Sized} | |
type Vect[N <: Nat] = Sized[IndexedSeq[Int], N] | |
def vect = Sized.apply[IndexedSeq] | |
def times[L <: Nat](k: Int, v1: Vect[L]): Vect[L] = v1.map(_ * k) |
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 shapeless.ops.hlist.{Length, Repeat} | |
import shapeless.{::, Generic, HList, HNil, Nat} | |
case class IceCream(name: String, numCherries: Int, inCone: Boolean) | |
def repeat[I <: HList, L <: Nat, O <: HList](in: I, s: String)( | |
implicit | |
len: Length.Aux[I, L], | |
rep: Repeat.Aux[String :: HNil, L, O] | |
): O = rep(s :: HNil) |
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.MonoidK | |
import scala.util.Try | |
import cats.data.Kleisli | |
import cats.syntax.option._ | |
import cats.syntax.either._ | |
import cats.syntax.compose._ | |
import cats.syntax.foldable._ | |
import cats.syntax.arrow._ | |
import cats.syntax.arrowChoice._ |
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 type_classes.partialorder | |
import cats.PartialOrder | |
import cats.syntax.partialOrder._ | |
import cats.instances.AllInstances | |
import cats.kernel.BoundedSemilattice | |
import cats.kernel.laws.discipline.{BoundedSemilatticeTests, PartialOrderTests} | |
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 java.time.LocalDate | |
import java.time.temporal.ChronoUnit.{DAYS, MONTHS} | |
import cats.instances.AllInstances | |
import cats.kernel.laws.discipline.PartialOrderTests | |
import cats.{Foldable, Monad, Monoid, PartialOrder} | |
import eu.timepit.refined.api.Refined | |
import eu.timepit.refined.numeric.Positive | |
import eu.timepit.refined.refineV | |
import org.scalacheck.{Arbitrary, Gen} |
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.{Kleisli, Nested, Tuple2K} | |
import cats.implicits._ | |
import cats.{Distributive, Functor, Id, Traverse, ~>} | |
// def distribute[G[_]: Functor, A, B](ga: G[A])(f: A => F[B]): F[G[B]] | |
// def cosequence[G[_]: Functor, A](ga: G[F[A]]): F[G[A]] = distribute(ga)(identity) | |
// Function0 ------------------------------ | |
// F = () => ? | |
val d0 = Distributive[() => ?] |
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.{Kleisli, Nested, Tuple2K} | |
import cats.implicits._ | |
import cats.{Distributive, Functor, Id, Traverse, ~>} | |
// def distribute[G[_]: Functor, A, B](ga: G[A])(f: A => F[B]): F[G[B]] | |
// def cosequence[G[_]: Functor, A](ga: G[F[A]]): F[G[A]] = distribute(ga)(identity) | |
// Function0 ------------------------------ | |
// F = () => ? | |
val d0 = Distributive[() => ?] |
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
val afb0: Char => () => String = c => () => s"<$c>" | |
val ga0 = List('a', 'b') | |
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 qiita | |
import java.util.concurrent.{ExecutorService, Executors} | |
import cats.effect._ | |
import cats.syntax.functor._ | |
import fs2.{Pipe, Stream, io, text} | |
import scala.concurrent.ExecutionContext | |
import scala.util.Try |