// All of these compile in Dotty | |
// https://scastie.scala-lang.org/pLOvDSM8QNy7yNfvOhZ6xQ | |
class I0(i: Int) { | |
def this() = this() | |
} | |
object I1 { | |
val t : Int = 10 | |
def this(I1: Int) = { this() } |
import scala.language.{ higherKinds, implicitConversions } | |
object Defns { | |
type Id[T] = T | |
type ApplyTo[T] = { type λ[F[_]] = F[T] } | |
type Const1[T] = { type λ[F[_]] = T } | |
// Natural transform | |
trait ~>[F[_], G[_]] { | |
def apply[T](ft: F[T]): G[T] |
package tracehash | |
final case class Cover(suffixLength: Int, fragmentLength: Int, coverSize: Int) | |
object `package` { | |
def stackTraceHash(ex: Throwable): String = { | |
val stackTrace = principalStackTrace( | |
Slice.of(ex.getStackTrace), | |
ex.isInstanceOf[StackOverflowError]) |
(defun retract-same-position () | |
"Call proof-retract-buffer, but retain position" | |
(interactive) | |
(push-mark) | |
(proof-retract-buffer) | |
(pop-mark)) |
Inductive T := | |
| Var : nat -> T | |
| App : T -> T -> T. | |
Inductive S e : Prop := | |
| def: forall R, (forall i, R i -> S i) -> | |
(forall e', R e' -> S (App e e')) -> S e. | |
Definition def' : | |
forall e, (forall e', S e' -> S (App e e')) -> S e. |
My initial motivation for -XDerivingVia
was deriving across
isomorphisms.
Standard type-class encodings of isos turn out to be awkward due to overlap.
This note outlines a principled way to meta-programming in Scala. It tries to combine the best ideas from LMS and Scala macros in a minimalistic design.
-
LMS: Types matter. Inputs, outputs and transformations should all be statically typed.
-
Macros: Quotations are ultimately more easy to deal with than implicit-based type-lifting
-
LMS: Some of the most interesting and powerful applications of meta-programming
Last updated March 13, 2024
This Gist explains how to sign commits using gpg in a step-by-step fashion. Previously, krypt.co was heavily mentioned, but I've only recently learned they were acquired by Akamai and no longer update their previous free products. Those mentions have been removed.
Additionally, 1Password now supports signing Git commits with SSH keys and makes it pretty easy-plus you can easily configure Git Tower to use it for both signing and ssh.
For using a GUI-based GIT tool such as Tower or Github Desktop, follow the steps here for signing your commits with GPG.
module Subst1 where | |
open import Term | |
infixl 20 _-_ | |
_-_ : {σ : Ty} → (Γ : Con) → Var Γ σ → Con | |
ε - () | |
(Γ , σ) - vz = Γ | |
(Γ , τ) - vs x = (Γ - x) , τ | |