Say we want different flavors of effect wrappings:
- Cats, over
F[_] - Cats, over
IO - ZIO
- Monix
We introduce an enum for these:
sealed trait EffectWrappingFlavor| int gcd(int x, int y) { | |
| if(x == y) { | |
| return x; | |
| } else if(x < y) { | |
| return gcd(x, y - x); | |
| } else { | |
| return gcd(x - y, y); | |
| } | |
| } |
Say we want different flavors of effect wrappings:
F[_]IOWe introduce an enum for these:
sealed trait EffectWrappingFlavor| pub fn Id(comptime A: type) type { return A; } | |
| pub fn identity(comptime A: type, a: A) A { return a; } | |
| pub fn map(comptime A: type, comptime B: type, a: A, f: fn (_: A) B) B { | |
| return f(a); | |
| } | |
| pub const MonadId = Monad(Id, identity, map); |
I hereby claim:
To claim this, I am signing this object:
| <Multi_key> <a> <c> : "α" | |
| <Multi_key> <A> <bracketleft> : "Α" | |
| <Multi_key> <b> <s> : "β" | |
| <Multi_key> <B> <bracketleft> : "Β" | |
| <Multi_key> <y> <y> : "γ" | |
| <Multi_key> <L> <r> : "Γ" | |
| <Multi_key> <d> <d> : "δ" | |
| <Multi_key> <slash> <backslash> : "Δ" | |
| <Multi_key> <e> <s> : "ε" | |
| <Multi_key> <E> <bracketleft> : "Ε" |
| object Main extends IOApp { | |
| val coordReg = """(\d+) (\d+)""".r | |
| override def run(args: List[String]): IO[ExitCode] = { | |
| implicit val ec: ExecutionContextExecutor = ExecutionContext.global | |
| program[IO].compile.drain.as(ExitCode.Success) | |
| } | |
| def program[F[_]: Monad : ContextShift](implicit ec: ExecutionContext, sync: Sync[F]): Stream[F, Unit] = { |
| import eu.timepit.refined._ | |
| import eu.timepit.refined.api.Refined | |
| import eu.timepit.refined.numeric._ | |
| import fs2._ | |
| def defaultMap[T](implicit numeric: Numeric[T]): Map[T Refined Positive, String] = | |
| Map( | |
| refineV[Positive](numeric.fromInt(3)).right.get -> "fizz", | |
| refineV[Positive](numeric.fromInt(5)).right.get -> "buzz" | |
| ) |
| object Main { | |
| def main(args: Array[String]): Unit = { | |
| println("Hello World!") | |
| } | |
| } | |
| object ,main _< |
| import java.io.File | |
| import com.sun.media.sound.StandardMidiFileReader | |
| import javax.sound.midi.spi.MidiFileReader | |
| import javax.sound.midi.{MidiSystem, ShortMessage, Track} | |
| import scala.io.Source | |
| object Main { |
| note() { | |
| sleep `echo "$1" | bc -l`s | |
| ( speaker-test --frequency $2 --test sine )& pid=$! | |
| sleep `echo "$3" | bc -l`s | |
| kill -9 $pid | |
| } | |
| note 0.004883583279477237 293.6647679174076 0.13967048179304897 & | |
| note 0.14504242340047394 293.6647679174076 0.11378749041181963 & | |
| note 0.26664364705945715 587.3295358348151 0.09767166558954474 & |