import cats.effect.{ExitCode, IO, IOApp}
import io.github.timwspence.cats.stm.{TVar, STM}
import scala.concurrent.duration._
object Main extends IOApp {
override def run(args: List[String]): IO[ExitCode] =
for {
accountForTim <- TVar.of[Long](100).commit[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
//> using scala 3 | |
//> using toolkit typelevel:default | |
import cats.syntax.all.* | |
import cats.effect.* | |
import org.http4s.ember.client.EmberClientBuilder | |
import org.http4s.* | |
import org.http4s.circe.CirceEntityDecoder.* | |
import org.http4s.implicits.* | |
import org.http4s.headers.Authorization |
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
//> using scala "3.3.1" | |
//> using dep "org.typelevel::cats-effect::3.5.2" | |
import cats.* | |
import cats.syntax.all.* | |
import cats.effect.* | |
import cats.effect.std.Dispatcher | |
import scala.concurrent.duration.* |
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
UnauthorizedAccessException: Access to the path "/private/var/folders/dr/hhydhgf570g59xhljl0l0mkm0000gn/T/AppTranslocation/3231433E-CA2C-435B-BD58-0049DADD6331/d/MapNuke.app/Contents/Export/mapnuke1.map" is denied. | |
System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) (at <319b5411003b47fbaceecace494b6f79>:0) | |
System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize) (at <319b5411003b47fbaceecace494b6f79>:0) | |
(wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int) | |
System.IO.File.Create (System.String path, System.Int32 bufferSize) (at <319b5411003b47fbaceecace494b6f79>:0) | |
System.IO.File.Create (System.String path) (at <319b5411003b47fbaceecace494b6f79>:0) | |
MapFileWriter.GenerateText ( |
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
//> using scala "3.2.1" | |
//> using lib "org.typelevel::cats-effect-testkit:3.4.0" | |
//> using lib "org.typelevel::munit-cats-effect-3:1.0.7" | |
import cats.effect.* | |
import cats.effect.testkit.TestControl | |
import munit.CatsEffectSuite | |
import scala.concurrent.duration.* | |
class Suite extends CatsEffectSuite: |
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
let Tree | |
: Type → Type | |
= λ(Elem : Type) → | |
∀(T : Type) → ∀(Branch : Elem → T → T → T) → ∀(Leaf : T) → T | |
let showTree = | |
λ(elem : Type) → | |
λ(show : elem → Text) → | |
λ(tree : Tree elem) → | |
tree |
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.implicits._ | |
import cats.effect.{Blocker, IO, IOApp, ExitCode} | |
import java.util.concurrent.Executors | |
object Test extends IOApp { | |
override def run(args: List[String]): IO[ExitCode] = { | |
val blocker = Blocker.liftExecutorService(Executors.newCachedThreadPool()) | |
blocker.blockOn( | |
for { | |
_ <- printThread |
def atomically[F[_], A](s: STM[A]): F[A]
def get: STM[A]
def set(a: A): STM[Unit]
def modify(f: A => A): STM[Unit]
def map[A, B](s: STM[A], f: A => B): STM[B]
def orElse[A](attempt: STM[A], fallback: STM[A]): STM[A]
def check(check: => Boolean): STM[Unit]
NewerOlder