Skip to content

Instantly share code, notes, and snippets.

View aristidb's full-sized avatar

Aristid Breitkreuz aristidb

  • Amsterdam, Netherlands
View GitHub Profile
{-# LANGUAGE RecordWildCards #-}
import Data.List
import Control.Monad
import Control.Arrow
import Debug.Trace
type Pos = [Int]
data Rules
= Rules {
import Data.Conduit
import Control.Monad.Trans.Resource
import Control.Monad
joinSource :: Resource m => Source m (Source m a) -> Source m a
joinSource s = Source $ do
ps <- genSource s
innerSources <- newRef []
let pull = do xs <- readRef innerSources
case xs of
@aristidb
aristidb / gist:1525471
Created December 27, 2011 23:35
Possible Monad instance for Source?
sourceJoin :: Resource m => Source m (Source m a) -> Source m a
sourceJoin s = Source $ do
ps <- prepareSource s
innerSource <- newRef Nothing
let pull = do inner <- readRef innerSource
case inner of
Just x -> do st <- sourcePull x
case st of
Closed -> do pullFrom Nothing
Open vs -> return $ Open vs
@aristidb
aristidb / SortedList.agda
Created January 26, 2012 18:26
Merge and sorted lists and agda
open import Relation.Binary
open import Relation.Binary.PropositionalEquality renaming (sym to psym ; trans to ptrans)
module SortedList
(A : Set)
(_≤_ : A -> A -> Set)
(isDecTotalOrder : IsDecTotalOrder _≡_ _≤_)
where
open import Data.Nat hiding (_≤_ ; _≤?_)
@aristidb
aristidb / OpTransVec.agda
Created February 5, 2012 15:42
Simple Operational Transformation in Agda
module OpTransVec where
open import Data.Vec
open import Data.Nat
open import Data.Product
open import Relation.Binary.PropositionalEquality
open import Function using (_∘_)
data Op (A : Set) : ℕ → ℕ → Set where
ε : Op A 0 0
@aristidb
aristidb / config.nix
Created March 30, 2012 20:36
ghcWithPackages problem
pkgs : {
packageOverrides = self : {
ghc741Packages = {
all = self.haskellPackages_ghc741.ghcWithPackages (Self : [
self.mtl
self.QuickCheck
self.haskellSrcExts
self.zlib
self.haskeline
self.xhtml
@aristidb
aristidb / MacBook Air.txt
Created May 25, 2012 22:31
openssl speed
OpenSSL 0.9.8r 8 Feb 2011
built on: Sep 16 2011
options:bn(64,64) md2(int) rc4(ptr,char) des(idx,cisc,16,int) aes(partial) blowfish(ptr2)
compiler: -arch x86_64 -fmessage-length=0 -pipe -Wno-trigraphs -fpascal-strings -fasm-blocks -O3 -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DL_ENDIAN -DMD32_REG_T=int -DOPENSSL_NO_IDEA -DOPENSSL_PIC -DOPENSSL_THREADS -DZLIB -mmacosx-version-min=10.6
available timing options: TIMEB USE_TOD HZ=100 [sysconf value]
timing function used: getrusage
The 'numbers' are in 1000s of bytes per second processed.
type 16 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes
md2 1738.06k 3586.42k 4852.47k 5265.94k 5527.42k
mdc2 9479.27k 10495.11k 10783.37k 10940.08k 10951.27k
; ELPA
(require 'package)
(package-initialize)
(add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/") t)
(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
(defvar preload-packages '())
(setq preload-packages
'(
auctex
{-# LANGUAGE DeriveFunctor #-}
module ZipStream where
import Control.Applicative
data ZipStream a = ZipStream {headZ :: a, tailZ :: ZipStream a}
deriving (Functor)
-- Just give a taste...
module Git where
import Data.ByteString
import Data.Time
import qualified Data.Map as M
-- | Objects that are stored in the git storage by SHA1. Just a dummy class in this demonstration.
class Storable a
newtype Object = Object { objectData :: ByteString }