Susan Potter
###

Code snippets and technical notes


2020-09
Snippet Dhall's merge: Pattern Matching for Configuration

Dhall's merge function provides exhaustive pattern matching for union types. This article shows how merge works, from simple enumerations to union types with payloads, with comparisons to Haskell …

2020-09
Snippet Reader: Dependency Injection Without the Ceremony

Reader is a pattern for threading read-only configuration through a computation without passing it as an argument at every call site. This article builds Reader from first principles in PureScript, …

2020-09
Snippet No Subtyping in PureScript: Row Polymorphism Instead

PureScript has no subtyping. Data constructors are not subtypes; they are functions that build values of a single type. When you need to share structure across types, row polymorphism provides a more …

2019-04
Snippet Socket Statistics on Linux with ss

An excellent tool when you need to troubleshoot distributed systems is ss, which provides visibility into TCP states of your live connections. Even if you know netstat this is a command you should get …

2018-10
Snippet Profunctors: The Machinery Behind Optics

Profunctors are the abstraction that makes lenses, prisms, and other optics composable. This article builds intuition for profunctors from first principles, showing how they generalize the familiar …

2018-04
Snippet Decoding lens operators

Notation conventions The following table provides a quick overview of conventions used in symbolic operators in the lens library. Symbol Concept Denotes ^ getter gets value from structure ~ setter …

2016-08
Snippet Nix in your home directory

Prerequisites wget is installed tar is installed Purpose If you really don't want to install Nix under /nix (or you can't) then you can install Nix in your home directory like in the …

2012-01
Snippet Erlang OTP Glossary of Terms

I am hoping this will serve as a reference for coworkers and others new to Erlang and OTP to be able to figure out the terminology easier than I had to. I learned the hard way, so you don't have …

2011-03
Snippet Erlang Meck API notes

Here is a snippet showing how to use the Meck API which is a mocking library in Erlang. We will show how to create a fully mocked version of an existing module, unloading mocks, removing functions …

2009-11
Snippet Predicate Algebra in Python

Updated for Python3 recently: class Predicate: """ Define predicate algebra. >>> isEven=Predicate(lambda x: x % 2 == 0) >>> isOdd=Predicate(lambda x: x % 2 == 1) …