Re: [Haskell-cafe] Elerea/GLFW Tetris

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...

How come you started out with playing around with FRP libraries right away? It's a rather peculiar choice, I'd say.
I'm always curious about how the languages I study interact with OpenGL because I'm in the numerical simulation. When I came to Haskell on December, it was quite a new sensation at the functional level first (I knew Scheme but I never tried to find out how Scheme could interact with OpenGL!) and also about IO. But I liked it (and running). Then I studied Reactive but I had some problems installing it on Linux GHC6.6 so I was looking another library and I saw your post on March I think. But my knowledge about Haskell was too light at this time. Then I studied more and here I am!
It's an interesting exercise, and quite a nice job from someone who considers themselves a beginner.
thanks, it took me a few days but as I said it was floating in my head for a few months.
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
yes, I saw sfall too late (however I haven't thought about sid, thanks)
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.
I agree with you in general (point-free is unreadable), but in the case of f_a particularly, it took me a long time (not as long as for sf_a, however) to design it (not the point-free version but the raw one) and I think the point-free version is the best way to dissuade anyone to try to hack it and to persuade her to write a new function which fits her needs. It is actually the reason why I called f_a like this : because its two arguments are a function and a non-function argument (the first argument of sf_a is of course a signal of a function). This means I don't want to know how the machine works when I write my program. But it's a matter of taste as you said.
participants (2)
-
jean legrand
-
Patai Gergely