Skip to content

Instantly share code, notes, and snippets.

Robert Hensing roberth

View GitHub Profile
roberth /
Created October 19, 2022 12:44
ACES Protocol (draft)

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 / minimod.nix
Last active June 26, 2024 08:27
Simple and quick module system alternative + thoughts and tasks
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 / QueryPart.hs
Created April 16, 2022 18:57
hasql QueryPart
{-# 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
roberth / Partitioner.hs
Last active October 3, 2021 09:57
Ugly Folds
{-# 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 /
Created June 1, 2021 08:50
Why no 👎 reaction?

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 / Ghost.hs
Created November 11, 2019 14:53
Ghost prototype
{-# 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 < idea>,
roberth / example.nix
Created June 21, 2019 09:26
concurrent, event sourced, side effecting Nix via bash
{ io, args, ... }:
main =
io.printLine "I'm hi, who are you?" ask;
ask =
io.readLine (name:
roberth / service-private-nix-daemon.nix
Created May 22, 2019 09:38
arion draft private nix store daemon service
# Import this module from an arion service to enable the nix daemon.
{ pkgs, lib, ... }:
# 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, ...}: {
roberth / gist:9699dacf4286afb73f60a792e6ce64c3
Created April 10, 2019 13:03
Rebase with formatting change
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 / Gate.hs
Created November 26, 2018 17:55
Idea for stopping work gracefully
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