- object becomes module
- package becomes module
- package object becomes module
- Support for top-level definitions
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 java.util.concurrent.atomic.AtomicInteger | |
import scala.concurrent._ | |
import duration._ | |
import ExecutionContext.Implicits.global | |
def ftraverse[A, B](xs: Seq[A])(f: A => Future[B]): Future[Seq[B]] = { | |
if(xs.isEmpty) Future successful Seq.empty[B] | |
else f(xs.head) flatMap { fh => ftraverse(xs.tail)(f) map (r => fh +: r) } | |
} |
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 java.time.format.{DateTimeFormatter, DateTimeFormatterBuilder} | |
import java.time.temporal.ChronoField | |
import java.time.{LocalDateTime, ZoneId} | |
import io.getquill._ | |
import io.getquill.naming.SnakeCase | |
import io.getquill.sources.sql.idiom.PostgresDialect | |
case class Test(date: Option[LocalDateTime]) |
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 doobie._ | |
import doobie.imports._ | |
import scala.concurrent.duration._ | |
import scalaz.Nondeterminism | |
import scalaz.concurrent.Task | |
import scalaz.std.list._ | |
// def transactor: Transactor[Task] = ??? |
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
object Rational { | |
implicit def rationalInt(n: Int): Rational = | |
Rational(n, 1) | |
def gcd(a: Int, b: Int): Int = | |
if (b == 0) a else gcd(b, a % b) | |
} | |
case class Rational(p: Int, q: Int) { | |
require(q != 0, "Denominator 'q' cannot be 0") |
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 cats.syntax.apply._ | |
import io.circe._ | |
import io.circe.literal._ | |
object JsonValidation{ | |
def validate[A: Decoder]( f: HCursor => ACursor, pred: A => Boolean, err: A => String ): Decoder[A] = | |
Decoder.instance( | |
f andThen{ ac => | |
ac.as[A].flatMap( a => | |
if ( pred( a ) ) |
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
[info] Updating facebookApi... | |
[info] Updating userSearchApi... | |
[info] Updating ... | |
[info] Updating auth... | |
[info] Done updating. | |
[warn] There may be incompatibilities among your library dependencies. | |
[warn] Run 'evicted' to see detailed eviction warnings | |
[info] Updating accountApi... | |
[info] Done updating. | |
[warn] There may be incompatibilities among your library dependencies. |
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 com.lightbend.lagom.scaladsl.playjson.JsonSerializer | |
import reflect.macros._ | |
object JsonSerializerImpl { | |
/** | |
* Generates a list of JsonSerializers for all direct subtypes of type T. Every subtype needs an implicit Format[T] | |
* in scope at the place of expansion. | |
* @param c | |
* @tparam T |
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 cats.effect._ | |
import cats.implicits._ | |
import com.twitter.finagle.{Http, ListeningServer} | |
import doobie._ | |
import doobie.hikari._ | |
import io.catbird.util._ | |
import io.catbird.util.effect._ | |
object App extends IOApp { | |
val transactor: Resource[IO, HikariTransactor[IO]] = { |
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
override def run(args: List[String]): IO[ExitCode] = { | |
val databaseConfig = DatabaseConfig( | |
host = "localhost", | |
port = 5432, | |
username = "postgres", | |
database = "postgres", | |
password = None, | |
strategy = Strategy.SearchPath, | |
debug = true | |
) |
OlderNewer