Skip to content

Instantly share code, notes, and snippets.

1 patch for repository http://code.haskell.org/cpphs:
patch 38e413b90da67cc984b4d6873a9d1f5047df2afc
Author: jmitchell@member.fsf.org
Date: Sat Feb 18 00:23:36 Coordinated Universal Time 2017
* Windows path support
New patches:
[Windows path support

Keybase proof

I hereby claim:

  • I am jmitchell on github.
  • I am jmitchell (https://keybase.io/jmitchell) on keybase.
  • I have a public key whose fingerprint is A969 0865 30E3 CC01 BF2A 819C 503E 6BF1 7E66 8311

To claim this, I am signing this object:

@jmitchell
jmitchell / Makefile
Last active September 11, 2017 05:09
Call C from x86-64 assembly
main: main.o hello.o
gcc -o main main.o hello.o
main.o: main.asm
nasm -felf64 -o main.o main.asm
hello.o: hello.c
gcc -c -o hello.o hello.c
.PHONY: clean
@jmitchell
jmitchell / SetMap.idr
Created September 16, 2017 21:16
Key-value mapping in Idris where set of keys that have values is encoded in the type
import Data.List
data SetMap : List k -> Type -> Type where
Empty : SetMap [] _
Insert : DecEq k =>
(key : k) ->
v ->
SetMap keys v ->
{auto prf : isElem key keys = No _} ->
SetMap (key :: keys) v

Keybase proof

I hereby claim:

  • I am jmitchell on github.
  • I am jmitchell (https://keybase.io/jmitchell) on keybase.
  • I have a public key whose fingerprint is 51EC DFAF 4AA3 1F42 A647 B8E3 E5A4 0FFC 0760 68CC

To claim this, I am signing this object:

@jmitchell
jmitchell / Classy.hs
Last active December 27, 2017 00:29
Next Level MTL
-- TH expansions of `makeClassy` and `makeClassyPrisms`
data DbConfig = DbConfig
{ _dbConn :: DbConnection
, _dbSchema :: Schema
}
makeClassy ''DbConfig
{-
class HasDbConfig t where
@jmitchell
jmitchell / ipfs-test.sh
Created January 1, 2018 00:06
Test IPFS read-what-you-write latency by adding a new uuid to the network and timing how long it takes to read it
#!/usr/bin/env bash
hash=`uuidgen -r | ipfs add -q`
url="https://ipfs.io/ipfs/$hash"
time curl "$url"
echo $url
@jmitchell
jmitchell / Chess.dhall
Last active April 4, 2018 21:04
WIP: Chess in Dhall
let List/replicate = https://ipfs.io/ipfs/QmQ8w5PLcsNz56dMvRtq54vbuPe9cNnCCUXAQp6xLc6Ccx/Prelude/List/replicate in
let File = Natural in
let Rank = Natural in
let Square = { file : File, rank : Rank } in
let Move = { from : Square, to : Square } in
let Side = < white : {} | black : {} > in
let white = < white = {=} | black : {} > in
let black = < black = {=} | white : {} > in
@jmitchell
jmitchell / TestFrameworkDemo.hs
Last active June 9, 2018 22:55
Avoid function argument ordering bugs by using the type system
{-
At the recent Seattle Haskell Learners' Group we touched on a common
programming bug, namely when a programmer mistakenly passes arguments
to a function in the wrong order. Let's consider an example of this
bug and ways to avoid it in Haskell.
Automated tests frequently need a mechanism to say, "the actual
computed value should equal some expected value." When the two values
differ the test framework should produce a useful message like,
Hi Matt