First, let's roll our own state monad. We'll treat assignments just as sequences of individuals.
{-# LANGUAGE TupleSections #-}
import Data.Bifunctor (first)
import Control.Applicative (liftA2)
type E = Int
#!/usr/bin/env bash | |
set -Eeuxo pipefail | |
type git >/dev/null 2>&1 || { echo >&2 "I require git but it's not installed. Aborting."; exit 1; } | |
type nix >/dev/null 2>&1 || { echo >&2 "I require nix but it's not installed. Aborting."; exit 1; } | |
type niv >/dev/null 2>&1 || { echo >&2 "I require niv but it's not installed. Aborting."; exit 1; } | |
type direnv >/dev/null 2>&1 || { echo >&2 "I require direnv but it's not installed. Aborting."; exit 1; } | |
type lorri >/dev/null 2>&1 || { echo >&2 "I require lorri but it's not installed. Aborting."; exit 1; } | |
git init # initialize git repository |
First, let's roll our own state monad. We'll treat assignments just as sequences of individuals.
{-# LANGUAGE TupleSections #-}
import Data.Bifunctor (first)
import Control.Applicative (liftA2)
type E = Int
{-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
type E = Int | |
type G = [Int] | |
newtype W = W Int deriving (Integral,Real,Enum,Num,Ord,Eq,Show) | |
type T = Bool |
{-# LANGUAGE NoMonomorphismRestriction #-} | |
{-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
{-# LANGUAGE ParallelListComp #-} | |
{-# LANGUAGE OverloadedLists #-} | |
module Data.Logic.Final where | |
import Control.Applicative ( Applicative(liftA2) ) | |
import Control.Monad ( replicateM ) | |
import Data.Biapplicative ( (<<*>>) |
\RequirePackage{microtype} | |
\RequirePackage{fontspec} | |
\defaultfontfeatures{Scale=MatchLowercase} | |
\setmainfont[% | |
UprightFeatures={ | |
SizeFeatures={ | |
{Size={-8.4},Font=MinionPro-Capt}, | |
{Size={8.4-13},Font=MinionPro-Regular}, | |
{Size={13-19.9},Font=MinionPro-Subh}, |
(defun patrl/org-latex-special-block (special-block contents info) | |
"Transcode a SPECIAL-BLOCK element from Org to LaTeX. | |
CONTENTS holds the contents of the block. INFO is a plist | |
holding contextual information." | |
(let ((type (org-element-property :type special-block)) | |
(opt (org-export-read-attribute :attr_latex special-block :options)) | |
(caption (org-latex--caption/label-string special-block info)) | |
(caption-above-p (org-latex--caption-above-p special-block info))) | |
(if | |
(equal (format "%s" type) "exe") |
#!/bin/sh | |
# exit as soon as any line in the script fails, print each command that's going to be executed | |
set -ex | |
# wipe disk | |
sgdisk --zap-all ${DISK} | |
# create GPT partition table | |
parted ${DISK} -- mklabel gpt |
computeQ :: TileMap -> Transform -> Slope -> Slope -> Int -> Visible () | |
computeQ m t s e y = do | |
let xmin = roundTiesUp (fromIntegral y * s) -- compute the initial x coordinate bounded by the starting slope | |
let xmax = roundTiesDown (fromIntegral y * e) -- compute the ending x coordinate bounded by the ending slope | |
let xys = (coord . (,y)) <$> [xmin..xmax] -- create a list of coordinates to recurse through by pairing xs with the depth | |
-- a helper function to recurse through a list of coordinates, and potentially create branching row computations | |
-- the first argument is a Maybe Bool which tracks whether the previous coordinate was a wall | |
-- Nothing indicates that there was no previous coordinate (we're at the beginning of the list) | |
-- s indicates the starting slope; this can change as the recursion proceeds. |
{-# LANGUAGE TemplateHaskell #-} | |
-- Xp format specification: https://steveasleep.com/rexpaint_manual.html#appendix-b:-.xp-format-specification-(and-import-libraries) | |
module Data.Xp where | |
import Data.Colour.RGBSpace | |
import qualified Codec.Compression.GZip as GZip | |
import qualified Data.ByteString.Lazy as BL | |
import Data.Binary.Get |
data PropL = PVar String | PNot PropL | PropL `PAnd` PropL | PropL `POr` PropL deriving Eq | |
instance Show PropL where | |
show (PVar s) = s | |
show (PNot p) = "~" ++ show p | |
show (p `PAnd` q) = "(" ++ show p ++ " & " ++ show q ++ ")" | |
show (p `POr` q) = "(" ++ show p ++ " | " ++ show q ++ ")" | |
-- recursive de Morgan's |