<- Hindsight >>= Foresight
Next: How big is small enough

15 February 2021

29 articles and papers from the vault

Porting and editing of this 2015 post to .gmi is supported by the following VIM macros:

" Convert markdown header link into a gemini link line
let @q = '0dwi=> ��ald%A��aA ��ap%xA�kb��a0w%0wx''
" Convert a markdown link into a gemini link line
let @w = '0/[
i
��a%l%a
�kD��aki=> ��akjld%A ��ap%x$x0/(
%x0wx'

Monoids and finger trees

Apfelmus, H. 2009. Monoids and Finger Trees

This is a blog-post about using monoid to turn annotated binary tree into a data-structures-Swiss-army-knife.

Main idea is that because often tag (annotation) of a branch is, practically, a function of annotations of its children:

annotation v a ::� Tree v  -> v
annotation (Branch _ x y) = f (annotation x) (annotation y)
annotation (Leaf   _ a)   = measure a

where ``f`` fits axioms of ``mappend`` and ``v`` so often behaves like ``Monoid``, Apfelmus, citing

Hinze, R. and Patterson, R.

offers following generalization:

class Monoid v => Measured a v where
  measure ::� a-> v

branch ::� Monoid v=> Tree v a -> Tree v a -> Tree v a
branch x y = Branch ((annotation x) <> (annotation y)) x y

leaf ::� Measured a v=> a -> Tree v a
leaf a = Leaf (measure a) a

For practical uses, read the full article, it's quite entertaining.

Nix pills

Bruno, L. 2014/15. Nix Pills

Luca is doing important job of covering grounds of interactive documentation for Nix package manager and NixOS.

Nix pills start with trivial stuff, like language overview and basic expressions and are taking reader to an entertaining ride through some specific parts of Nix workflows that might be obscure for a Nix newcomer.

The design of the blog is pretty terrible (see initial ``callPackage`` definition in this post):

callPackage design pattern post.

but with w3m or lynx, it's pretty readable. (Added in 2021: now nix pills are part of official nixos documentation. Well deserved, Luca!)

Nix pills at nixos.org

Command-line tools can be 235x faster than your hadoop cluster

Drake, A. 2014. Command-line tools can be 235x faster than your Hadoop cluster

A great post that boils down to the simple notion of choosing the right tool for the job, hinting the need of hiring experienced software architects and doing R&D properly (not following the hype).

Failed (as of 2021) attempt to fix Haskell records

Volkov, N. 2015. Announcing the first class records library

Based on

Volkov, N. 2013. Anonymous records. A solution to the problems of record-system.

proposal, Nikita Volkov suggests using

type-level string literals

to build a library, capable of quite sexy things, like

type Person = 
  [r| {name :: String, 
       birthday :: {year :: Int, month :: Int, day :: Int},
       country :: Country} |]

type Country =
  [r| {name :: String, 
       language :: String} |]

person :: Person
person =
  [r| {name = "Yuri Alekseyevich Gagarin", 
       birthday = {year = 1934, month = 3, day = 9},
       country = {name = "Soviet Union", language = "Russian"}} |]
A subset of lens is integrated with Volkov's records:
getPersonBirthdayYear :: Person -> Int
getPersonBirthdayYear =
  view ([l|birthday|] . [l|year|])

setPersonBirthdayYear :: Int -> Person -> Person
setPersonBirthdayYear =
  set [l|birthday.year|]

There's a long way to go for this library, but I really hope for a standard and sane records in Haskell.

Simons, P. 2014/15. Articles about Haskell with Nix and Haskell NG

Simons, P. 2014. How to set up your Haskell environment

That's why you read maling lists, not wiki, people. Awesome article by Peter Simons, providing up-to-date information regarding

setting up Haskell environment(s). Helped me to organize my environment.

Simons, P. 2014. Haskell NG

Peter explains what haskellngPackages are, which problems they solve and why you should go to nixpkgs and mark stuff that doesn't build as broken (at least).

Good article to read, to get a perspective of Haskell NG development.

Simons, P. 2015. A Journey into the Haskell NG infrastructure: Part I
Simons, P. 2015. A Journey into the Haskell NG infrastructure: Part II

FAQ about state of the art of Haskell NG and why should we care. Explains ``provideOldHaskellAttributeNames``, explains why did ``ghc-wrapper`` disappear for good

and much more. Prototype for new Nix Haskell documentation.

When I accomplish that, be sure that I'll write a blog post about it.*

(Added in 2021: I'm not sure that yesod has ever built, ever. But it's good that it existed because `stack` was a nice convenience tool).

turns out, haskellng is great for libraries that aren't inherently broken (read: for major Haskell libraries and applications that don't follow Yesod's distribution pattern). Besides, Pete Simons is really fast on fixing bugs in haskellng expressions. I'm a little bit shy to send PRs myself yet though.*

Wai without Yesod (is like Plug without Phoenix)

Zovic, L. 2013. Wai Without Yesod - Simple Example of Haskell Web Development

In this post, Leo rolls out a Yesod-less grocery shopping listing application. What I love about this blog-post (and most of his blog-posts) is that

it has this "get things done" attitude. Don't expect production-grade code there, however it's a very nice and gentle introduction into the world of WAI.

Unagi-chan

Simmons, B. 2014. Announcing Unagi-chan

I found this article somewhat related to

the talk given by Paolini-Subramanya, M. at Erlang User Conference in 2013 (that I had an honour to witness in person).

There Mahesh was talking about the practical sides of queue management and why in real high-load systems it's absolutely critical to get less wrong.

In that sense, some of theoretical insights given by Brandon.

The source code of this library is a nice study in queues, definitely worth looking at.

Silver bullets don't exist, what else is new?

tedu. 2015. Heartbleed in Rust

Even though I do think that this post is pretty pointless, I found it entertaining.

Besides, I do agree with tedu when he says

The point here isn't to pick on rust. I could have written the same program
with the same flaw in go, or even haskell if I were smart enough to
understand burritos. The point is that if we don't actually understand what
vulnerabilities like Heartbleed are, we are unlikely to eliminate them
simply by switching to a magic vulnerability proof language. Everyone may
have heard about Heartbleed, but that doesn't necessarily make it a good
exemplar.

>

Perhaps Heartbleed is a just a stand in term referring not to Heartbleed
itself, but rather any number of other bugaboos. I'm not sure that's better.
Vulnerabilities like Heartbleed but not too much like Heartbleed is a poorly
defined class. It's hard to assess any claims about such a class.

>

When speaking about vulnerabilities and how they can be resolved, we should
try to be precise and accurate. The hype around Heartbleed (and ShellShock,
etc.) makes them attractive targets to latch an argument on to, but in doing
so we must be careful that our chosen example fits the argument.
Misidentified problems lead to misapplied solutions.

Silver-bullet cultists, static-typing fundamentalists and functional programming purists shouldn't be taken seriously because fundamentalism in any shape and form blinds its adept and makes her detached from reality.

That being said, I find the post pointless because, after stripping fundamentalist bullshit, we're left with a statement like "while writing idiomatic parsers in functional style we severely reduce the probability of having leaky buffers".

Ugly optimizations, however, oftentimes break the idiomaticness of the code, hence the whole discussion retards to a simple pair of non-contradicting statements not worth the holy war.

Leeming C. 2014/15. On Docker

Let's review.. Docker (again)
LXC containers are awesome, but Docker.io sucks

Docker is the most famous LXC/AUFS wrapper.

I didn't care enough to dig it even though we were using it in production with one of the companies I was working for.

In the linked posts is pretty reasonable critique of this library.

Looks like my gut feeling about projects in Go is yet to fail me.

One of the original Nix used papers

Dolstra E., Visser E. 2008. The Nix Build Farm: A Declarative Approach to Continuous Integration.
A later, more complete version of this paper is available as well

This paper describes Hydra, the current CI system used to test Nix expressions.

A perfect thing to read before you make your first Hydra deployment.

Turtle announcement

(2021: I still use it, even though I suffer from an ocassional butthurt from "batteries included" aka "reexport half the hackage" philosophy).

Gonzalez G. 2015. Use Haskell for shell scripting

Interesting project, use case of which is limited to one thing -- simple shell-scripting

for teams of Haskell programmers/dev-ops. I really hope that someone will either write a

translator from Turtle to Shell, or nobody will going to ever use this library for writing

user-facing scripts.

Acid-state and VCache

2021 note: don't use either! Use optional Base64 + text files for prototyping; use real databases for production.

Barbour D. 2014. VCache, an Acid-State Killer

Ambitious library that is designed to perform well with large amounts of data, address larger-than-RAM scenario and compose better than acid-state.

(Added in 2021): But after quite some practice, it turned out that acid-state didn't need a killer, it managed to get the job of killing itself well enough.

We helped a little bit.

It should be noted though that I think of acid-state as a library best suited for prototyping in Haskell.

It provides reasonable (run-time) correctness guarantees that we persist the types we want to persist and bootstraps development of a Haskell application.

VCache, on the other hand, aims to be a production-grade persistent library for non-cyclic data.

Cofree meets Free

Piponi D. 2014. Cofree meets Free

This article and the talk referenced touches co-things in algebraic systems.

It gives pretty concise metaphor for machines with state and buttons being analogous to comonads, for instance.

In some way, this is a codescription of cothings to the one given by someone on Haskellcast.

Miscellaneous and revisited links

Conal E. 2014. On FRP and Denotational Design
Cowley A. 2015. Robots on Haskell
Hoare's Quotes
AkkaRaceSample README
Probability monad
31C3
Why are computers so fucked and what to do about that
Let's build a quantum computer!
Diamonds are a quantum computer's best friend