Build systems à la carte: Theory and practice - reading/discussion session

Edit: Help wanted: please leave a message on BSalC reading session infrastructure help if you have infrastructure suggestions.

A new extended version of the Build Systems a la Carte paper has been released per https://twitter.com/andreymokhov/status/1252551082531749888 (pdf direct link: https://github.com/snowleopard/build/releases/download/jfp-preprint/build-systems.pdf )

Old paper: https://www.microsoft.com/en-us/research/uploads/prod/2018/03/build-systems-final.pdf
Simon Peyton Jones presenting on the old paper: https://invidio.us/watch?v=BQVT6wiwCxM

I don’t know how things like this are supposed to work, but I’d like to run a reading session this weekend, Saturday April 25th, starting at 14:00 UTC, and a second, discussion session exactly one week after.

The idea for the first session is to have a time for people to read through the first paper, who have not already read through it, and for the second session it is expected to have read through the paper. Of course, the inevitable discussion during, is welcome.

I’ve never done anything like this, and infrastructure is pending, but I wanted to put this out there. I’m also open to someone else taking over completely.

There is a possibility that we might use something audio-only, like mumble, though I personally would not mind being able to see the people, who choose to be visible, so please leave a vote.
To be clear, the poll is about whether video should be supported, not whether enabling video should be required of participants.

To gauge attendance:

  • I would like to participate
  • poll dummy

0 voters

Reading session:

  • definitely need video
  • video would be nice
  • video is unnecessary
  • video is detrimental

0 voters

Discussion session:

  • definitely need video
  • video would be nice
  • video is unnecessary
  • video is detrimental

0 voters

2 Likes

Participants may also join ##bsalc on freenode, in the interim.

1 Like

A clean copy of the article, without slight publisher modifications (per the author - said they prefer the preprint version anyway), is now accessible at https://github.com/snowleopard/build/releases/download/jfp-preprint/build-systems.pdf for your reading pleasure. The main post has been updated to reflect this.

I’ll be hosting the room today, you can access it here (I’ll open it 15 minutes before): https://meet.google.com/aca-aauv-kgt

Thanks to Google account shenanigans this was assigned to the wrong account, here is a new link:

To join the video meeting, click this link: https://meet.google.com/iue-zpqw-bfc
Otherwise, to join by phone, dial +33 1 87 40 02 60 and enter this PIN: 407 194 876#
To view more phone numbers, click this link: https://tel.meet/iue-zpqw-bfc?hs=5

1 Like

Ok so a small retrospective on the first meeting; we naturally did end up going on about various things instead of reading, thanks to Profpatsch for hosting the room. Five people showed up.

I thought about providing a plug-and-play nix environment so anyone can use the GHC REPL to play around with the library, but didn’t commit to doing this. In hindsight it would have indeed been advisable to do so, because the first few minutes were spent trying to get a REPL running for someone. I will post a solution to this.

The levels of Haskell experience in the meeting varied from none to experienced - luckily the content of the paper doesn’t seem too require any particularly advanced Haskell knowledge, but since the Nix community is not a strict subset of the Haskell community, listing some prerequisites would have been good for those not intimately familiar with Haskell. This would allow them to work on obtaining the prerequisites. I think this paper is in a good spot for this.

Profpatsch did a bit of a screencast as we looked at some sections of the paper - this would have been another part where it would have been good to have a REPL (it was not a problem to set up once we actually tried). The paper has published a working library and we could interact with the type definitions and illustrate things.

If anyone wants to join, we should also have a mumble server up later today.

I hope I didn’t forget anything useful. :slight_smile:

1 Like

