Entries Tagged ‘haskell’:

Graham Scan in Haskell

This article follows how I developed an implementation of the Graham scan algorithm in Haskell, missteps and all. I think it’s valuable to see the process that others use, especially in a “weird” language like Haskell. At times, it can seem like most of what you’ve learned about developing software doesn’t apply to Haskell, but I think that’s just because the language allows so much of the scaffolding to be cut away once the software is finished. Reading Haskell code written by the masters can feel like looking at the Sistine chapel and wondering where they got such long paint brushes. This will be a step-by-step implementation as I developed it. I’m still learning too, so don’t take this as an example of excellent Haskell style.

Read the rest…

Tags: , , ,

Leave a Comment


Practical Haskell: scripting with types

Starting with a simple shell script, Don Stewart shows how Haskell can be readable, safe, and robust in this slide show.

Practical Haskell: scripting with types « Control.Monad.Writer.

Tags: ,

Leave a Comment


Fox & Geese in Haskell: Part 2

Last time we looked at how the board is represented in the little Fox & Geese game I wrote in Haskell. This time, I’ll cover the machinery that makes the game go: moving pieces, jumping, and validating moves. The code for this part is available in my GitHub repo under tag v0.1.2.

Read the rest…

Tags: , ,

Comments (3)


Fox & Geese in Haskell: Part 1

My next project for learning Haskell is Fox & Geese. This game has simple rules and mechanics, and it doesn’t need fancy graphics. It is pretty easy to implement a simple version quickly, so I can focus more on Haskell than details of the game. I’ll go over this in a series of posts. In part 1 I’ll talk about how I represent the game board in Haskell, and in later parts I’ll discuss input handling, drawing, and game mechanics.

Read the rest…

Tags: ,

Comments (1)


Monad Transformers

Two easy introductions to monad transformers in Haskell.

The first is a PDF, Monad Transformers Step by Step, that builds up complex functionality step by step using monad transformers.  It shows in detail how to combine transformers, and why you would want to, two things which had thoroughly confused me.

The second is another brief post from A Neighborhood of Infinity, Grok Haskell Monad Transformers.  This shows how to work with a stack of monad transformers using lift.

Tags: , ,

Leave a Comment


A Bit About Monads

Here’s a great, understandable introduction to monads.  He builds up monads as solutions to common problems.  I love explanations like that!

A Neighborhood of Infinity: You Could Have Invented Monads! (And Maybe You Already Have.).

Tags: ,

Leave a Comment


Haskell Life

I’m starting to pick up Haskell again, and this time it’s finally clicking for me. Believe it or not, Learn You A Haskell explains monads in a way that actually makes sense! While I’m learning Haskell, I’m going to be making some dumb little projects. What better way to make sure I understand how they work than by explaining them on here? And who knows, maybe you’ll catch the Haskell bug, too.

The first project is a simple implementation of Conway’s game of life. The full source is at GitHub. There isn’t much to life, really. All we have to do is read or generate a starting grid, apply the rules to make grid N+1 from grid N, then draw a grid on the screen.

Read the rest…

Tags: , ,

Leave a Comment