Arcadian Visions Blog
I should coco
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.
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.
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?
Updates, bug fixes, performance improvements, and stability. How can we meaningfully identify software dependencies?
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.
<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>— 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>
<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's so important? If you write up a short explanation, I'll change my slides.</p>— 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>
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.
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.
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.
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.
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.
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.