Functional programming, AI, Lisp, Neovim and Emacs, Principal SE


fullmoon
@fullmoon

I just saw two Docker-related posts in my chimeline, so you'll have to listen to me be insufferable about Docker for just a second

When I say that Docker is not compositional, what I mean is that there is no way to combine an arbitrary number of containers into a single container. When you combine a bunch of Docker containers together you end up with … still a bunch of containers and now you need some higher-level abstraction to represent and manage a group of containers (e.g. docker compose, kubernetes / helm or what have you).

Even worse, these higher-level abstractions for working with groups of containers are still not composable (meaning that all of the attempts to solve this higher-level problem in the Docker ecosystem still managed to get this wrong). Given any of these abstractions (X) for working with groups of containers, they somehow keep failing to provide a way to combine an arbitrary number of Xs into a single X. It's just a comedy of errors because they keep getting this one simple thing wrong.

This is the key thing that the Nix language gets correct that Docker does not get correct. You can easily combine 0 or more Nix derivations to produce a new composite derivation which is as simple as its constituent parts. This is why the Nix ecosystem keeps growing quickly while the Docker ecosystem is straining under the tower of non-compositional abstractions they've created.

If this subject interests you, I wrote a blog post along these lines a while ago (albeit not specific to Docker or Nix):


You must log in to comment.

in reply to @fullmoon's post:

This seems related to (is the same as?) the trouble with Haskell packaging wherein you must find one version of every package to satisfy the entire dependency graph, cf npm.

Also, that analogy between Monoid/Monad/Applicative is really cool!

This limitation is in fact Cabal's fault, and GHC actually doesn't mind having multiple of the same package. Nevertheless it's sure annoying.

I think the compositional issue with containers is slightly different than the package management one: it's that the packages installed into docker images just aren't managed. but also yes, there's the "what base image is it and are the packages compatible".

Great muse, thanks!

My 2 cents: network and topology are problems of operational semantics, while compositionality is of denotational semantics. The need of choosing one or another as the focus for engineering is the culprit, since a practical project necessarily involves both.

My wildest dream: a operational-semantics agnostic intermediary representation artifacts compiled from all sorts of languages preferably from Haskell/Agda alike; composed together declaratively using Nix to a final jumbo artifact; which then can be run in all sorts of different runtime implementation that supports this new IR, including (a) local-machine optimised runtime, (b) a self-configuring (topologically in a distributed network), self-evolving, self-healing true elastic "cloud", (c) or a educational runtime: explode all functions into network-capable nodes communicating with each other with messages as the way for function applications.

Free us all from the chores of ops engineering!

P.S.: am I describing unison cloud?