Functional Education

Posted: 2014-12-31

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.

Why are types useful?

Posted: 2014-12-03

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.

A URL shortener made literate

Posted: 2014-11-22

This is a quasi-literate version of the very simple URL shortener I wrote in Haskell with Scotty.

Code refactoring with pointfree style demoed via updateMap

Posted: 2014-11-19

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.

How I Start: Haskell

Posted: 2014-11-18

I wrote an article for howistart. I've since updated it to use Stack as well.

Strong types and testing - in Haskell

Posted: 2014-11-18

I respin an article originally written in Scala into Haskell, then veer off into the stratosphere.

Parsing and rendering templates in Clojure & Haskell

Posted: 2014-10-02

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.

URL Shortener in 43 lines of Haskell

Posted: 2014-08-22

Written in Scotty. The code is not great.

Aeson with types that have lots of 'maybes', v2

Posted: 2014-07-31

The previous edition of this post was cleaned up by a suggestion from another Haskeller. I share it with you here.

Aeson with types that have lots of 'maybes'

Posted: 2014-07-30

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.

Meditations on learning Haskell

Posted: 2014-04-29

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.

Parsing data of varying structure in Haskell with Aeson

Posted: 2014-04-17

Need to parse data with varying structure? Once again we resort to our old friend for handling exclusive possibilities, the sum type.

Nested user-defined types with Aeson

Posted: 2014-04-11

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.

Refactoring boilerplate from sum types

Posted: 2014-04-11

A simple demonstration of extracting boilerplate from Aeson code handling a Just and a Nothing case of a Maybe value.

Grokking sum types, value constructors, and type constructors

Posted: 2014-04-05

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.

Mutable closures in Haskell and nested IO

Posted: 2014-03-25

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.

Monads, lifting, join, and side-effecting actions.

Posted: 2014-03-24

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.

Using shebang and lein-exec to write Clojure scripts that can use dependencies

Posted: 2013-02-18

A brief demonstration of how to run Clojure programs like scripts with leiningen.

Using drip for Clojure scripts (non-Leiningen)

Posted: 2013-02-17

Using drip to run Clojure code like a script.

February Book Log

Posted: 2013-02-14

It's Valentine's Day 2013 and since January 2013 I've read the following books.