As I’ve found myself repeatedly writing a bit of code that looked vaguely like this:

get :: SomeArrow String (Maybe Thing)

foo :: [Thing] -> FooThing

. . .

getAToZ :: SomeArrow () (Maybe FooThing)
getAToZ = proc () ->
    do m_a <- get -< "a"
       m_b <- get -< "b"
       . . .
       m_z <- get -< "z"
       returnA -<
           do a <- m_a
              b <- m_b
              . . .
              z <- m_z
              return $ foo [a,b . . . z]

It seemed that there would have to be a way to automate this. So I wrote this MaybeArrow (careful, I’m still using 6.8.2 so it’s the old arrows with ‘pure’.). I know that there is already an ErrorArrow. But ErrorArrow as far as I can see requires ArrowChoice, and I’m not doing that. In the MaybeArrow, if an earlier computation throws a Nothing, then later computations are still allowed to perform side effects, although their outputs are snuffed, which is the behavior I want.

I would appreciate any constructive feedback.

If you’re wondering the use case has to do with waiting on several separate pieces of information to arrive from a server and combining them into one output message.

A New Dawn?

This is what I imagine a very cold (~2000K) red star might look like at sunrise. I’m not sure if it matters whether it is a red giant or red dwarf — the system tries to size the star semi-realistically according to the temperature of the star and the climate of the local planet, so it should have about the same apparent size either way. A blue star would always look very small, even though these stars are always giants, because if you were ever close enough that it looked big, it would just sterilize you.

The mysterious green object in the upper right corner is a cyborg planet killer. It’s really big and powerful, so don’t **** it off.

Red Giant Sunrise

In other news, for my United Statesian readers, it’s election day! All you have to do is show up, wait in line a little while, and draw a little line to the right arrowhead, or pull a lever or however it’s done in your state. Try not to **** it up. Unless you have electronic voting machines, in which case the cyborgs will take care of it, so don’t bother.

If you have astrophysics brains and don’t mind feeding them to my zombie code monkey, maybe I can make more realistic stars?

Good Morning Planet Haskell

Here’s something I’ve been spending waaaay too much time on, but I wasn’t happy with the results the first try, or the second try, or the third try and . . . I can be very stubborn.

Encephalon at Dawn

This is actually very low resolution. It uses a simple media ray tracer that can handle some common atmosphere models. The tracer runs in a background thread and the result is just pasted onto a sky sphere.

More shots as I refine the lighting.

ANN: Roguestar 0.2

darcs 2: darcs get –lazy

After much delay, I’m happy to announce Roguestar 0.2.

Roguestar is a science fiction themed roguelike (turn-based,
chessboard-tiled, role playing) game written in Haskell. Roguestar uses
OpenGL for graphics. This is still a very early release and several
important things don’t work.

This initial release allows you to play one of six alien races. You begin
the game stranded on an alien planet, fighting off an endless hoard of
hostile robots.

RSAGL, the RogueStar Animation and Graphics Library, includes a
domain-specific monad for 3D modelling of arbitrary parametric surfaces,
as well as an animation monad and arrow, which is more or less like YAMPA
as a stack of arrow transformers. RSAGL was specifically designed for
roguestar, but every effort has been made (including the license) to make
it accessable to other projects that might benefit from it. Performance
is an issue, but there is a lot of low-hanging fruit in this area.

Roguestar is released under the Affero General Public License version 3.
However, RSAGL uses a permissive license.

I would be absolutely thrilled to receive any feedback anyone may have on
the design and aesthetics of the game, especially in the form of source