Binary Lion Studios

Sunday, December 29, 2013

This December, I read through each great post by ocharles in his 24 Days of Hackage 2013 series. All the libraries he covered inspired me to try and write a small, useful Haskell application that used one or more of them. Timer is the result of that effort.

Saturday, December 28, 2013
Of Arrows and State Monads

I'm working on a project and found a practical use for arrows and the state monad (this actually makes the second time in a week arrows have come in handy!).

Tuesday, November 19, 2013
Concurrent Batch Processing, Part 2

In my previous post I showed a way to process a batch of data concurrently using Haskell. One drawback to that approach was that all the data to be processed was loaded into memory. This evening I found a better way that only loads a small subset of data into memory at a time.

Sunday, November 17, 2013
Concurrent Batch Processing

EDIT: I present a better way to do this in part 2 of this post.

At my day job I often find myself needing to pull a bunch of data from the database and process each row. The consumer is generally really slow, executing either a bunch of IO bound or CPU bound tasks on each row (downloading files, resizing images, processing epubs, uploading files, etc).

Thursday, October 24, 2013
time_ago_in_words Monkey Patch

Today my friend, Bryan, gave me a great idea for a Rails monkey patch. It goes something like this:

Wednesday, October 9, 2013
Aeson Happstack Response

Happstack makes it simple to return a JSON response with the correct Content-Type header using Aeson.

Thursday, September 26, 2013
Control.Applicative Alternative

If you provide an API that allows users to log in with either an email address or a username, (<|>) can provide an elegant solution.

Sunday, September 15, 2013
One of Each

My friend, Lance, proposed an interesting problem which ended up having a fairly elegant solution, so I figured I'd blog it.

The Problem

Given an array of arrays, create every possible combination using a single element from each array. For example, given [[1,2],[3,4]] produce the solution [[1,3],[1,4],[2,3],[2,4]].

Thursday, August 29, 2013
Making our build server talk

At my day job, we have an iMac that runs Jenkins and runs our test suite, among other things. It also happens to have some really nice speakers attached to it. One thing it was sorely lacking was the ability to remotely execute the OSX say command.

That was until today.

Thursday, August 22, 2013
Mixing pure and monadic validations with Digestive Functors

There comes a point in every developer's life when he or she needs to mix pure and monadic validations. Fortunately, with Digestive Functors, it is very straight forward.

Tuesday, August 6, 2013
Scala Scales XML Skip DTD Validation

By default, the underlying SAX parser used by the Scales pull parser will validate the DTD on load. This can be really slow and requires an internet connection. You can ignore the DTD spec by creating an instance of SimpleUnboundedPool and telling Scales to use it.