openpgp4fpr:904c153733dbb0106915c0bd975be5bc29d92ca5
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
/.scala-build/ |
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.StackSafeMonad | |
import cats.data.Kleisli | |
import cats.data.OptionT | |
import cats.effect.MonadCancel | |
import cats.effect.Resource | |
final class Routes[F[_], A, B] private (val run: A => Resource[F, Option[B]]) { | |
def map[C](f: B => C): Routes[F, A, C] = | |
Routes(run(_).map(_.map(f))) |
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
// httpApp and dispatcher are required | |
// asyncTimeout and chunkSize have defaults | |
// Builder[F[_]] with constructor args | |
AsyncHttp4sServlet | |
.builder[IO](httpApp, dispatcher) | |
.withAsyncTimeout(5.seconds) | |
.withChunkSize(4096) | |
.build | |
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
{ config, pkgs, ... }: | |
let | |
# In the real world, this is an org tangle. | |
hello = pkgs.writeText "hello" '' | |
{ pkgs, ... }: { | |
home.packages = [ pkgs.hello ]; | |
} | |
''; |
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
//> using scala "2.13" | |
//> using lib "com.armanbilge::bayou:0.1-4fb42c8" | |
//> using lib "org.typelevel::cats-effect:3.3.7" | |
//> using lib "co.fs2::fs2-core:3.2.5" | |
//> using lib "org.typelevel::log4cats-core:2.2.0" | |
//> using lib "org.typelevel::log4cats-slf4j:2.2.0" | |
//> using lib "org.tpolecat::natchez-core:0.1.6" | |
//> using lib "org.tpolecat::natchez-log:0.1.6" | |
import cats.effect.{Trace => _, _} |
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 $ivy.`org.typelevel::munit-cats-effect-3:1.0.7` | |
import $ivy.`org.tpolecat::natchez-mock:0.1.6` | |
import $ivy.`co.fs2::fs2-core:3.2.5` | |
import cats.data.Kleisli | |
import cats.effect.Deferred | |
import cats.effect.IO | |
import cats.effect.IOLocal | |
import cats.effect.MonadCancelThrow | |
import cats.effect.Resource |
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
scala> import org.typelevel.ci._ | |
import org.typelevel.ci._ | |
scala> val f: String => CIString = CIString.apply | |
val f: String => org.typelevel.ci.CIString = $Lambda$1025/2055291664@4bbf38b8 | |
scala> val g: CIString => String = _.toString | |
val g: org.typelevel.ci.CIString => String = $Lambda$1027/1152113439@62108cd3 | |
scala> val rosses = Set("Ross", "ROSS", "ross") // three too many if you ask me |
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._ | |
// A pure functional, contravariant monoidal string builder | |
sealed trait SB[A] { | |
final def render(a: A): String = { | |
val sb = new StringBuilder | |
renderInternal(sb, a) | |
sb.toString | |
} |
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
(use-package lsp-haskell | |
:config | |
(setq lsp-haskell-process-path-hie "haskell-language-server-wrapper") | |
;; xref backends don't compose. This creates one that first consults the | |
;; xref-lsp backend for the latest information from the language server, | |
;; and then falls through to etags for library definitions. | |
(defun my/xref-lsp-etags-backend () 'my/lsp-etags) | |
(cl-defmethod xref-backend-identifier-at-point ((_backend (eql my/lsp-etags))) | |
(xref-backend-identifier-at-point 'xref-lsp)) |
NewerOlder