Tuesday, August 4, 2009

Wumpus

Copperbox revision 728.

I've changed the Picture type to be a Reader monad (not a Writer as the commit log says).

This allows sub-pictures to be accessed as Haskell variables within a monadic action (there's a new example Node.hs which draws an arrow between two points). Points are extracted in the current frame, which can make using them rather unintuitive. I'll have to look again how I'm using frames.

Although not much code actually needed changing* to use the new Picture type, changing it was very frustrating. My first attempt tried to collapse the Wumpus PostScript writer monad into the Picture type, and I then hit a stumbling block wondering if I could only extract positions with comonads or arrows. Even the eventual solution didn't work for quite a while as I often misjudged whether or not I was within the Writer type constructor. I got pretty close to calling it a day on Wumpus.



* Now that I have the usual plethora of monad and applicative combinators plenty of code will merit changing at some point.

Blog Archive

About Me

My photo
Disambiguating biog as there are a few Stephen Tetley's in the world. I'm neither a cage fighter or yachtsman. I studied Fine Art in the nineties (foundation Bradford 1992, degree Cheltenham 1992 - 95) then Computing part-time at Leeds Met graduating in 2003. I'm the Stephen Tetley on Haskell Cafe and Stackoverflow.