Skip to content

Instantly share code, notes, and snippets.

@Gabriella439
Gabriella439 / livestream-nixos-vm.nix
Last active December 4, 2020 18:30
Code used for Kafka livestream example
let
nixpkgs = builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/f3fc2f3326a23797b2c95297e68ed8e8de2a95e6.tar.gz";
sha256 = "0wsplccl8bv522zh3y8affacw9pmzsxm18i5hdgz78gxh8m7k933";
};
nixos = import "${nixpkgs}/nixos" {
system = "x86_64-linux";
configuration = { pkgs, ... }:
@Gabriella439
Gabriella439 / dhall-checklist.md
Created November 18, 2020 03:08
Dhall programming language checklist

Programming Language Checklist by Colin McMillen, Jason Reed, and Elly Fong-Jones, 2011-10-10.

You appear to be advocating a new:

  • functional
  • imperative
  • object-oriented
  • procedural
  • stack-based
@Gabriella439
Gabriella439 / unrolled.txt
Created April 21, 2020 05:46
Example of unrolled recursion in Dhall
⊢ :let List/generate = https://prelude.dhall-lang.org/List/generate
List/generate : ∀(n : Natural) → ∀(a : Type) → ∀(f : Natural → a) → List a
⊢ List/generate 10
λ(a : Type)
→ λ(f : Natural → a)
→ [ f 0, f 1, f 2, f 3, f 4, f 5, f 6, f 7, f 8, f 9 ]
@Gabriella439
Gabriella439 / api-design.txt
Last active April 12, 2020 13:20
API design notes
* Importance of category theory
* Answers the question: "What is a *timeless* API?"
* What does "timeless" mean?
* Likely to still be relevant years from now
* Likely to be low maintenance (since unlikely to change)
* Less likely to be subject to controversy or discussion ("obvious")
* Examples:
* Everything Haskell's typeclassopedia (except maybe `Foldable`)
* Categories / Monoids
* `(.)` / `id`
@Gabriella439
Gabriella439 / open-source-contributions.md
Created February 5, 2020 21:29
Notes for livestream on contributing to open source projects

These are my rough notes when preparing for a Haskell livestream that I thought would be worth sharing. Some things are general comments on contributing to the open source ecosystem whereas other notes are specific to the stream (e.g. Haskell and the streamly package)

How things look from a maintainer's point of view (for highly active projects):

  • Reactive

As projects become more active the maintainer's "inbox" gets pretty large. A

@Gabriella439
Gabriella439 / Main.hs
Created December 5, 2019 03:54
Simple Twitter chat bot
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
import Data.ByteString (ByteString)
import Data.Default.Class (Default(..))
import GHC.Generics (Generic)
import Network.Connection (ConnectionParams(..))
import Options.Generic (ParseRecord)
@Gabriella439
Gabriella439 / livestream.md
Created November 15, 2019 02:04
Awake Security Haskell Livestream

Awake Security Haskell Livestream

Who

Awake Security will be livestreaming a periodic 1-on-1 teaching session on Twitch. The subject of this session will always be one of our engineers teaching another one of our engineers how to do accomplish a practical task in Haskell while remote attendees watch, comment, and ask questions.

@Gabriella439
Gabriella439 / foreach.dhall
Created August 9, 2019 22:55
Example of how the equivalent of `foreach` in Dhall is `Prelude.List.map`
let Prelude = https://prelude.dhall-lang.org/package.dhall
let FN = Natural/even
let a = 2
let b = 3
let c = 5
@Gabriella439
Gabriella439 / take.dhall
Created July 1, 2019 02:42
Dhall implementation of `take`
{- This is a bit ugly and inefficient. See this thread for a discussion about
adding a `Natural/subtract` built-in to improve this:
https://github.com/dhall-lang/dhall-lang/issues/602#issuecomment-505484434
-}
let Natural/predecessor : Natural Natural
= λ(n : Natural)
let result = Natural/fold
n
(Optional Natural)
@Gabriella439
Gabriella439 / ackermann.dhall
Last active April 26, 2020 00:00
Ackermann function in Dhall
-- Credit to: https://news.ycombinator.com/item?id=15186988
let iterate
: (Natural Natural) Natural Natural
= λ(f : Natural Natural)
λ(n : Natural)
Natural/fold (n + 1) Natural f 1
let increment : Natural Natural = λ(n : Natural) n + 1