Skip to content

Instantly share code, notes, and snippets.

View twanvl's full-sized avatar

Twan van Laarhoven twanvl

View GitHub Profile
@twanvl
twanvl / gist:3873221
Created October 11, 2012 15:28
MonadTrans with explicit dictionaries
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE ConstraintKinds, GADTs #-}
{-# LANGUAGE FlexibleContexts #-}
import GHC.Exts
-- see http://www.reddit.com/r/haskell/comments/117r1p/whats_wrong_with_ghc_haskells_current_constraint/
data Dict :: Constraint -> * where
Dict :: c => Dict c
@twanvl
twanvl / gist:2938456
Created June 15, 2012 20:02
Applicative Concurrent computation without unnecessary threads
{-# LANGUAGE ImplicitParams #-}
import Control.Monad
import Control.Monad.Fix
import Control.Applicative
import Control.Concurrent
import Control.Concurrent.MVar
import Control.Exception
import Prelude hiding (catch)
import Data.IORef
import Data.Traversable