Skip to content

Instantly share code, notes, and snippets.

View smunix's full-sized avatar

Providence Salumu smunix

View GitHub Profile
@smunix
smunix / typing.md
Created October 18, 2015 16:41 — forked from chrisdone/typing.md
Typing Haskell in Haskell

Typing Haskell in Haskell

MARK P. JONES

Pacific Software Research Center

Department of Computer Science and Engineering

Oregon Graduate Institute of Science and Technology

With scoped effects, handlers must be a part of the program

It is seductive to imagine that effect handlers in an algebraic effect system are not part of the program itself but metalanguage-level folds over the program tree. And in traditional free-like formulations, this is in fact the case. The Eff monad represents the program tree, which has only two cases:

data Eff effs a where
  Pure :: a -> Eff effs a
  Op :: Op effs a -> (a -> Eff effs b) -> Eff effs b

data Op effs a where
@smunix
smunix / DCPU-16Spec.txt
Created February 21, 2021 16:50 — forked from metaphox/DCPU-16Spec.txt
DCPU-16 Specification
DCPU-16 Specification
Copyright 1985 Mojang
Version 1.7
=== SUMMARY ====================================================================
* 16 bit words
* 0x10000 words of ram
@smunix
smunix / fldr.hs
Last active April 9, 2021 10:24
Playing with endomorphisms and monoids
newtype Fn a = Fn {unFn :: a -> a}
instance Semigroup (Fn a) where
(<>) (Fn a) (Fn b) = Fn (b . a)
import Control.Monad
import Data.Foldable (fold)
import Data.Monoid (appEndo)
import Hedgehog
image: nixpkgs/cachix-flakes:nixos-20.03
build:
before_script:
- mkdir -p /etc/nix
- echo "experimental-features = nix-command flakes ca-references recursive-nix" >> /etc/nix/nix.conf
- cachix use numtide
- nix path-info --all > /tmp/store-path-pre-build
script:
- nix flake check
@smunix
smunix / v4l2.nix
Created September 3, 2021 00:10 — forked from TheSirC/v4l2.nix
My Nix module to work with v4l2loopback
{ lib, config, pkgs, ... }:
with lib;
{
options.v4l2 = mkEnableOption "Enable the confguration to use the reflex as a webcam";
config = mkIf config.v4l2 {
# 20.03: v4l2loopback 0.12.5 is required for kernel >= 5.5
# https://github.com/umlaeute/v4l2loopback/issues/257
@smunix
smunix / BinaryTree.hs
Last active September 3, 2021 00:17
BinaryTree
import Data.Function ( fix )
import Optics
{- Given a binary tree, produce the sums of all
the paths from the root to each of the leaves.
NeoVim with HLS (Haskell Language Server)
$> ghcid -W -a -c 'cabal repl lib:graph-mach-core'
@smunix
smunix / Arithmetic.Expr.hs
Last active October 31, 2021 02:31
Arithmetic Expressions
{-# LANGUAGE GADTs #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
-- |
module Arithmetic.Expr where
import Data.Char (chr)
import GHC.Real (RealFrac (truncate))
@smunix
smunix / README
Created March 19, 2022 06:15 — forked from jmatsushita/README
Setup nix, nix-darwin and home-manager from scratch on an M1 Macbook Pro
# I found some good resources but they seem to do a bit too much (maybe from a time when there were more bugs).
# So here's a minimal Gist which worked for me as an install on a new M1 Pro.
# Inspired by https://github.com/malob/nixpkgs I highly recommend looking at malob's repo for a more thorough configuration
#
# Let's get started
#
# Let's install nix (at the time of writing this is version 2.5.1
curl -L https://nixos.org/nix/install | sh
# I might not have needed to, but I rebooted