Alright so I’ve been uploading streamed videos of myself working on programming projects for awhile now. I occasionally get asked about my setup for this, so I thought I would explain the tools I use. This might be particularly valuable as I am primarily a Linux user where some of the kit for this can be kinda rough. Further, I am very picky about my tools and ergonomics so I didn’t really want to make any sacrifices there in order to stream.
I think the first thing my mother taught me to cook was Kraft Mac-n-Cheese at age 9. Fortunately, I’ve been able to move past that since then. My repertoire is a bit limited but I like to think that by zeroing in on specific kinds of meals, I’m able to make them go a bit farther. A friend of mine asked how I do crockpot recipes and after stewing on it for awhile I thought I would write a post explaining my thought process.
Rejected title: You’re not special
I saw this article comparing Ecto and ActiveRecord: https://www.dailydrip.com/blog/ecto-vs-activerecord.html
I thought I would track alongside that post and show what the equivalent code looks like if you’re using the Persistent Haskell library.
Rejected title: Type Praxis
I frequently see people recommend that others use typed holes. I think people are more apt to recommend typed holes than the alternatives because it’s a bespoke feature intended to enable discovering the type of a sub-expression more easily. Which is fair enough, except it doesn’t really have a good use-case! I will demonstrate in this post why.
This article is by Steven Syrek. I’m reposting it here because I endorse what he’s saying. I believe Steven brings a valuable perspective on the haskell book, reading groups, and education in general.
Steven posted this article on his Medium.
He has also written some extended notes on pedagogy tied to this post here.
As a break from usual, I thought I would review Zed Shaw’s Learn Python the Hard Way. I’ve had several beginners to programming ask me what they should use to learn and Shaw’s book frequently comes up. I’ve looked over his materials before when they were a free website but I wanted to see what the current published version was like.
I recently PR’d a Haskell entry to Hashrocket’s websocket shootout. Haskell seemed to do a lot better than C++, Rust, Golang, Elixir, Erlang, NodeJS, Ruby MRI, and JRuby. Although the Haskell version has been since fixed, so I can no longer run the benchmark reliably on my machine, so any final results will have to come from Hashrocket running the unagi-chan variant.
Some people find it trickier to store UUID values in their database with Persistent or to use UUID values in a Yesod web application than is really necessary. Here I’ll share some code from my work that demonstrates some patterns in applications that use Persistent or Yesod which should make it easier.
I’m a big fan of using build servers to continually build and test the code I’m working on. I’m also a bit of a latency nut, so I like our builds to be responsive. To that end, I migrating our company away from CircleCI and yielded a 10x improvement to build times for my trouble.
Someone wrote a blog post where they have trouble querying a web API in Haskell code. I walk through some examples for how to do so with increasing sophistication building up to some simple uses of lens
and lens-aeson
.
Programmers don’t understand that it doesn’t matter what the default target is for a type like Either
as long as there is one and it never changes. I go into some detail and justification of a programming language design that makes decisions like this inherent to the structure of the type rather than author’s (arbitrary and harmful) preference. The Left
and Right
of Either
do not mean anything in and of themselves.
Haskell programmers that often forget how hard it was to learn and use Haskell. They also forget that without the benefit of a code example that does precisely what one wants, it can be nearly impossible for someone to make forward progress unless they have a solid foundation in the language itself. We justify how this reality influences the way we write the Haskell Programming from first principles book.
Sometimes building a package with dependencies on OpenGL can be a little confusing for people new to Haskell. I will use a simple game on Hackage as an exercise for demonstrating how you might do this on Ubuntu. Note: this was written before Stack was a thing.
I often get asked why I do or do not recommend a particular resource for learning Haskell. To save some time and to record more detail than I’ll remember off the top of my head, I’ve written a round-up of the issues with various resources and books people use to learn Haskell.
This is a simple follow-along with a Python tutorial, with my version in Haskell and a running commentary. I wrote this partly to hint at why one might want a statically typed language regardless of how one thinks prototyping is best done. It was also partly cathartic.
This is a quasi-literate version of the very simple URL shortener I wrote in Haskell with Scotty.
I answered a question on Stack Overflow that I thought might be worth sharing here so that others might get an idea of how to refactor code into point-free style.
I respin an article originally written in Scala into Haskell, then veer off into the stratosphere.
I wrote an article for howistart. I’ve since updated it to use Stack as well.
I rewrote somewhat difficult to understand templating code that was originally in Clojure into much simpler Haskell and yielded a large performance benefit for my trouble.
Written in Scotty. The code is not great.
The previous edition of this post was cleaned up by a suggestion from another Haskeller. I share it with you here.
Aeson is a real joy to use once you get into the swing of things, but there are some patterns out there that end-users are left to discover for themselves. One of those is how to deal with data that has a lot of instances of the Maybe
type.
This is an extraction of a conversation between multiple Haskellers in an IRC channel. I’m not identifying who said what and the ordering will be more topical than temporal. I’ll add annotations for context as appropriate. I edited liberally.
Need to parse data with varying structure? Once again we resort to our old friend for handling exclusive possibilities, the sum type.
A simple demonstration of extracting boilerplate from Aeson code handling a Just
and a Nothing
case of a Maybe
value.
Sometimes one knows only part of the structure to be parsed out of JSON ahead of time, with some of that structure being defined by a user or consumer of the API. The solution to this in general and when using Aeson to make the wrapper type parametric.
Recently I had an experience where in the course of helping somebody with a problem, I developed an example that I thought would help people understand sum types, value constructors, and type constructors better.
In my last post, I described IO (IO ()) as being a sign you might’ve made a mistake unless you knew it was what you wanted. There are patterns which involve using a closed-over mutable reference for things like counters. This naturally leads to nested IO actions.
While playing around with querying ElasticSearch I bumped into something that I hadn’t really understood explicitly before about monads, nesting, and IO. Rather than blather on, I’m going to share a “literate” ghci session that demonstrates the point. Main editing change I made was to remove duplication in the output from querying the type :t
in ghci.
A brief demonstration of how to run Clojure programs like scripts with leiningen
.
Using drip to run Clojure code like a script.
It’s Valentine’s Day 2013 and since January 2013 I’ve read the following books.
Getting the following error on Mac OS X? Read on.
I am a user of irssi over GNU Screen + ssh as well as locally, and I tend to use Emacs style text movements in bash, so need my ctrl and alt/option keys to work more or less as they do in Linux.
You close connections, you end requests.
When I was getting the Jekyll version of my site rolling, I ran into some problems with how RedCloth, liquid, and pygments were interacting. What follows is the error that was caused.
You need to install xmonad-extras
from Hackage as the volume control functions are not included by default in any standard XMonad install. Below is the script for getting it installed.
I encountered some issues getting Emacs 23 working on Ubuntu 11.10 and I wanted to chronicle my travails in case someone else bumped into this. I tripped into this error after installing w3m-el-snapshot
.
Analysts and economists like to fixate on two metrics for personal finance, income and net worth. They are in some sense a measurement of slope, and of the volume under the curve minus spending and debt. I don’t think either are a meaningful gauge for really understanding why the poor are frequently stuck being poor.
…or you can find more in the archives.