This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main() { | |
let data_in = (0..1000).collect::<Vec<i32>>(); | |
let (_, mut data_in_slice) = data_in.split_at(0); | |
let mut data_out: Vec<i32> = Vec::with_capacity(data_in.len()); | |
unsafe { data_out.set_len(data_in.len()); } | |
let (_, mut data_out_slice) = data_out.split_at_mut(0); | |
let nthreads = 5; | |
let threads: Vec<_> = (0..nthreads).map(|i| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
data Tree a = Empty | Node a (Tree a) (Tree a) | |
tree :: Tree Int | |
tree = Node 4 (Node 2 (Node 1 Empty Empty) (Node 3 Empty Empty)) (Node 6 (Node 5 Empty Empty) (Node 7 Empty Empty)) | |
toList :: Tree a -> [a] | |
toList root = go root [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE TemplateHaskell | |
, RankNTypes | |
, ExistentialQuantification | |
, GADTs | |
, MultiParamTypeClasses | |
, TypeFamilies #-} | |
module Main where | |
import Control.Monad.State |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE ScopedTypeVariables, FlexibleContexts #-} | |
module Main where | |
import Control.Monad.Trans.Control | |
import Control.Exception | |
import Control.Monad.Trans.State | |
import Control.Monad.IO.Class |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main (main) where | |
import qualified Data.Vector.Unboxed.Mutable as VUM | |
import Control.Monad.State | |
import Control.Monad.Reader | |
import Control.Loop | |
main :: IO () | |
main = do | |
let w = 1024 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
newtype Label r m = Label { runLabel :: ContT r m () } | |
label :: ContT r m (Label r m) | |
label = callCC $ \k -> return $ let x = Label (k x) in x | |
goto :: Label r m -> ContT r m b | |
goto lbl = runLabel lbl >> goto lbl | |
usesGoto :: (Monad m) => ContT r m r -> m r | |
usesGoto = flip runContT return |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data Exp a where | |
Lit :: Int -> Exp Int | |
Add :: Exp Int -> Exp Int -> Exp Int | |
Mul :: Exp Int -> Exp Int -> Exp Int | |
Cmp :: Eq a => Exp a -> Exp a -> Exp Bool | |
If :: Exp Bool -> Exp a -> Exp a -> Exp a | |
deriving instance Show (Exp a) | |
eval :: Exp a -> a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ -d "/Volumes/Backup SD" ]; then | |
echo "rsync backup of .git to SD card..." | |
rsync $GIT_DIR --delete --times --recursive --checksum --compress --human-readable --stats /Volumes/Backup\ SD/ | |
else | |
echo "SD card 'Backup SD' not inserted, NOT doing the rsync backup" | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install a local copy of Hoogle (OS X 10.10, GHC 7.10.1) | |
# Download | |
cd | |
cabal unpack hoogle | |
cd hoogle-4.2.40/ | |
# Use a sandbox | |
cabal sandbox init |