;; The undo keybindings `C-x u` and `C-_` enter the polyp.
(defpolyp polyp-undo
"_u_ndo _r_edo"
("u" undo-fu-only-undo "C-x u" "C-_")
("r" undo-fu-only-redo))| import cats._ | |
| import cats.implicits._ | |
| import cats.effect._ | |
| import cats.effect.implicits._ | |
| import scala.concurrent.duration._ | |
| import io.chrisdavenport.mapref._ | |
| trait SetOnceCache[F[_], K, V]{ | |
| def get(k: K): F[V] |
| package io.chrisdavenport.shapelessless | |
| import cats._ | |
| import cats.syntax.all._ | |
| import cats.effect._ | |
| import scala.deriving._ | |
| import scala.compiletime._ | |
| import org.tpolecat.typename._ |
| module plfa.part1.Naturals where | |
| data N : Set where | |
| zero : N | |
| suc : N -> N | |
| {-# BUILTIN NATURAL N #-} | |
| import Relation.Binary.PropositionalEquality as Eq | |
| open Eq using (_≡_; refl) |
| scalaVersion := "2.13.1" | |
| enablePlugins(JavaAppPackaging) | |
| maintainer := "[email protected]" | |
| dockerBaseImage := "java:14" |
Monads and delimited control are very closely related, so it isn’t too hard to understand them in terms of one another. From a monadic point of view, the big idea is that if you have the computation m >>= f, then f is m’s continuation. It’s the function that is called with m’s result to continue execution after m returns.
If you have a long chain of binds, the continuation is just the composition of all of them. So, for example, if you have
m >>= f >>= g >>= hthen the continuation of m is f >=> g >=> h. Likewise, the continuation of m >>= f is g >=> h.
This gist demonstrates a trick I came up with which is defining
IsString for Q (TExp a), where a is lift-able. This allows you
to write $$("...") and have the string parsed at compile-time.
On GHC 9, you are able to write $$"..." instead.
This offers a light-weight way to enforce compile-time constraints. It's
basically OverloadedStrings with static checks. The inferred return type
| type ListBuilder() = | |
| /// map | |
| member x.For(l,f) = | |
| List.map f l | |
| /// id | |
| member x.Yield(v) = | |
| v |
| ;; The next line may not be needed | |
| (set-default-font "Source Code Pro for Powerline 13") | |
| ;; Fira code | |
| ;; This works when using emacs --daemon + emacsclient | |
| (add-hook 'after-make-frame-functions (lambda (frame) (set-fontset-font t '(#Xe100 . #Xe16f) "Fira Code Symbol"))) | |
| ;; This works when using emacs without server/client | |
| (set-fontset-font t '(#Xe100 . #Xe16f) "Fira Code Symbol") | |
| ;; I haven't found one statement that makes both of the above situations work, so I use both for now |