import argonaut._, Argonaut._
import scala.util.control.NoStackTrace
final case class UncaughtException(error: String) extends RuntimeException with NoStackTrace
implicit val UncaughtExceptionJsonEncoder: EncodeJson[UncaughtException] =
jencode1L((e: UncaughtException) => e.getMessage)("error")
scala> UncaughtExceptionJsonEncoder.encode(UncaughtException("a"))
import scalaz._, Scalaz._, concurrent._, stream.Process, stream.async
val signal = async.signal[Boolean]
val signalChanges: Process[Task,Boolean] = signal.discrete
val updateSignal: Task[Unit] = Task.apply {
signal.set(true).run // Time = 1
Thread.sleep(2000)
signal.set(true).run // Time = 2
$mkdir spark_sandbox
$cd spark_sandbox
$cat build.sbt
scalaVersion := "2.11.8"
libraryDependencies += "org.apache.spark" % "spark-core_2.11" % "2.1.0"
$sbt console
scala> import org.apache.spark.SparkConf
scala> import org.apache.spark.SparkContext
This file contains 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 io.circe._ | |
import io.circe.parser._ | |
import io.circe.syntax._ | |
scala> val ints = "[1,2,3]".asJson | |
ints: io.circe.Json = "[1,2,3]" | |
scala> Decoder.decodeList[Int].decodeJson(ints) | |
res1: io.circe.Decoder.Result[List[Int]] = Left(DecodingFailure([A]List[A], List())) |
scala> IsValidInductive[_3 :: _4 :: _5 :: _8 :: _8 :: _2 :: _8 :: _6 :: _5 :: HNil]
java.lang.StackOverflowError
at scala.reflect.internal.tpe.TypeMaps$TypeMap.mapOver(TypeMaps.scala:110)
at scala.reflect.internal.tpe.TypeMaps$FilterTypeCollector.traverse(TypeMaps.scala:1058)
at scala.reflect.internal.tpe.TypeMaps$TypeTraverser.apply(TypeMaps.scala:300)
at scala.reflect.internal.tpe.TypeMaps$TypeTraverser.apply(TypeMaps.scala:298)
at scala.reflect.internal.tpe.TypeMaps$TypeMap.mapOver(TypeMaps.scala:115)
at scala.reflect.internal.tpe.TypeMaps$FilterTypeCollector.traverse(TypeMaps.scala:1058)
at scala.reflect.internal.tpe.TypeMaps$TypeTraverser.apply(TypeMaps.scala:300)
https://github.com/kevinmeredith/KataBankOCR_shapeless/blob/master/src/main/scala/net/main.scala#L60
> console
[info] Starting scala interpreter...
[info]
Welcome to Scala 2.12.1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_112).
Prelude> :i Monad
class Applicative m => Monad (m :: * -> *) where
(>>=) :: m a -> (a -> m b) -> m b
(>>) :: m a -> m b -> m b
return :: a -> m a
fail :: String -> m a
{-# MINIMAL (>>=) #-}
-- Defined in ‘GHC.Base’
instance Monad (Either e) -- Defined in ‘Data.Either’
This file contains 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
# project at https://github.com/kevinmeredith/KataBankOCR_shapeless | |
$pwd | |
/Users/kevinmeredith/Workspace/KataBankOCR_shapeless | |
$time ./runTest.sh | |
[info] Loading project definition from /Users/kevinmeredith/Workspace/KataBankOCR_shapeless/project | |
[info] Set current project to katabankocr_shapeless (in build file:/Users/kevinmeredith/Workspace/KataBankOCR_shapeless/) | |
[info] Compiling 5 Scala sources to /Users/kevinmeredith/Workspace/KataBankOCR_shapeless/target/scala-2.12/classes... | |
^C | |
real 774m29.336s |
This file contains 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.joda.time._ | |
import monix.execution._ | |
import monix.execution.Scheduler.Implicits.global | |
import java.util.concurrent.TimeUnit | |
import scala.util.control.NonFatal | |
def scheduleOncePerDay(time: LocalTime, now: DateTime = DateTime.now())(cb: () => Unit) | |
(implicit s: Scheduler): Cancelable = { | |
val nextTick = { |