This file contains hidden or 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.Eval | |
import cats.Eq | |
import cats.data.Ior | |
import cats.data.NonEmptyList | |
import cats.instances.char._ | |
import cats.syntax.all._ | |
////////////////////////////////////////////////////////////////////////// | |
// LAZY LIST | |
////////////////////////////////////////////////////////////////////////// |
This file contains hidden or 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
{-# OPTIONS_GHC -fdefer-typed-holes #-} | |
{-# LANGUAGE BlockArguments, ScopedTypeVariables, InstanceSigs, ViewPatterns #-} | |
module Main where | |
import GHC.Base (liftA2, Alternative, MonadPlus, join) | |
import Data.Foldable (asum, msum) | |
import Data.Functor ((<&>)) | |
import Test.QuickCheck |
This file contains hidden or 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
module | 145 | |
---|---|---|
export | 141 | |
where | 121 | |
import | 120 | |
_ | 116 | |
List | 108 | |
$ | 106 | |
c | 104 | |
Just | 104 | |
x | 103 |
This file contains hidden or 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
sealed trait Event[Evt] { | |
def fire(event: Evt): ZIO[PluginEnv, Throwable, Unit] | |
def register[R <: PluginEnv](priority: EventPriority, ignoreCancelled: Boolean) | |
(cb: Evt => ZIO[R, Throwable, Unit]): ZIO[R, Nothing, Canceler] | |
def await[R <: PluginEnv, A](priority: EventPriority, ignoreCancelled: Boolean) | |
(check: Evt => ZIO[R, Nothing, Option[A]]): ZIO[R, Nothing, A] | |
} | |
object Event { |
This file contains hidden or 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
<?xml version="1.0" encoding="UTF-8"?> | |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<properties> | |
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |
<maven.compiler.source>1.8</maven.compiler.source> | |
<maven.compiler.target>1.8</maven.compiler.target> | |
<steamcraft.version>0.0.1-SNAPSHOT</steamcraft.version> |
This file contains hidden or 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.{Bifunctor, Functor} | |
import scala.reflect.macros.blackbox | |
trait Initial[F[_]] { | |
def fold[Z](alg: F[Z]): Z | |
} | |
object Initial { | |
def algebra[F[_]]: F[Initial[F]] = macro Impl.apply[F[_]] |
This file contains hidden or 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
object MemUtil { | |
def measure[A >: Null <: AnyRef](create: => A): Double = { | |
// Warm up. | |
gc() | |
usedMemory() | |
// Array to keep strong references to allocated objects | |
val count = 100 | |
var objects = new Array[AnyRef](count) | |
var heap1 = 0L |
This file contains hidden or 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
{-# LANGUAGE KindSignatures, RankNTypes #-} | |
module Main where | |
import Prelude hiding (const) | |
class Lang f where | |
const :: forall c. Int -> f c Int | |
lt :: forall c. f c Int -> f c Int -> f c Bool | |
plus :: forall c. f c Int -> f c Int -> f c Int |
This file contains hidden or 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
data CoalgT f a b = CoalgT (forall z. f b z -> a -> z) | |
-- a -> ExprF b | |
-- ~ a -> (forall z. (ExprF b -> z) -> z) | |
-- ~ a -> (forall z. ExprA b z -> z) | |
-- ~ CoalgT ExprA a b | |
data PatternF f a = PatternF (forall z. f a z -> z) | |
-- ExprF a | |
-- ~ forall z. (ExprF a -> z) -> z | |
-- ~ forall z. ExprA a z -> z |
This file contains hidden or 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
def cover(prefix, arr): | |
arr1 = arr[:] | |
n = 0 | |
while arr1[:len(prefix)] == prefix: | |
arr1 = arr1[len(prefix):] | |
n += 1 | |
return n, arr1 | |
def cost(t): | |
s, r, n = t |