Skip to content

Instantly share code, notes, and snippets.


Mark Godfrey msgodf

View GitHub Profile
CMCDragonkai /
Last active Dec 8, 2021
Rust/Haskell: Higher-Kinded Types (HKT)

Rust/Haskell: Higher-Kinded Types (HKT)

A higher kinded type is a concept that reifies a type constructor as an actual type.

A type constructor can be thought of in these analogies:

  • like a function in the type universe
  • as a type with a "hole" in it
ohanhi /
Last active Nov 6, 2021
Learning FP the hard way: Experiences on the Elm language

Learning FP the hard way: Experiences on the Elm language

by Ossi Hanhinen, @ohanhi

with the support of Futurice 💚.

Licensed under CC BY 4.0.

Editorial note

14427 /
Last active Dec 8, 2021
Higher-kinded type trait
use std::rc::Rc;
trait HKT<U> {
type C; // Current type
type T; // Type with C swapped with U
macro_rules! derive_hkt {
($t:ident) => {
impl<T, U> HKT<U> for $t<T> {
paf31 /
Last active Apr 15, 2020
24 Days of PureScript

This blog post series has moved here.

You might also be interested in the 2016 version.

evancz /
Last active Mar 12, 2018
Imagine conversations and questions for a time when people say "union type" instead of "algebraic data type". Think about how the responses might work if you said "ADT" instead.

Union Types

If Elm community is going to begin referring to "union types" instead of "algebraic data types" we should think about how that will work in practice. What discussions will we have? Will we find ourselves in awkward spots trying to explain things?

The following question/answer pairs simulate things I'd expect to see in a world of "union types". The pairs are grouped by what background I expect the questions to come from so we know the subtext. I have also added some meta comments in italic to explain my phrasing.

One thing to consider is that a lot of learners will not have a person to ask, so the path to arriving at these answers needs to be easy if you are just searching online.

General Questions

View Elm Style

Elm Style Guide


The goal of the style guide is foremost to promote consistency and reuse of pattern from other languages in order to improve readability and make Elm easier for beginners. This includes moving Elm away from Haskell’s indentation style and even making some parts look closer to JavaScript. These decisions are intentional.

We would like Elm to look friendly and familiar to users of any language — especially JavaScript — so they can discover Elm’s powerful features without being overwhelmed. This does not intend to weaken or discourage any features of Elm, but instead to make them more accessible.

A secondary goal of the style guide is to encourage short diffs when changes are made. This makes changes more clear, and helps when multiple people are collaborating.


View unsound_records.clj
(ns clojure.core.typed.test.unsound-record
(:require [clojure.core.typed :as t]))
(t/ann-record Foo [a :- Number])
(defrecord Foo [a])
(t/ann unsound [(t/Map Any Any) -> Number])
(defn unsound [r]
(let [r (assoc r :a nil)]
(assert (instance? Foo r))
tnolet / gist:7361441
Last active Dec 5, 2018
Install collectd 5.4 on Centos 6.x and make it spit out cool metrics. Copied from and tweaked for your and my pleasure. For all other cool options, check the provided link.
View gist:7361441
# Perform installation as root
# Install prereqs
yum -y install libcurl libcurl-devel rrdtool rrdtool-devel rrdtool-prel libgcrypt-devel gcc make gcc-c++
# Get Collectd, untar it, make it and install
tar zxvf collectd-5.4.0.tar.gz
View everything-david-nolen-mentioned.markdown

Everything David Nolen Mentioned

When watching David Nolen's excellent Lambda Jam keynote on InfoQ, the references to interesting reading came a little too fast and furious for me to jot down, so I went through the slides and put this gist together.