Linked by Amjith Ramanujam on Fri 19th Sep 2008 21:00 UTC, submitted by Ward D
Thread beginning with comment 331315
To view parent comment, click here.
To read all comments associated with this story, please click here.
To view parent comment, click here.
To read all comments associated with this story, please click here.





Member since:
2008-09-24
Actually, you're dead wrong. Model-view-controller is not only easy in Haskell, much of the design is enforced! Typically, the model will consist primarily of pure functions, in your case, some pure functions manipulating a tree of nodes. The view and controller, on the other hand, will (at least in part), be in the IO monad, since they're required to do input and output. This gives you a lot of the required restrictions on how the model communicates with the view and controller for free.
Of course, there are details like how you're going to store the tree. You could possibly use a zipper (not necessarily a monad), if that suits your application, but also quite possibly a straightforward tree data structure will do. If the manipulations you're doing are very graph theoretic in nature, with lots of rewiring of edges, representing the tree as, say, a Data.Map from vertices to sets of vertices might work better. (More or less equivalent to using sets of pointers to build a mutable tree in a lower-level language.)
If you'd like help with a specific program, or more details about how this works, come and talk to me on IRC. I'm Cale in #haskell on freenode.irc.net. If I'm not there, someone else will be happy to help you, I'm sure.
Haskell is not a particularly difficult language to use, but it requires a little bit of mental rewiring in terms of the way you think about programming, which makes the learning curve steeper for those who are already intimately familiar with the imperative programming model.