This file contains 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
/** | |
* An example of lightweight (Green) application threads using the continuation monad, | |
* which gives us scalable non-blocking IO without nested callbacks. | |
* @author willtim | |
*/ | |
object GreenThreads { | |
// a thread (continuation) represents the rest of the computation | |
sealed abstract class Thread | |
case class Print(str: String, rest: Thread) extends Thread |
This file contains 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 Process where | |
import Control.Monad.Reader | |
import Control.Monad.Cont | |
-- | this is the infinite stream of steps from the Bot, each step takes an environment | |
-- and yields a command and the entire rest of the computation | |
type Process = Reader DashBoard Step | |
data Step = Step { stepCmd :: Command, stepNext :: Process } |
This file contains 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
import Prelude hiding ((.), id) | |
import Control.Wire | |
import Control.Arrow | |
import Data.Set (Set) | |
import Data.Monoid | |
import qualified Data.Set as S | |
import qualified Graphics.UI.SDL as SDL | |
import qualified Graphics.UI.SDL.Image as SDLi |
This file contains 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
import Control.Concurrent.MVar | |
import Control.Monad.Fix (mfix) | |
import qualified Data.Map as M | |
fix :: (t -> t) -> t | |
fix f = f (fix f) | |
fib :: (Eq a, Num a) => (a -> a) -> a -> a | |
fib _ 0 = 0 | |
fib _ 1 = 1 |
This file contains 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
import Control.Arrow (second) | |
import qualified Data.List as L | |
splitOn :: Eq a => [a] -> [a] -> [[a]] | |
splitOn sep = L.unfoldr f | |
where | |
f [] = Nothing | |
f xs = Just $ second (drop l) $ breakList (L.isPrefixOf sep) xs | |
l = length sep |
This file contains 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 NoMonomorphismRestriction #-} | |
import Control.Applicative | |
import Text.ParserCombinators.UU (pChainl) | |
import Text.ParserCombinators.UU.BasicInstances(pSym) | |
import Text.ParserCombinators.UU.Utils | |
-- | Huttons razor | |
data Exp = Add Exp Exp |
This file contains 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 NoMonomorphismRestriction #-} | |
import Control.Applicative | |
import Control.Monad.State | |
import Control.Monad.Writer | |
import Data.IntMap (IntMap) | |
import qualified Data.IntMap as IM | |
import Text.ParserCombinators.UU (pChainl) | |
import Text.ParserCombinators.UU.BasicInstances(pSym) | |
import Text.ParserCombinators.UU.Utils |
This file contains 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
\documentclass{beamer} | |
\usepackage{listings} | |
\usepackage{tikz} | |
\usetikzlibrary{fit,calc,shadows} | |
% Define styles for balloons and lines | |
\tikzstyle{line} = [draw, rounded corners=3pt, -latex] | |
\tikzstyle{balloon} = [draw, fill=blue!20, opacity=0.4, inner sep=4pt, rounded corners=2pt] |
This file contains 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
------------------------------------------------------------ | |
-- Hoodlums: Purely Functional Text Editing | |
-- | |
-- handleKey implementation for Prac1.hs | |
-- see https://personal.cis.strath.ac.uk/conor.mcbride/CS410/ | |
-- | |
-- Note: you will also need to change the "Here" data type to | |
-- accomodate a String payload | |
-- |
This file contains 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
# Tim Williams .tmux.conf | |
# Note: can query default bindings with tmux list-keys | |
# Hierarchy: | |
# Server | |
# ㄴSession | |
# ㄴWindow | |
# ㄴPane | |