A script that automatically separates a Haskell file diff into two diffs: one with only changes to comments, and one with changes to actual code.
Could be extended to other languages, as long as you can describe what the
{-# LANGUAGE LambdaCase #-} | |
{-# LANGUAGE EmptyCase #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE TypeInType #-} | |
module Pokemon where | |
import Data.Kind (Type) | |
import Data.Void (Void) | |
import Type.Reflection ((:~:)(..)) |
To write a zookeeper client, it is neccessary to understand
the protocol used to communicate with it. Unfortunately, this
protocol is not documented. In this example, we use tcpflow
to dump both the read and write channel of the TCP connection
that zkCli.sh
uses to connect with the zookeeper server.
{-# LANGUAGE StandaloneDeriving, FlexibleContexts, UndecidableInstances #-} | |
-- Laungh ghci with -fobject-code to make the Fix/Tree trick work (thanks edwardk). | |
-- courtesy of hpc on #haskell | |
import Unsafe.Coerce | |
import Control.Monad.ST | |
toInteger :: Int -> Integer | |
isJust :: Maybe a -> Bool | |
null :: [a] -> Bool |
#!/usr/bin/env bash | |
set -Eeuxo pipefail | |
# Set up git | |
git init | |
gitignore haskell | |
echo '*.cabal' >> .gitignore | |
# Set up niv | |
niv init |
# Installing | |
qemu-system-x86_64 -bios /usr/share/ovmf/ovmf_x64.bin -enable-kvm -cpu host -smp 4 -m 2048 -cdrom ~/Downloads/Win10_English_x64.iso -net nic,model=virtio -net user -drive file=~/vm/win10.hd.img.raw,format=raw,if=virtio -vga qxl -drive file=~/Downloads/virtio-win-0.1.105.iso,index=1,media=cdrom | |
# Running | |
qemu-system-x86_64 -bios /usr/share/ovmf/ovmf_x64.bin -enable-kvm -cpu host -smp 4 -m 4096 -net nic,model=virtio -net user -drive file=~/vm/win10.hd.img.raw,format=raw,if=virtio -vga qxl -usbdevice tablet -rtc base=utc |
import Numeric.Natural (Natural) | |
import qualified Data.Semigroup | |
-- | @fibonacci n@ computes the @nth@ fibonacci number efficiently using infinite | |
-- precision integer arithmetic | |
-- | |
-- Try @fibonacci 1000000@ | |
fibonacci :: Natural -> Natural | |
fibonacci n = x01 (Data.Semigroup.mtimesDefault n m) |