Skip to content

Instantly share code, notes, and snippets.

View aaronang's full-sized avatar

Aaron Ang aaronang

View GitHub Profile
@kc1212
kc1212 / btree_test.hs
Created December 2, 2015 18:35
Testing b*tree in haskell
import Pipes
import qualified BTree as BT
import Control.Monad (unless, liftM)
import System.IO
-- probably don't need IO
listToProducer :: [BT.BLeaf String Int] -> Producer (BT.BLeaf String Int) IO ()
listToProducer [] = return ()
listToProducer a@(x:xs) =
unless (null a) $ do
@kc1212
kc1212 / statet_map_io.hs
Created November 11, 2015 14:12
Simulating key-value database using StateT
import Control.Monad.State
import qualified Data.Map as Map
type MyMap = Map.Map Int Char
runDB :: StateT MyMap IO ()
runDB = do
add 1 'a'
add 2 'b'
x <- find 1