Skip to content

Instantly share code, notes, and snippets.

Avatar
🌴
Digging holes and building things

Ben Siraphob siraben

🌴
Digging holes and building things
View GitHub Profile
@siraben
siraben / gpl-clarify-template.md
Last active Dec 31, 2020
License clarification template
View gpl-clarify-template.md

Clarifying GPL license variant with upstream packages

Title of the post:

Clarify GPL license variant

Could you clarify which GPL variant this software is packaged under? For more info, see this website.

Summary:

The Free Software Foundation urged developers to choose or any later version, since that meant users would be free to use that program under GNU GPL version 1, or under version 2 (once there was a version 2), or under version 3 (once there was a version 3). And they will be free to use it under version 4, if we ever have to make a version 4.

@siraben
siraben / default.nix
Last active Dec 30, 2020
rmView nix package
View default.nix
{ pkgs ? import <nixpkgs> {} }:
with pkgs;
qt5.callPackage ./rmview.nix { }
@siraben
siraben / tagless-final-concat.hs
Created Dec 19, 2020
Tagless final concatenative programming
View tagless-final-concat.hs
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE FlexibleInstances #-}
import Prelude (Bool,Show, (+))
import qualified Prelude as P
import Control.Arrow
import Control.Monad
import Control.Category
data s :. a = s :. a
@siraben
siraben / max_mountain.hs
Last active Dec 2, 2020
maximum mountain and derivation
View max_mountain.hs
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE BangPatterns #-}
-- nix-shell --pure -i ghci -p "haskellPackages.ghcWithPackages (h: [ h.QuickCheck ])"
import Data.List
import Control.Monad
-- https://leetcode.com/problems/longest-mountain-in-array/
data Dir = Up | Down | Flat deriving (Show)
View tree_tilt.hs
#! /usr/bin/env nix-shell
#! nix-shell --pure -i ghci -p "haskellPackages.ghcWithPackages (h: [ h.QuickCheck ])"
-- https://leetcode.com/problems/binary-tree-tilt/
import Test.QuickCheck
data Tree = Node Int Tree Tree | Leaf deriving (Show)
instance Arbitrary Tree where
@siraben
siraben / report.md
Created Nov 22, 2020
2020-11-22 report
View report.md

Evals report

Report built at 2020-11-22 08:27:35 UTC

Built for evals:


@siraben
siraben / stlc.hs
Created Oct 19, 2020
Lambda calculus with de Bruijn representation in tagless-final style
View stlc.hs
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE NoMonomorphismRestriction #-}
-- Tuesday, September 15, 2020 at 16:20
-- Lambda calculus with de Bruijn representation in tagless-final
-- style
-- Just so that we can write repr γ ⊢ a -> repr γ ⊢ b, etc.
infix 3
type a b = a b
@siraben
siraben / adjunctions.hs
Created Aug 31, 2020
Monads from adjunctions
View adjunctions.hs
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE FunctionalDependencies #-}
-- Composition of functors
newtype Compose g f a = Compose { getCompose :: g (f a) }
deriving Functor
@siraben
siraben / lc.rs
Last active Aug 20, 2020
Lambda calculus interpreter in Rust
View lc.rs
use std::rc::Rc;
// Environment-passing lambda calculus interpreter in Rust
#[derive(Debug, Clone, PartialEq)]
enum LC {
Var(String),
App(Box<LC>, Box<LC>),
Abs(String, Box<LC>),
Lit(u32),
Incr(Box<LC>),
}
@siraben
siraben / monoidal-functors.hs
Created Jun 2, 2020
Monoidal functors and applicatives
View monoidal-functors.hs
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE FlexibleInstances #-}
-- Tuesday, June 02, 2020
-- Monoidial functors and Applicatives
import Prelude hiding (Applicative(..), (**))
-- Lax monoidial functors
-- Laws:
-- Identity: unit ** x ~= x ** unit ~= unit
-- Associativity: u ** (v ** w) ~= (u ** v) ** w