A bad crash course in Haskell:
In terms of haskell prerequisites, I think you only need, but you can wing it for a lot of it:
(There is also a rust translation at https://github.com/cutculus/bsalc-alt-code, but I can’t comment on that.)

  • a basic operative notion of how haskell syntax works
    • function application, order of operations with parentheses, lambdas, etc
  • a basic ability to use the REPL is helpful, inspect types with :t
  • an operative understanding of how Haskell function signatures look and work
    • f :: a -> a -> b -> c is a function named f, taking three parameters of arbitrary type a, a, and b, and returning type c. The portion of the signature doing the work for “of arbitrary type” in the previous sentence is some implicit forall quantification, scoped over the entire signature, so the “real” signature is: f :: forall a. forall b. forall c. a -> a -> b -> c
    • Haskell functions have currying, and can be partially applied; i.e. you can apply arguments one at a time and get specialized functions. E.g. from the previous example, f (4 :: Integer) will be specialized to fpartial :: Integer -> b -> c
    • Haskell has first class functions, like Nix
  • an operative understanding of how to use algebraic data types
    • e.g. how the Maybe type works (basically the Option type in other languages)
  • a basic understanding of what typeclasses do
    • (they give you operations for some data types, like tuples of sets and operations in abstract algebra, e.g. (R,+,*) being the ring of real numbers, if you’ve been exposed to that, so you could have a typeclass Ring, with an instance Ring Reals, which expose + and *)
    • There are typeclasses which can be considered type level functions; The type class Ring a takes a parameter a; applying Real to the typeclass returns the type Ring Real.

(additional items pending, and maybe some links to look at)

The hardest part, and a part of the meat of the paper, and the abstractions it provides, come from the Functor, Applicative, Monad type class hierarchy. You will want some idea of what’s going on there.
These are typeclasses like any other, but by convention their operations follow a specific set of laws for each typeclass, just like how you have laws for + and * over the Reals in arithmetic. The compiler does not check that the implementations satisfy the laws, it is up to the implementor to make sure they hold.

You can also look at any of the various Haskell resources on the internet, I don’t have a specific crash course to recommend yet.

Edit: I keep mistakenly conflating partial application and currying https://en.wikipedia.org/wiki/Currying#Contrast_with_partial_function_application

2 Likes

You should be able to run (untested)

pushd "$(mktemp -d)"
git clone https://github.com/snowleopard/build/ 
pushd build
nix-shell -I nixpkgs=channel:nixos-19.03 -p 'ghc.withPackages (p: with p; [ algebraic-graphs base containers extra filepath mtl random transformers ])' cabal-install --run 'cabal repl'

to get a GHCI REPL with the library from the paper loaded into scope.

The mumble can be found at the bsalc channel on mumble://mumble.nix-community.org/bsalc on the standard port.

I remember that the Functor, Applicative and Monad chapter in Learn You A Haskell (and the following chapters) was helpful when I first tried to learn Haskell.
The book is not recommended very much nowadays, but it helped me grok these concepts somewhat.

It would be nice if we had a document summarizing how the ideas from the paper apply to Nix, but I don’t have any concrete plans for this.

1 Like

For your additional consideration; https://www.hillelwayne.com/post/nix/

Edit:
Another, essentially unrelated post, this time using TLA+ instead of Alloy, but still in our general problem domain, about verifying an update process so that deployed nodes have consistent versioning; https://www.hillelwayne.com/post/modeling-deployments/

For this week, we are experimenting with a more open-source stack:

Voice chat: nix-shell -p mumble --run 'mumble mumble://mumble.nix-community.org/bsalc'
Whiteboard: nix-shell -p drawpile --run 'drawpile drawpile://haku.profpatsch.de'

And we might have a tmate for shell access.

1 Like

A short retrospective on today’s meeting:

We mostly ended up spending the first hour on alternative infrastructure, and didn’t make much progress on actually discussing the paper; we decided to have another meeting next saturday, in the hopes of having a more directed discussion.

We decided to try using drawpile ( nix-shell -p drawpile --run 'drawpile drawpile://haku.profpatsch.de' ) for annotation, which seems to work quite well (drawing tablet recommended) - there is also a text input tool. It’s basically a multiplayer raster based drawing app.
Protocol: pick a color at the top left, write your name, annotate on the annot layer.

Also we ended up using mumble for voice. ( nix-shell -p mumble --run 'mumble mumble://mumble.nix-community.org/bsalc' )

We also ran a tmate session for collaborative access to a GHCi repl.

There is a pad at https://codi.lassul.us/4bi1KuymRK24s40H-JlJiw .

These all seem to be quite performant and quality is good, though drawpile might require some ram after I copy all 54 pdf pages (needs to be tested).

1 Like

The mumble has been moved to mumble://mumble.nix-community.org/bsalc