Skip to content

Instantly share code, notes, and snippets.

@esmolanka
esmolanka / customizations.el
Last active July 15, 2020 15:41
Org-export
(...
'(org-export-backends (quote (ascii html)))
'(org-html-checkbox-type (quote html))
'(org-html-head-extra
"<style type=\"text/css\">
:root {--serif-font: serif; --sans-serif-font: sans-serif; --monospace-font: monospace; }
body { margin:40px auto; max-width:700px; line-height:1.6; font-size:18px; color:#444; padding:0 10px; }
h1 { font-family: var(--serif-font); }
h2,h3,h4,h5 { font-family: var(--sans-serif-font); }
.section-number-2,.section-number-3,.section-number-4,.section-number-5 { margin-right: 0.5em; }
use std::fmt::Debug;
#[derive(Debug)]
pub enum EPrim<'a> {
Id,
Lit(f64),
Vec(&'a Vec<f64>),
Add,
Mul,
Sub,
@esmolanka
esmolanka / Records2.hs
Created December 6, 2018 12:05
Serialisable typed records experiment
{-# OPTIONS_GHC -Wall #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
@esmolanka
esmolanka / Example.idr
Last active August 30, 2018 08:00
Array-Oriented Programming
import Data.Fin
import Data.Vect
import Vec
dotprod : Array [S n] Integer -> Array [S n] Integer -> Array [] Integer
dotprod x y = reduce (binop (+)) (apply_binary (lift $ binop (*)) x y)
map : (Array dim a -> Array dim' b) -> Array (n :: dim) a -> Array (n :: dim') b
map f xs = apply_unary (lift (Sc f)) xs
@esmolanka
esmolanka / natMaybeEq.ctt
Created October 22, 2017 21:50
nat = fix maybe
import prelude
import equiv
data nat
= zero
| suc (n : nat)
data fix (f : U -> U) = mk (x : f (fix f))
data maybe (A : U)
@esmolanka
esmolanka / hackage-docs.sh
Created January 19, 2016 00:26
Upload docs to Hackage. Compatible with stack and MacOS (--disable-copyfile)
#!/bin/bash
set -e
# This is a MacOS compiant fork of https://github.com/phadej/binary-orphans/blob/master/hackage-docs.sh,
# which is a stack-enabled fork of https://github.com/ekmett/lens/blob/master/scripts/hackage-docs.sh
# :-)
if [ "$#" -ne 1 ]; then
echo "Usage: scripts/hackage-docs.sh HACKAGE_USER"
exit 1