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 RankNTypes #-} | |
-- | Laws: | |
-- | |
-- > car (ChurchTuple a b) == a | |
-- > cdr (ChurchTuple a b) == b | |
newtype ChurchTuple a b = ChurchTuple { unChurchTuple :: forall c. ((a -> b -> c) -> c) } | |
churchTuple :: a -> b -> ChurchTuple a b | |
churchTuple a b = ChurchTuple $ \m -> m a b |
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
:set prompt ">>> " | |
import Control.Applicative | |
import Control.Monad | |
import Data.ByteString (ByteString) | |
import Data.HashMap.Strict (HashMap) | |
import Data.Map (Map) | |
import Data.Set (Set) | |
import Data.Text (Text) | |
import qualified Data.ByteString as B |
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
sudo rm -rf /Library/Frameworks/GHC.framework | |
sudo rm -rf /Library/Frameworks/HaskellPlatform.framework | |
sudo rm -rf /Library/Haskell | |
rm -rf .cabal | |
rm -rf .ghc | |
rm -rf ~/Library/Haskell | |
find /usr/bin /usr/local/bin -type l | \ | |
xargs -If sh -c '/bin/echo -n f /; readlink f' | \ | |
egrep '//Library/(Haskell|Frameworks/(GHC|HaskellPlatform).framework)' | \ | |
cut -f 1 -d ' ' > /tmp/hs-bin-links |
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
;; Keybonds | |
(global-set-key [(hyper a)] 'mark-whole-buffer) | |
(global-set-key [(hyper v)] 'yank) | |
(global-set-key [(hyper c)] 'kill-ring-save) | |
(global-set-key [(hyper s)] 'save-buffer) | |
(global-set-key [(hyper l)] 'goto-line) | |
(global-set-key [(hyper w)] | |
(lambda () (interactive) (delete-window))) | |
(global-set-key [(hyper z)] 'undo) |
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
{-# OPTIONS -Wall -fwarn-tabs -fno-warn-type-defaults #-} | |
-- The basic definition of the parsing monad. | |
module Parser (Parser, | |
get, | |
choose, | |
(<|>), | |
satisfy, | |
doParse, |
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
# Thanks to this post: | |
# http://blog.ikato.com/post/15675823000/how-to-install-consolas-font-on-mac-os-x | |
$ brew install cabextract | |
$ cd ~/Downloads | |
$ mkdir consolas | |
$ cd consolas | |
$ curl -O http://download.microsoft.com/download/f/5/a/f5a3df76-d856-4a61-a6bd-722f52a5be26/PowerPointViewer.exe | |
$ cabextract PowerPointViewer.exe | |
$ cabextract ppviewer.cab |
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
{-# OPTIONS -Wall -Werror -fwarn-tabs -fno-warn-type-defaults #-} | |
module Zip where | |
newtype Zip a = Z ([a], [a]) deriving Show | |
mkZip :: [a] -> Zip a | |
mkZip l = Z ([], l) | |
current :: Zip a -> a |
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
#!/usr/bin/env python | |
import argparse | |
import copy | |
import math | |
import pickle | |
import random | |
from itertools import combinations | |