[Haskell-beginners] dismantling monolithic data structure

Michael Litchard michael at schmong.org
Wed May 22 18:24:23 CEST 2013


This is in reference to an ongoing project, whose latest problem was
articulated on stackoverflow:

http://stackoverflow.com/questions/16484322/functional-banana-traveller-timer-and-player-independent-events

While struggling with this problem, I realized the monlithlic style of
GameState did not fit the FRP
approach. This was also noticed by Heinrich, who advised me on steps to
take to fix that.
Here's a quote from StackOverflow I'd like to talk about.

"First, looking at your code, I find it odd that you have "outsourced" the
actual gameplay logic to the monolithic GameState type and the
updateGSfunction. Now, this is not a bad thing to do, it's just that
there is no
benefit from using FRP in this style. You can remove the
makeNetworkDescription function altogether and register an event handler
with addCommandEvent by hand instead."

He then goes on to offer some useful details that address the problem
articulated in the question, which also gives a general approach about how
to do this right.

But first thing is first, getting rid of makeNetworkDescription.

I'm trying to figure out how to register an event handler with
addCommandEvent by hand.
What functions and examples could I look at to get an idea of what to do?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20130522/599366f0/attachment.htm>


More information about the Beginners mailing list