Skip to content

Instantly share code, notes, and snippets.

@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 September 18, 2024 04:17
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 3, 2024 18:21
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname