Skip to content

Instantly share code, notes, and snippets.

@cartazio
cartazio / MesiMemory.agda
Last active June 17, 2016 16:13
state machine for mesi protocol
module MesiModel where
open import Data.Vec
open import Data.Fin
open import Data.Nat
open import Data.Product
data MesiState : Set where
Invalid : MesiState
@aaronlevin
aaronlevin / 01-shell.nix
Last active February 22, 2016 17:57
Local/Project-based Environment Management Using Nix (with new Haskell NG infrastructure)
# Inspired by:
# http://stackoverflow.com/questions/29033580/how-do-i-use-the-new-haskell-ng-infrastructure-on-nixos
#
# The goal
#
# 1. my-project.cabal remains the source of required libraries/packages to build the project.
# Adding a new library involves updating my-project.cabal and then running cabal2nix . > 02-my-project.nix
#
# 2. ability to add non-haskell build / dev dependencies to our `shell.nix` that are not used at runtime.
# For example, maybe we want to use postgresql or redis during development.
@imjasonh
imjasonh / markdown.css
Last active February 12, 2024 17:18
Render Markdown as unrendered Markdown (see http://jsbin.com/huwosomawo)
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}
@pchiusano
pchiusano / abt.hs
Last active November 18, 2020 05:42
Simple abstract binding trees implementation in Haskell
-- A port of: http://semantic-domain.blogspot.com/2015/03/abstract-binding-trees.html
{-# LANGUAGE DeriveFunctor #-}
module ABT where
import qualified Data.Foldable as Foldable
import Data.Foldable (Foldable)
import Data.Set (Set)
import qualified Data.Set as Set
@stuarthalloway
stuarthalloway / Nil Finder
Created January 15, 2015 20:51
Finding those nested nils
(ns user)
(def app
"Intenal Helper"
(fnil conj []))
(defprotocol PathSeq
(path-seq* [form path] "Helper for path-seq"))
(extend-protocol PathSeq

Tools

  • Cabal
    • Starting a new project
    • Sandboxes
      • Creating
      • Deleting
    • Adding dependencies
    • Installing dependencies
    • Adding one or more test suites
@dysinger
dysinger / idris
Last active August 29, 2015 13:56
HELP I'M NEW TO HASKELL AND CABAL IS KILLING ME!!!
# REMOVE ANYTHING CABAL HAS EVER DROPPED ONTO YOUR SYSTEM
rm -rf ~/.{ghc,cabal}
# UPDATE CABAL
cabal update
# UPGRADE CABAL TO 1.18 (BECAUSE THEY ADDED SANDBOXES)
cabal install cabal-install
export PATH=~/.cabal/bin:$PATH ;# PUT THIS IN YOUR PROFILE
@nz
nz / named pipe queues.sh
Created October 9, 2013 05:31
Nerd sniped by named pipes
#!/bin/sh
# clear old pipe and lock
rmdir worklock 2>/dev/null
rm work
if [[ ! -p work ]]; then
mkfifo work
else
dd if=work of=/dev/null
@c-spencer
c-spencer / core.clj
Last active December 23, 2015 02:49
Simple demo of type construction from Datomic with core.typed and a little glue
(defn create-type
"Extract a type from provided field idents stored in Datomic database at uri."
[uri type-name overrides]
(let [c (d/connect uri)
d (d/db c)
datomic-type-map {:db.type/string 'String
:db.type/ref 'Any}
mt (dt/q> :- [EntityID]
'[:find ?e
:in $ ?t-name
@hsjunnesson
hsjunnesson / log
Created September 5, 2013 21:28
Update: I've made a more thorough example of embedding Clojure logic in an iPhone app. Toes, a tic-tac-toe game in clojure on the iPhone. https://github.com/hsjunnesson/toes
2013-09-05 23:24:37.777 Prime[4204:c07] 1
2013-09-05 23:24:37.779 Prime[4204:c07] 0.732028842267092
2013-09-05 23:24:37.780 Prime[4204:c07] 0.2530017011838238
2013-09-05 23:24:37.781 Prime[4204:c07] 0.22892546997679017
2013-09-05 23:24:37.781 Prime[4204:c07] 0.5423003204364027
2013-09-05 23:24:37.782 Prime[4204:c07] 0.6065306597126334
2013-09-05 23:24:37.783 Prime[4204:c07] 0.44399788140114904
2013-09-05 23:24:37.783 Prime[4204:c07] 0.15345314921321815
2013-09-05 23:24:37.784 Prime[4204:c07] 0.13885046809469812
2013-09-05 23:24:37.784 Prime[4204:c07] 0.32892187595578626