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 scala.language.higherKinds | |
| sealed abstract class Stuff[F[_], +A] | |
| case class Suspend[F[_], A](a: () => F[A]) | |
| extends Stuff[F, A] | |
| def extract[F[_], A](source: Stuff[F, A]): Suspend[F, A] = | |
| source match { | |
| case ref @ Suspend(_) => ref.asInstanceOf[Suspend[F,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 java.lang.reflect.{GenericArrayType, Modifier, ParameterizedType, Type, TypeVariable, WildcardType} | |
| import scala.reflect.{ClassTag, classTag} | |
| object StaticForwarderGenerator { | |
| implicit class arrayOps[A](private val array: Array[A]) extends AnyVal { | |
| def mkStringOrEmpty(start: String, sep: String, end: String): String = | |
| if (array.isEmpty) "" else array.mkString(start, sep, end) | |
| } | |
| def generateFor[T: ClassTag]: String = { |
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 org.openjdk.jmh.annotations._ | |
| final class NoStackTraceIndexOutOfBoundsException extends IndexOutOfBoundsException { | |
| override def fillInStackTrace(): Throwable = this | |
| } | |
| final class NoStackTraceArraySeq[+T](values: Array[T]) { | |
| val size: Int = values.length | |
| def apply(idx: Int): T = |
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._ | |
| import cats.effect.IO | |
| import cats.implicits._ | |
| case class UserId(value: String) extends AnyVal | |
| case class User(id: UserId, name: String, age: Int) | |
| trait DbApi[F[_]] { | |
| def load(id: UserId): F[Option[User]] | |
| def save(user: User): F[Unit] |
OlderNewer