Dependent typing, refinement types using SMT solver
Testing
Categorize words to specific domain
final case class ArrayLog[A]( | |
private val arr: Array[A], | |
private val curWriteIdx: Int, | |
maxLength: Int | |
)(using ct: ClassTag[A]) { x => | |
private inline def offset: Int = | |
if curWriteIdx < maxLength then 0 else curWriteIdx - maxLength | |
inline def size: Int = |
package infrastructure.repository.codec | |
import skunk.Codec | |
import PgRangeSupportUtils.* | |
enum EdgeType: | |
case `[_,_)` | |
case `(_,_]` | |
case `(_,_)` | |
case `[_,_]` |
import cats.Id | |
import cats.effect.{ IO, Resource } | |
import cats.effect.unsafe.IORuntime | |
import cats.implicits.* | |
import com.codedx.util.MapK | |
import fs2.Stream | |
import fs2.concurrent.Topic | |
import scala.collection.mutable.ListBuffer | |
import scala.concurrent.duration.* |
import cats.implicits.* | |
import cats.Id | |
import scala.collection.mutable.ListBuffer | |
import fs2.Stream | |
// The message broking interface | |
trait MessageBroker[F[_], Router[_]]: | |
def push[MsgKey: ValueOf](value: Router[MsgKey]): F[Unit] | |
def subscribe[MsgKey: ValueOf]: Stream[F, Router[MsgKey]] |
import akka.http.scaladsl.marshalling.{GenericMarshallers, ToResponseMarshaller} | |
import cats.Id | |
import cats.effect.IO | |
import cats.effect.std.Dispatcher | |
import cats.syntax.apply.* | |
import scala.concurrent.Future | |
object FMarshaller: | |
given [A](using m: ToResponseMarshaller[A]): ToResponseMarshaller[Future[A]] = | |
GenericMarshallers.futureMarshaller |
case class TradeEvent() | |
case class OrderEvent() | |
type Channel = "trades" | "orders" | |
// def sub2[Channels <: Tuple](channels: Channels)(using Channel <:< Tuple.Union[Channels]) = channels.toList | |
type SelChannel[C <: Tuple] = C match { | |
case "trades" *: xs => TradeEvent | SelChannel[xs] | |
case "orders" *: xs => OrderEvent | SelChannel[xs] |
open System;; | |
let random = new Random(); | |
let _rollTheDice (): (int|string) = | |
let number = random.Next(1, 6) | |
if (number >= 2) then number else "Winner" | |
let cls () = System.Console.Clear();; | |
type A = (int|string|int64) |
type CompareResult<'a, 'b> = | |
| FoundPair of 'a * 'b | |
| UnmatchedLHS of 'a | |
| UnmatchedRHS of 'b | |
[<RequireQualifiedAccess>] | |
module ListCompare = | |
let compare xsKeySelector ysKeySelector xs ys = | |
let xs = | |
xs |
type private InternalElement<'Key, 'Value when 'Key: comparison> = | |
{ key: 'Key | |
data: 'Value | |
polygon: Polygon } | |
[<Struct>] | |
type STRtree<'Key, 'Value when 'Key: comparison> = | |
private { map: Map<'Key, InternalElement<'Key, 'Value>> | |
strTree: NetTopologySuite.Index.Strtree.STRtree<InternalElement<'Key, 'Value>> } |
Dependent typing, refinement types using SMT solver
Testing
Categorize words to specific domain