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
import cats.Monad | |
import cats.syntax.all._ | |
import scala.collection.immutable.SortedMap | |
final case class MatrixVar(elem: String, map: SortedMap[String, String]) { | |
def render: String = { | |
val parts = map.toList.map(pair => show"${pair._1}=${pair._2}").intercalate(";") | |
show"$elem;$parts" | |
} |
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
private def detectStall[F[_]: Concurrent: Timer, A]: Pipe[F, A, A] = { | |
val currentTime = Sync[F].delay(OffsetDateTime.now()) | |
(stream: Stream[F, A]) => | |
Stream.eval(currentTime).flatMap { startTime => | |
Stream.eval(Ref[F].of(startTime)).flatMap { lastChunkSeen => | |
val watchdog = Stream | |
.fixedRate(30.seconds) | |
.evalMap(_ => (currentTime, lastChunkSeen.get).tupled) | |
.ensure(new RuntimeException("pipeline appears to have stalled"))({ | |
case (now, lastChunk) => |
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
import * as http from "http"; | |
import { ReaderTaskEither } from "fp-ts/lib/ReaderTaskEither" | |
import { TaskEither, fromIO } from "fp-ts/lib/TaskEither"; | |
import { IO } from "fp-ts/lib/IO"; | |
import { Task } from "fp-ts/lib/Task"; | |
import axios, { AxiosInstance } from 'axios'; | |
import { Either, left, right } from "fp-ts/lib/Either"; | |
export type Logger = (s: string) => TaskEither<never, void>; |
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.github.rzeigler.reqs | |
import cats._ | |
import cats.implicits._ | |
import cats.effect._ | |
import cats.effect.implicits._ | |
import org.http4s.client.blaze._ | |
import org.http4s.client._ | |
import org.http4s.Uri | |
import cats.temp.par._ |
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
// Future versions of Hyper may add additional config options, | |
// which will not automatically be merged into this file. | |
// See https://hyper.is#cfg for all currently supported options. | |
module.exports = { | |
config: { | |
// default font size in pixels for all tabs | |
fontSize: 14, | |
// font family with optional fallbacks |
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
import Control.Monad.Free | |
import Control.Monad.State.Lazy | |
data TerminalOp a = ReadLine (String -> a) | WriteLine String a | |
instance Functor TerminalOp where | |
fmap f (ReadLine g) = ReadLine (f . g) | |
fmap f (WriteLine s a) = WriteLine s (f a) | |
type TerminalIO a = Free TerminalOp a |