Skip to content

Instantly share code, notes, and snippets.

View evincarofautumn's full-sized avatar

Jon Purdy evincarofautumn

View GitHub Profile
@cwillmor
cwillmor / ells.pde
Created January 25, 2021 02:50
ells.pde (L-tiling clock in processing)
// ell clock https://twitter.com/cwillmore/status/1353435612636803073
// developed with processing 3.5.4 (processing.org)
// TODO:
// - motion blur
// - ripple update of ells - one only starts rotating when it has room to (<< ... <> ... >>)
static final int DEPTH = 3;
static final int N = 1 << (DEPTH + 1);
static final int FRAME_RATE = 30;
static final float DT = 1 / (float)FRAME_RATE;
@mstewartgallus
mstewartgallus / sequents.pro
Last active July 28, 2022 05:16
Sequent Calculus style stuff with Prolog. I could probably handle variables better in the future and also improve the DSL a bit. Different search strategies would probably be necessary in a full thing.
:- use_module(library(clpfd)).
:- use_module(library(dcg/basics)).
:- op(1150, xfy, user:(———————————————————————————————————)).
:- op(980, xfy, user:(~~>)).
:- op(980, xfy, user:(~>)).
:- op(980, xfy, user:(*~>)).
:- op(950, xfx, user:(⊨)).
@mstewartgallus
mstewartgallus / kappazetacps.hs
Last active January 6, 2021 02:41
A hacky CPS transformation of the kappa/zeta calculi. Not sure how to interpret it categorically
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE Strict #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE DataKinds #-}
import Prelude hiding (id, (.), fst, snd)
import Control.Category
-- Quantifiers are like a reflexive category (the untyped lambda calculus)
--
-- class Reflexive u where
@yangzhixuan
yangzhixuan / HiParser.hs
Created September 13, 2020 15:03
Higher order parser combinator langauge
{-# LANGUAGE GADTs, TypeFamilies, DataKinds, TypeOperators, RankNTypes, PolyKinds #-}
module HiParser where
import Control.Monad.Trans.State.Lazy
import GHC.Types
-- All types of the parser language:
-- BaseTy: every Haskell type is a base type of the parser language
-- Arrow: function types of the parser language
data Tys = BaseTy GHC.Types.Type | Arrow Tys Tys
@boris-stepanov
boris-stepanov / Setup.hs
Created September 10, 2019 20:21
Setup.hs with Thrift support
{-# LANGUAGE NoImplicitPrelude #-}
--{-# LANGUAGE TupleSections #-}
{-# OPTIONS_GHC -Wall -Wcompat -Wincomplete-uni-patterns -Wincomplete-record-updates -Wmissing-exported-signatures -Wmissing-home-modules -Widentities -Wredundant-constraints #-}
module Main where
import Distribution.Simple
import Distribution.Simple.Glob
import Distribution.Simple.Setup
--import Distribution.Simple.PreProcess
@sjoerdvisscher
sjoerdvisscher / equipment.hs
Last active May 23, 2020 14:51
Proarrow equipment in Hask
{-# LANGUAGE
GADTs
, DataKinds
, PolyKinds
, RankNTypes
, TypeOperators
, KindSignatures
, TypeApplications
, FlexibleContexts
, FlexibleInstances
@andrewthad
andrewthad / strictness_in_kinds.md
Created June 14, 2019 14:47
Strictness in Kinds

Strictness in Kinds

Let's tweak GHC's RuntimeRep stuff to try adding information about strictness. This information could be helpful for avoiding evaluating thunks that are guaranteed to already be evaluated. Presently, RuntimeRep is defined as:

data RuntimeRep

= LiftedRep

@glaebhoerl
glaebhoerl / UTLC++.hs
Created May 22, 2019 20:23
UTLC++/Generic
-- see also previous gist https://gist.github.com/glaebhoerl/466267f0c977cef74202f167d6493cc0 and tweets https://twitter.com/glaebhoerl/status/1129851506067427329
-- here we accomplish the same thing but in a totally different way, by relying on the host language for basically everything
{-# LANGUAGE LambdaCase, GADTs, TypeOperators, DataKinds, PolyKinds, Strict, DeriveFunctor, RankNTypes, TypeFamilies, ConstraintKinds #-}
import Prelude hiding (product, sum)
import Data.Type.Equality
import GHC.Exts (Constraint)
{-# LANGUAGE LambdaCase, OverloadedStrings #-}
import Data.String
type Name = String
data Expr
= V Name
| Lam Name Expr
| Either Bool Expr -- "False = Left, True = Right"