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 | |
//> using dep org.typelevel::cats-effect:3.5.4 | |
import cats.effect.std.{Random, Semaphore} | |
import cats.syntax.all.* | |
import cats.effect.{IO, IOApp} | |
import scala.concurrent.duration.* | |
object DiningPhilosophers extends IOApp.Simple: |
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 | |
//> using dep org.typelevel::cats-effect:3.5.4 | |
import cats.syntax.all.* | |
import cats.effect.{IO, IOApp} | |
import cats.effect.std.MapRef | |
import java.util.concurrent.{ConcurrentHashMap => JConcurrentHashMap} | |
object FullControlMapRef extends IOApp.Simple: |
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 | |
//> using dep org.typelevel::cats-effect:3.5.4 | |
import cats.syntax.all.* | |
import cats.effect.{IO, IOApp} | |
import cats.effect.std.MapRef | |
object ConcurrencyMapRef extends IOApp.Simple: | |
private val concurrencySample = |
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 | |
//> using dep org.typelevel::cats-effect:3.5.4 | |
import cats.effect.{IO, IOApp} | |
import cats.effect.std.MapRef | |
object SimpleMapRef extends IOApp.Simple: | |
private val simpleSample = | |
for |
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 "2.13.11" | |
//> using lib "org.typelevel::cats-effect::3.5.1" | |
import cats.effect._ | |
import cats.effect.std.{Console, Queue} | |
import cats.instances.list._ | |
import cats.syntax.all._ | |
object ProducerConsumerWithStdQueue extends IOApp { |
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 "2.13.11" | |
//> using lib "org.typelevel::cats-effect::3.5.1" | |
import cats.effect.{Async, Deferred, ExitCode, IO, IOApp, Ref, Sync} | |
import cats.effect.std.Console | |
import cats.instances.list._ | |
import cats.syntax.all._ | |
import java.util.concurrent.ScheduledThreadPoolExecutor | |
import scala.collection.immutable.Queue |
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
package com.hablapps.scalacheck.tests | |
import scala.util.{Try, Failure, Success} | |
import org.scalacheck.commands.Commands | |
import org.scalacheck.{Gen, Prop} | |
import org.scalacheck.Arbitrary._ | |
// SYSTEM TO TEST: VENDING MACHINE OF SOFT DRINKS. \\ | |
object SoftDrink extends Enumeration { |