Entries Tagged ‘haskell’:

Haskell Life With Repa Part 2: Parsing Framework

Conway's Life - Gunstar

Life Pattern - Gunstar

In the last post, we built a simulator for Conway’s Life in Haskell using repa and OpenGL. The initial life pattern in that implementation was hard coded. In this post, I’ll build a framework for parsing patterns from files.

Read the rest…

Tags: , ,

Comments (1)

Conway’s Life in Haskell with Repa and OpenGL

Conway's Life in Haskell

The final state after starting with the acorn pattern

Repa is a new library in Haskell for handling arrays. It has flexible indexing like the old array library, but supports parallel computation, stream fusion, and has a rich API like the vector library.

To learn how to use repa, I implemented Conway’s Life using repa for the simulation and OpenGL for the display. The complete code is available on BitBucket and builds on my GLFW-b boilterplate, so I’ll only discuss the interesting parts here. Don Stewart wrote a good introductory tutorial to repa that will fill in any gaps I leave in this post.

Read the rest…

Tags: , , , ,

Comments (1)

OpenGL in Haskell: GLFW-b Boilerplate

Haskell is turning out to be a great match for OpenGL. Since we can offload a lot of the rendering to shader code, we can use mostly pure Haskell functions to update the game or simulation in response to user input. Over a few blog posts, I’m going to outline how I’ve been using OpenGL in Haskell.

First, to use OpenGL we need a way to open a window, get a context, and respond to user input. There are several different cross-platform libraries to do this, but for simple projects I prefer GLFW. The Haskell package GLFW-b has bindings for GLFW and exposes a more Haskellish API than the regular GLFW package. Read the rest…

Tags: , ,

Comments (2)

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