[Haskell-cafe] Elerea/GLFW Tetris

Patai Gergely patai_gergely at fastmail.fm
Sat Aug 15 17:12:05 EDT 2009


> Here is my first real program in Haskell. 
How come you started out with playing around with FRP libraries right
away? It's a rather peculiar choice, I'd say.

> In fact, I'm not fully responsible because it's just an adapted
> version of a Tetris Creighton Hogg had written for Reactive/GLUT. 
> As the first version, it's a very simple game (no levels, no
> points ...) but it's playable !
It's an interesting exercise, and quite a nice job from someone who
considers themselves a beginner.

One thing I don't really understand is why you packed up those
applicative combinators in a SignalMonad, i.e. the reason behind flat
and sf_sa. You have much more freedom in using them as they are, since
they can appear inside any expression. For instance, you could just say
the following in the let declaration:

sfall = (uncurry . fall) <$> randomBehavior seed
sid = pure id

Or even better, since both sfall and sid are created by pure
combinators, you don't even need to name them if they are used only once
anyway:

autumn = ifte metronome ((uncurry . fall) <$> randomBehavior seed) (pure
id)

Another thing, which is really a matter of taste, is that you seem to
like point-free style acrobatics. I don't think it's always the best
choice, especially if you are to share code with others, since most
people grok code with explicit parameters easier than magic involving
flip and const and (un)curry and the like, except for the obvious cases
of composing a chain of operations, where dropping arguments feels quite
natural. For instance, the definition of f_a looks problematic to me
because of these concerns.

Gergely

-- 
http://www.fastmail.fm - Same, same, but different...



More information about the Haskell-Cafe mailing list