Skip to content

Instantly share code, notes, and snippets.

@dtaskoff
dtaskoff / liquid-proof.hs
Last active August 27, 2019 13:11
A failed attempt at prooving that a ^ b * a ^ c = a ^ (b + c) with Liquid Haskell
{-@ LIQUID "--reflection" @-}
{-@ LIQUID "--no-adt" @-}
import Language.Haskell.Liquid.ProofCombinators
-- | Proof that a ^ b * a ^ c = a ^ (b + c)
--
-- a ^ b * a ^ c corresponds to (b -> a, c -> a)
-- a ^ (b + c) corresponds to Either b c -> a
@dtaskoff
dtaskoff / use-local-sh.sh
Last active December 19, 2018 09:56
A script used for modifying the ghc's scripts installed by stack, so that they use a local sh executable
stackargs=$@
shbin="$(which sh)"
if [ -z "$shbin" ] || [[ "$shbin" =~ "not found" ]]; then
echo "Couldn't find sh, exiting."
exit 1
else
echo "Found sh: $shbin"
fi
@dtaskoff
dtaskoff / bindist.md
Last active September 28, 2021 09:05
Build a non-gmp GHC bindist

install stack

CentOS-specific preparations:

yum install ncurses-devel gcc-c++
localedef -c -f UTF-8 -i en_US en_US.UTF-8
export LC_ALL=en_US.UTF-8

Building the binary distribution:

package main
import (
"fmt"
"sync"
"testing"
)
func numLogsAndNumMsgs(numLogs int, numMsgs int) chan chan string {
logs := make(chan chan string)
#include <cstdio>
#include <iostream>
#include <vector>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <queue>
struct word {
-- file: Direction.hs
module Direction where
data Direction = LeftTurn | RightTurn | Straight
deriving (Show, Eq)
type Point = (Double, Double)
type Vector = (Double, Double)
// quicksort implementation
#include <vector>
int partition(std::vector<int>& v, int start, int end) {
int pivot = v[end];
int current = start;
for (int i = start; i < end; ++i) {
# a script that installs some needed software:
# python3.4, git, sublime and vim
# write sh install.sh to run the script
# -------------------------------------------
if sudo apt-get install zlib1g-dev libssl-dev
then
echo "-------------------------------------"
echo "libs for pip3 successfully installed!"
echo "-------------------------------------"