Skip to content

Instantly share code, notes, and snippets.

@Gabriella439
Gabriella439 / Setuph.s
Created December 27, 2021 18:38
Minimal reproduction for Cabal bug report
import Distribution.Simple
main = defaultMain
@Gabriella439
Gabriella439 / default.nix
Created January 7, 2022 16:14
Nix build of vscode with haskell-language-server
let
nixpkgs = builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/c473cc8714710179df205b153f4e9fa007107ff9.tar.gz";
sha256 = "0q7rnlp1djxc9ikj89c0ifzihl4wfvri3q1bvi75d2wrz844b4lq";
};
config = {
allowUnfree = true;
};
@Gabriella439
Gabriella439 / init.vim
Created January 9, 2022 16:26
First draft of init.vim for haskell-language-server
call plug#begin()
Plug 'neovim/nvim-lspconfig'
call plug#end()
lua << EOF
require('lspconfig').hls.setup({
settings = {
haskell = {
formattingProvider = 'stylish-haskell',
},
@Gabriella439
Gabriella439 / default.nix
Last active January 16, 2025 05:52
neovim + haskell-language-server setup
# nix-env --install --file ./default.nix
let
nixpkgs = builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/c473cc8714710179df205b153f4e9fa007107ff9.tar.gz";
sha256 = "0q7rnlp1djxc9ikj89c0ifzihl4wfvri3q1bvi75d2wrz844b4lq";
};
config = {
allowUnfree = true;
};
@Gabriella439
Gabriella439 / lfp.md
Last active March 18, 2022 17:39
Introduction for "Lightweight Functional Programming Specification"

Lightweight Functional Programming specification

The purpose of this document is to specify a baseline set of functional programming features that users can request and that programming languages can advertise support for. This feature set strives to be "JSON-like" and "purely functional".

The goals of this specification are (in descending order of importance):

  • Cultivate a portable functional programming style
@Gabriella439
Gabriella439 / lost-time.md
Created February 9, 2022 13:05
Making up for lost time

Making up for lost time

I'm writing this fresh after waking up from a nightmare that captures my insecurities related to transitioning later in life. I'll begin by sharing the dream followed by my interpretation.

The dream

Normally dreams can be tricky to interpret but in this case my dream left a pretty clear signpost to guide the interpretation: the nightmare begins right after explaining to someone that I'm trans.

In my nightmare I'm in middle school and I have to head back home, but I'm unable to take my normal bus home because I got back late from a field trip. On top of that I'm having to carry home more baggage than usual: In addition to my backpack I'm also carrying my cello and also someone else's duffel bag that they left behind at school.

@Gabriella439
Gabriella439 / shell.nix
Created February 10, 2022 16:27
nix-shell for GHC development
# This was only tested against revision ac2d18a7353cd3ac1ba4b5993f2776fe0c5eedc9
# of https://gitlab.haskell.org/ghc/ghc
let
nixpkgs = builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/7e003d7fb9eff8ecb84405360c75c716cdd1f79f.tar.gz";
sha256 = "08y8pmz7xa58mrk52nafgnnrryxsmya9qaab3nccg18jifs5gyal";
};
config.allowBroken = true;
@Gabriella439
Gabriella439 / HasCal.hs
Last active May 5, 2022 09:47
First steps towards modeling PlusCal as a Haskell eDSL
{-# LANGUAGE ApplicativeDo #-}
{-# LANGUAGE BlockArguments #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE UndecidableInstances #-}
module HasCal where
import Control.Applicative (Alternative(..), liftA2)
@Gabriella439
Gabriella439 / soundness-violation.dhall
Last active April 1, 2022 19:06
Minimal reproduction for breaking Dhall's type system safety guarantees
-- This is a minimal reproducing example of a major escape hatch that
-- violate's Dhall type safety guarantees.
let -- The uninhabited type (isomorphic to `< >`, but this is more ergonomic to
-- use for this reproduction)
Void : Type = ∀(any : Type) → any
let -- We model type-level negation in the standard way as a function from a
-- given type to the uninhabited type. `Not a` is only inhabited if `a`
-- is uninhabited (i.e. isomorphic to `Void`)
@Gabriella439
Gabriella439 / incomeTax.ffg
Last active July 2, 2025 21:08
Income tax calculator
\input ->
let toBracket brackets (_ : { }) income = fold
{ cons: \bracket result ->
if income > bracket."Lower bound"
then
bracket."Minimum tax"
+ bracket."Tax rate" * (income - bracket."Lower bound")
else result
, nil: 0 : Real