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.effect.* | |
object Hello extends App { | |
val x: Option[Int] = Some(1) | |
val y: List[Int] = List(1,2,3) | |
// Type constructor: | |
// Option[_] | |
// List[_] |
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
//> using scala "2.13.13" | |
package bench | |
import org.openjdk.jmh.annotations._ | |
import Bench2._ | |
@State(Scope.Benchmark) | |
class asymptoticOptTests2 { | |
@Benchmark |
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
//> using scala "2.13.13" | |
package bench | |
import org.openjdk.jmh.annotations._ | |
import Bench._ | |
class asymptoticOptTests { | |
@Benchmark | |
def O2n = hundred |
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
// This gist showcase a Circe JSON Decoder for which a null value in a field gets decoded into some | |
// arbitrary type, instead of being treated as if it was not present in the request and decoded into None. | |
// This behaviour is semantically unsound, but so are sometimes the business requirements for application development | |
//> using scala "2.13.10" | |
//> using lib "io.circe::circe-core::0.14.6" | |
//> using lib "io.circe::circe-generic::0.14.6" | |
//> using lib "io.circe::circe-parser::0.14.6" | |
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
//> using scala "3.2.2" | |
val x = 1_000_000 | |
val y = 1000000 | |
@main | |
def f(): Unit = if (x == y) println("Values are the same!") else println("Nope :-(") |
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
//> using lib "co.fs2::fs2-core:3.2.4" | |
//> using lib "org.typelevel::cats-effect:3.3.1" | |
import cats.effect.{ExitCode, IO, IOApp} | |
import fs2._ | |
object FunctionalStreams extends IOApp { | |
def run(args: List[String]): IO[ExitCode] = (for { | |
_ <- IO.pure("a") |