Skip to content

Instantly share code, notes, and snippets.

View johnpmayer's full-sized avatar

John P Mayer, Jr johnpmayer

View GitHub Profile
@johnpmayer
johnpmayer / gist:5271503
Last active December 15, 2015 13:59
Algebraic Effects in Haskell
{-# OPTIONS -Wall #-}
{-# LANGUAGE GADTs, DataKinds, TemplateHaskell, KindSignatures,
MultiParamTypeClasses, RankNTypes, PolyKinds, FlexibleContexts,
TypeFamilies, UndecidableInstances, FlexibleInstances #-}
module Effects where
import Data.Singletons
@johnpmayer
johnpmayer / gist:5250857
Created March 27, 2013 01:34
Storable Byte-sized TypeReps for natural numbers using existentials
{-# OPTIONS -Wall #-}
{-# LANGUAGE GADTs, DataKinds, KindSignatures, RankNTypes,
FlexibleInstances, PolyKinds, ScopedTypeVariables #-}
module Utils where
import Data.Int
import Foreign.Ptr
import Foreign.Storable
@johnpmayer
johnpmayer / LL.hs
Created March 22, 2013 19:30
This is an implementation of a Linked List in the STM monad!
{-# OPTIONS -Wall #-}
module LL (empty, append, index, delete) where
import Control.Concurrent.STM
data Node a = Node a (LinkedList a)
type LinkedList a = TVar (Maybe (Node a))