Thursday, March 10, 2011

wumpus-basic

Copperbox revision 2195.

I've think I've updated AdvanceGraphic to work with the new Image types - as it needs Displacement to work I haven't been able to test it. The code is somewhat strange as I've had to build a special binding combinator for Images. Images cannot support return as there is no empty Primitive - images are like writer except they are a semigroup on the logging answer rather than a monoid. So while its possible to implement bind, it is not so useful as a combinator - it can only consume initial input, it can't reuse it. Thus I've had to make "opbind", which is essentially:

 opbind op gf fn = let a = run gf in let b = run (fn a) in a `op` b

Update - I've worked out a scheme to get back monadic return and bind by changing the representation of primitives in Wumpus-Basic to make them a monoid rather than a semigroup. However I won't implement it until I've changed Displacement and PosImage to use the new Image types.

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.