Prerequesites:
- Everest installed
- Git
- Visual Studio 2015 or newer with the .NET Framework 4.5.2 Targeting Pack
And either:
- Visual Studio Code
- Iodine for Visual Studio Code
| import cats._, cats.data._, cats.syntax.all._ | |
| import scala.annotation.tailrec | |
| object Main2 { | |
| sealed trait Trace { | |
| def show: String | |
| } | |
| object Trace { | |
| implicit val showTrace: Show[Trace] = Show.show(_.show) |
| import cats._, cats.data._, cats.syntax.all._ | |
| import scala.annotation.tailrec | |
| object Main { | |
| case class Snapshot(comparisons: Int, exchanges: Int, tikz: String) | |
| def main(args: Array[String]): Unit = { | |
| val vector: Vector[Int] = Vector(55, 50, 10, 40, 80, 90, 60, 100, 70, 80, 20, 50, 22) | |
| val (snapshots, _, ()) = heapify[Int].runEmpty(vector).value |
| 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" | |
| ) |