Arcadian Visions Blog
I should coco

Robust Notes with Embedded Code

Emacs's org-mode has great facilities for working with source code, often referred to by the name Org Babel. A simple use is having source code from various languages embedded in a single text file that is otherwise occupied with talking about that code.

There are myriad ways one can use this functionality, but here let's focus on just one: short code demonstrations. While working on a large project, you encounter a technique or library whose usage is not obvious to you today. This means that even as you figure out how to solve your problem today, when you come back to your code a year from now, your solution may again not be obvious to future-you who has forgotten the hard-won lessons of today-you. What we want to record in our notes is a set of example programs we wish we found when writing today's code.

Now, the tricky part in finding the perfect example for whatever problem you're facing is that the author of the perfect example must be using the exact same tools that you are. It's hardly a perfect example if the author uses a different version of some software library at the center of what you're trying to do! We want the example to exactly reproduce the environment in which we are building our larger project. No surprises, please.

Reproducible development environments just happen to be the forte of the nix package manager. Here we can pin down precise versions of the source code of each of our tools, that of their dependencies, that of their dependencies' dependencies, and so on all the way up stream.

Coming back to where we started: we want to record in our org-mode notes example programs that clearly demonstrate a technique or API exactly as it is used in our larger project. We thus want Emacs to know how to evaluate source code blocks in the context of the project the notes are related to.

read more

cquery and nix, part 2

Following up from the previous article on using cquery with nix, this time we will consider a bare bones C++ project that does not rely on cmake for building.

read more

cquery and nix

cquery is a language server for C, C++, and Objective-C built on libclang. I use it in emacs with the help of lsp-mode and lsp-ui. The wrinkle is that I define my development environments using nix. This article shows a sample project using these things along with some work-in-progress glue I've written.

read more

Preprocessing

Running source files through a C preprocessor (CPP) is a common step for many languages. In part it leverages common familiarity with C, in part it can ease eventual interoperation with C, and – the part that I think is interesting – it occasionally feels like a reasonable trade-off between power and complexity. So what use is hpp, a Haskell preprocessor?

read more

Versioning is Hard

Updates, bug fixes, performance improvements, and stability. How can we meaningfully identify software dependencies?

read more

Stop Trying to Express Yourself With Code Layout

Allowing programmers to express themselves through their choices about notation layout – the fiddly details of how a program represented as a string of characters is laid out in a text file – provides flexibility for different preferences and computer screen situations at the expense of mutual readability between different people.

read more

MTL's Unfortunate MT Anchor

An unpacking of a cryptic tweet suggesting that Monad Transformers have limited the popularity of the design used by the Monad Transformer Library,

<blockquote class="twitter-tweet" data-lang="en"><p lang="en" dir="ltr">Haskell programming techniques were set back by mtl being associated with monad transformers.</p>&mdash; Anthony Cowley (@acowley) <a href="https://twitter.com/a_cowley/status/753679659443838976">July 14, 2016</a></blockquote> <script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>

read more

Optionally Exposed

I recently wrote some code to add an interesting new feature to hpack. I'm going to highlight some drawbacks to it to hopefully promote discussion.

read more

Stack vs Stackage

Due to their common founding organization, contributors, and naming, stack and Stackage are often con-fused. This note is in response to a request for clarification during a Twitter conversation,

<blockquote class="twitter-tweet" data-lang="en"><p lang="en" dir="ltr"><a href="https://twitter.com/a_cowley">@acowley</a> <a href="https://twitter.com/rufuse">@rufuse</a> Could I ask why it&#39;s so important? If you write up a short explanation, I&#39;ll change my slides.</p>&mdash; Domen Ko┼żar (@iElectric) <a href="https://twitter.com/iElectric/status/754689121491292160">July 17, 2016</a></blockquote> <script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>

read more

Postmortem: Cabbage

Some time ago, I made the traditional bad decision of working on my own build tool. In this case, I was interested in more efficiently sharing compilation artifacts across a dozen or so Haskell projects between two development machines without sacrificing isolation between those projects such that working on one would never break another.

read more

Public Policy: Encrypted

The debate around granting the government access to encrypted communications reached a new level when the Department of Justice demanded Apple help them break the encryption of an iPhone connected to a terrorist.

read more

Postmodern Haskell and OpenGL: Introducing vinyl-gl

This article is for those familiar with Haskell and, at least passingly, with Jon Sterling's vinyl library (that packs quite a nice introduction). Further, it is assumed that the reader is familiar with the basics of computer graphics and OpenGL. I have written another article that introduces the use of relatively modern OpenGL practice with Haskell that may serve as a primer for this article.

read more

Fast Factory Video

I spent the past few months developing the perception system behind this video of a PR2 grasping moving objects.

read more

Introducing CLUtil

OpenCL is a cross-platform parallel programming standard with support for execution on both CPUs and GPUs. The OpenCL package on hackage provides a direct binding to the API with just enough Haskellosity to make invoking those API functions borderline pleasant. That said, there remains a certain amount of boilerplate that is rather offputting.

read more

Haskell and OpenCV

Some time ago I forked Noam Lewis's HOpenCV bindings to the fine OpenCV library to fill them out with pieces I needed for several projects at work, and to experiment with how such bindings could be used. Over time I've built up some useful components, and, in a fit of non-procrastination, I've recently pushed many updates and assembled a fun demo program.

read more

Haskell Genetic Algorithm "Hello, world!"

A post on reddit linked to several implementations of a cute "Hello, world!" program demonstrating a genetic algorithm that evolves towards a target string. Example programs were written in several languages, and I thought a Haskell version could be worthwhile as it demonstrates the use of random numbers, an issue that frustrates many newcomers to the language.

read more

Modern OpenGL with Haskell

This is a Haskell implementation of the ideas presented in chapter two of Joe Groff's excellent tutorial on modern OpenGL.

read more