Skip to content

Instantly share code, notes, and snippets.

@dmjio
dmjio / rbt.hs
Created October 9, 2022 19:18 — forked from abiodun0/rbt.hs
Red black tree, Haskell
module RedBlackTree
(
Tree,
empty,
member,
insert)
where
data Color = R | B deriving Show
@dmjio
dmjio / Foo.hs
Created May 10, 2020 02:57 — forked from Lysxia/Foo.hs
{-# LANGUAGE
DeriveGeneric,
FlexibleInstances,
FlexibleContexts,
AllowAmbiguousTypes,
ScopedTypeVariables,
TypeApplications,
TypeFamilies,
TypeOperators,
PartialTypeSignatures,
@dmjio
dmjio / default.nix
Created April 12, 2017 04:05 — forked from adnelson/default.nix
Nix release builder
# Function which takes a list of packages to install and creates a
# tarball which contains the full list of dependencies of those paths,
# and a script which will install them.
#
# For example, here's how you would create a tarball packaging up
# python3 and nodejs:
#
#
# let
# pkgs = import <nixpkgs> {};
{ pkgs ? import <nixpkgs> {}}:
let
texpkgs = pkgs.texlive.combine {
inherit (pkgs.texlive) scheme-small latexmk;
};
in
pkgs.stdenv.mkDerivation {
name = "mbd";
{ pkgs ? import <nixpkgs> {}}:
let
texpkgs = pkgs.texlive.combine {
inherit (pkgs.texlive) scheme-small latexmk;
};
in
pkgs.stdenv.mkDerivation {
name = "mbd";
@dmjio
dmjio / 0_reuse_code.js
Created March 19, 2017 10:10
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
{ runCommand, fetchzip, cabal2nix }:
let
package-src = runCommand "package-src" {
src = fetchzip {
url = "...zip";
sha256 = "...";
};
buildInputs = [ cabal2nix ];
}
''
@dmjio
dmjio / Constraints.org
Created August 20, 2016 15:52 — forked from Icelandjack/Constraints.org
Type Classes and Constraints

Type classes are a language of their own, this is an attempt to document some features.

Work in progress.

Accept values with varying number of arguments

Common technique used in EDSLs (embedded domain-specific languages) to accept functions with varying number of arguments.

(Hackage) QuickCheck

quickCheck :: Testable prop => prop -> IO ()
@dmjio
dmjio / Nub.hs
Created February 7, 2016 16:51 — forked from roelvandijk/Nub.hs
Incredibly slow type-level Nub
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
module Nub where
import Data.Proxy
import Data.Type.Bool
@dmjio
dmjio / configuration.nix
Last active April 17, 2017 01:55 — forked from DamienCassou/configuration.nix
configuration.nix file for NixOS on my macbook pro
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
time.timeZone = "America/Chicago";