Skip to content

Instantly share code, notes, and snippets.

-- In type theory we can show that ℕ and Bool are not equal as follows
module N≠Bool where
open import Relation.Binary.PropositionalEquality
open import Data.Nat
open import Data.Bool
open import Data.Sum
open import Data.Empty
@soupi
soupi / kinds.hs
Last active July 17, 2024 14:04
Kind inference using unification-base constraint solving.
#!/usr/bin/env cabal
{- cabal:
build-depends: base, mtl, containers, uniplate
ghc-options: -Wall
-}
-- | An example of a kind inference for data types using
-- unification-based constraint solving.
--
-- See the blog post:
@AndrasKovacs
AndrasKovacs / ZeroCostGC.md
Last active November 17, 2025 09:30
Garbage collection with zero-cost at non-GC time

Garbage collection with zero cost at non-GC time

Every once in a while I investigate low-level backend options for PL-s, although so far I haven't actually written any such backend for my projects. Recently I've been looking at precise garbage collection in popular backends, and I've been (like on previous occasions) annoyed by limitations and compromises.

I was compelled to think about a system which accommodates precise relocating GC as much as possible. In one extreme configuration, described in this note, there

{-# LANGUAGE GADTs #-}
module Main where
import Control.Applicative (liftA2)
data Yaml
= String String
| Object [(String, Yaml)]
deriving Show
@noughtmare
noughtmare / rbinom.hs
Last active September 11, 2019 22:59
Haskell standalone rbinom
#!/usr/bin/env cabal
{- cabal:
build-depends: base, mwc-random
ghc-options: -with-rtsopts=-s -Wall
-}
{-
Copyright (C) 1998 Ross Ihaka
Copyright (C) 2000-2014 The R Core Team
Copyright (C) 2007 The R Foundation
@lambdageek
lambdageek / GistML.hs
Created November 15, 2014 16:47
The gist of ML modules
{-#
LANGUAGE
DeriveGeneric, DeriveDataTypeable,
MultiParamTypeClasses,
ViewPatterns
#-}
-- A short example of an ML-style module system atop a core lambda calculus.
--
-- The core expression language has variables, applications and
-- lambdas and constants. The type language has variables (of the single kind *)
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active December 11, 2025 14:31
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname