Skip to content

Instantly share code, notes, and snippets.

View damienstanton's full-sized avatar

Damien Stanton damienstanton

View GitHub Profile
structure Box α where
val: α
namespace Box
def extract (b : Box α) := b.val
end Box
def a := Box.mk 42
@damienstanton
damienstanton / thorsten_tt.lagda.md
Last active May 1, 2025 23:33
thorsten TT course notes

Type theory (Thorsten Altenkirch)

Functions

Unlike in set theory, functions in type theory are by definition computable.

open import Data.Nat

f :
@damienstanton
damienstanton / .zshrc
Last active March 28, 2025 17:59
ZSH Profile 2025
# ╔════╗
# ║ DS ║
# ╚════╝
# version: 2025.02
# section: config
eval "$(/opt/homebrew/bin/brew shellenv)"
COMPLETION_WAITING_DOTS="true"
KEYTIMEOUT=1
plugins=(git
@damienstanton
damienstanton / virtual_threads.clj
Created June 20, 2023 12:38 — forked from mikeananev/virtual_threads.clj
Java 19 virtual threads and Clojure
(ns user
(:import (java.util.concurrent Executors)))
;; Thread factory for virtual threads
(defn thread-factory [name]
(-> (Thread/ofVirtual)
(.name name 0)
(.factory)))
;; Define an executor which just produce a new virtual thread for every task
@damienstanton
damienstanton / typed.go
Created February 24, 2023 23:45
Typed DSL in Go (Aram Hăvărneanu)
// This file implements a deep embedding of a typed-DSL in Go. The
// representation is type-safe (we cannot construct ill-typed terms)
// and accepts multiple interpretations. The type system of the target
// language is identity-mapped to the Go type system such that type
// checking of the DSL is hoisted up to type-checking the Go code that
// contains the target language expression.
//
// Normally this requires either GADTs or higher-rank types. I show
// that it is possible to encode it in Go, a language which doesn't
// have GADTs (nor regular ADTs for that matter), nor higher-rank
@damienstanton
damienstanton / coc-settings.json
Last active March 7, 2025 21:12
dot2 exports
{
"diagnostic.virtualText": true,
"diagnostic.errorSign": "💣",
"diagnostic.warningSign": "🚧 ",
"diagnostic.infoSign": "📘 ",
"diagnostic.hintSign": "🔎 ",
"python.linting.mypyEnabled": true,
"haskell.liquidOn": true,
"languageserver": {
"go": {
@damienstanton
damienstanton / lambda.log
Last active April 27, 2022 13:55
Lambda as JS by Glen Lebec (test outputs)
I := λx.x
✅ I tweet = tweet
✅ I chirp = chirp
✅ I I = I
Idiot := I
Mockingbird := M := ω := λf.ff
@damienstanton
damienstanton / dependent_types.md
Last active December 6, 2022 23:37
Dependent Types
// Either is an example of a sum type.
enum Either<Left, Right>
{
    Ok(Right),
    Err(Left)
}

// Point is an example of a product type.
type Point = (i64, i64, String);
@damienstanton
damienstanton / cubical.agda
Last active February 15, 2022 16:42
Cubical Type Theory (CTT)
{--
Some informal notes on the talk Cubical Agda: A Dependently Typed Programming
Language with Univalence and Higher Inductive Types by Andrea Vezzosi.
Link: https://youtu.be/AZ8wMIar-_c
--}
--- Equality in dependently typed languages like Agda is defined as an inductive
--- family:
data _≡_ {A : Set} (x : A) : A → Set where
@damienstanton
damienstanton / thoughts.md
Created February 9, 2022 20:58 — forked from tazjin/thoughts.md
Nix builder for Kubernetes