Skip to content

Instantly share code, notes, and snippets.

Robert Hensing roberth

View GitHub Profile
@roberth
roberth / ACES-Protocol.md
Created Oct 19, 2022
ACES Protocol (draft)
View ACES-Protocol.md

NOTE: this is a draft

TODO comments are in the source

This spec must be validated by implementing it in at least one library. I may do this in Haskell's optparse-applicative.


@roberth
roberth / minimod.nix
Last active Jan 26, 2023
Simple and quick module system alternative + thoughts and tasks
View minimod.nix
/*
minimod: A stripped down module system
TODO Comparison:
- [ ] Come up with a benchmark "logic" using plain old functions and let bindings
- [ ] Write the benchmark for the module system
- [ ] Write the benchmark for POP?
- [ ] Qualitative comparison of extensibility in the context of composable
Nixpkgs packaging logic
TODO Fine-tuning:
@roberth
roberth / QueryPart.hs
Created Apr 16, 2022
hasql QueryPart
View QueryPart.hs
{-# LANGUAGE GADTs #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Hasql.Extras.QueryPart where
import Data.Functor.Compose
import Data.String (IsString (..))
import qualified Hasql.Decoders as HD
import qualified Hasql.Encoders as HE
import qualified Hasql.Statement as HQ
View Partitioner.hs
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE StandaloneDeriving #-}
-- | This is a strict, somewhat efficient implementation of something between 'Data.List.partition' and Beautiful Folding.
--
-- It allows a (pure or ST) stream of values to be processed into multiple fields, using a nice 'Applicative' interface.
@roberth
roberth / README.md
Created Jun 1, 2021
Why no 👎 reaction?
View README.md

Why no 👎 reaction?

The main problem with the 👎 reaction is that it does not carry any constructive feedback or explanation.

In some cases, it is added to a pull request early on, before the author has had a chance to improve their proposal. The person placing the reaction often will not receive a notification of the improvements and even if they did, they may forget to remove the 👎.

These effects are not obvious to the author or the person reacting; let alone to the reader. This causes friction for everyone involved.

But I don't want to add noise!

@roberth
roberth / Ghost.hs
Created Nov 11, 2019
Ghost prototype
View Ghost.hs
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE ExplicitNamespaces #-}
{-# LANGUAGE TypeOperators #-}
-- | An alternate implementation of the Ghosts of Departed Proofs <https://kataskeue.com/gdp.pdf idea>,
@roberth
roberth / example.nix
Created Jun 21, 2019
concurrent, event sourced, side effecting Nix via bash
View example.nix
#!./interpret.nix
{ io, args, ... }:
let
main =
io.printLine "I'm hi, who are you?" ask;
ask =
io.readLine (name:
@roberth
roberth / service-private-nix-daemon.nix
Created May 22, 2019
arion draft private nix store daemon service
View service-private-nix-daemon.nix
# Import this module from an arion service to enable the nix daemon.
{ pkgs, lib, ... }:
{
# ENABLING THIS WILL MOST LIKELY DAMAGE THE HOST.
# You're probably looking for service.useHostNixDaemon instead of this module.
service.useHostStore = lib.mkForce false; # DID YOU READ THE COMMENT?
nixos.configuration = { pkgs, lib, ...}: {
View gist:9699dacf4286afb73f60a792e6ce64c3
git checkout feature-branch
git commit -m 'Buffer' --allow-empty
git rebase -i <origin/master or similar>
# uncomment buffer commit, reorder into
# pick Buffer
# <pick feature-branch commits>
git filter-branch --tree-filter './scripts/format-all' <origin/master or similar>..HEAD
# inspect the new Buffer commit and act accordingly
@roberth
roberth / Gate.hs
Created Nov 26, 2018
Idea for stopping work gracefully
View Gate.hs
module Control.Concurrent.Extras.Gate where
import Protolude
import Data.IORef
import Control.Concurrent.STM
import Data.UUID
import qualified Data.UUID.V4 as UUID
import qualified Data.Map as M
-- | State of a multi-task process to help with graceful termination