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
| object instances { | |
| implicit val accessTokenDbIdentifiable: DbIdentifiable.Aux[AccessToken, AccessTokens] = | |
| new DbIdentifiable.Aux[AccessToken, AcessTokens] { | |
| val table = TableQuery[AccessTokens] | |
| def getDbId(accessToken: AccessToken): Long = AccessToken | |
| def withItemId(item: AccessToken, id: Long): AccessToken = item.copy(id = Option(id)) | |
| } | |
| implicit val characterDbIdentifiable: DbIdentifiable.Aux[Character, Characters] = | |
| new DbIdentifiable.Aux[Character, Characters] { |
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
| class MoreMonadErrorOps[F[_], A](val fa: F[A]) extends AnyVal { | |
| def liftEmpty[E](implicit FE: MonadError[F, E]): PartiallyAppliedLiftEmpty[F, A, E] = | |
| new PartiallyAppliedLiftEmpty[F, A, E] { | |
| override val fa: F[A] = fa | |
| override val F: MonadError[F, E] = FE | |
| } | |
| } | |
| trait PartiallyAppliedLiftEmpty[F[_], A, E] { | |
| val fa: 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
| class MoreMonadErrorOps[F[_], A](val fa: F[A]) extends AnyVal { | |
| def liftError[G[_], C, D, E](nt: F ~> G)(raiseErr: C => G[E])(implicit G: MonadError[G, E], ev: A <~< Validation[C, D]): G[D] = | |
| for { | |
| a <- nt(fa) | |
| validation = ev(a) | |
| result <- validation.fold(raiseErr(_).flatMap(G.raiseError[D]), G.pure(_)) | |
| } yield result |
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
| def index(id: UUIDFor[File]): F[ValidationNel[StoreTreeError, List[DatabaseFile]]] = { | |
| for { | |
| maybeDbFile <- mToF(songDb.getDirectory(id)) | |
| dbFile <- maybeDbFile.getOrElseF(F.raiseError[Directory](IndexTargetNotFoundInDatabase(id))) | |
| maybeFileSystemTree <-nToF(fileTree(apiKeyToPath(dbFile.apiKey.value), None)) | |
| fileSystemTree <- maybeFileSystemTree.getOrElseF(F.raiseError[FileTree](IndexTargetNotFoundInFileSystem(dbFile.apiKey.value))) | |
| storedTree <- mToF(storeTree(fileSystemTree, None)) | |
| } yield storedTree |
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 scalaz.effect | |
| import java.util.concurrent.TimeUnit | |
| import org.openjdk.jmh.annotations._ | |
| import scala.concurrent.Await | |
| import IOBenchmarks._ | |
| @State(Scope.Thread) | |
| @BenchmarkMode(Array(Mode.Throughput)) |
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
| public class wot.DoIt { | |
| public scala.collection.immutable.List<scala.Option<java.lang.Object>> foo(scala.collection.immutable.List<scala.Tuple2<java.lang.Object, scala.Option<java.lang.Object>>>); | |
| Code: | |
| 0: aload_1 | |
| 1: invokedynamic #39, 0 // InvokeDynamic #0:apply:()Lscala/Function1; | |
| 6: getstatic #45 // Field scala/collection/immutable/List$.MODULE$:Lscala/collection/immutable/List$; | |
| 9: invokevirtual #49 // Method scala/collection/immutable/List$.canBuildFrom:()Lscala/collection/generic/CanBuildFrom; | |
| 12: invokevirtual #55 // Method scala/collection/immutable/List.map:(Lscala/Function1;Lscala/collection/generic/CanBuildFrom;)Ljava/lang/Object; | |
| 15: checkcast #51 // class scala/collection/immutable/List | |
| 18: areturn |
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
| public final class wot.DoIt$$anonfun$foo$1$$anonfun$apply$1 extends scala.runtime.AbstractFunction1$mcII$sp implements scala.Serializable { | |
| public static final long serialVersionUID; | |
| public final int apply(int); | |
| Code: | |
| 0: aload_0 | |
| 1: iload_1 | |
| 2: invokevirtual #20 // Method apply$mcII$sp:(I)I | |
| 5: ireturn |
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
| scala> val x: In = 10 | |
| x: ScalaScript.In = 10 with properties Map() | |
| scala> x.foo = "bar" | |
| x.foo: Any = bar | |
| scala> x | |
| res4: ScalaScript.In = 10 with properties Map(foo -> bar with properties Map()) |
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.reflect.ClassTag | |
| import scala.reflect.runtime.universe._ | |
| import scala.language.dynamics | |
| import scala.language.implicitConversions | |
| import scala.reflect.api.{Mirror => SRMirror, TypeCreator, Universe} | |
| import scala.Predef.{implicitly, locally, any2stringadd => _} | |
| class ScalaScripter(val a: Any) extends Dynamic { | |
| import ScalaScript.{enable => toScalaScript, disable => unScalaScript} |
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
| sealed trait Pipeline[A, B, C] { | |
| def compose[D, E, F](that: Pipeline[D, E, F]): Compose[A, B, C, D, E] = Compose(this, that) | |
| } | |
| case class Compose[A, B, C, D, E](p1: Pipeline[A, B, C], p2: Pipeline[C, D, E]) extends Pipeline[A, (B, D), E] | |
| case class Run[A, B, C](f: A => B => C) extends Pipeline[A, B, C] | |