
On Mon, Jun 10, 2013 at 12:47 PM, Krzysztof Skrzętnicki
Well, this is just a matter of refactoring some stuff here. You can notice that most work is defining several small callbacks so its not really that complex. I tend to use that style of nested let's because it saves the time: no need to write boilerplate parameter passing, just use what is defined in scope. If you cut out callbacks and GUI code you are left with literally 8 non-empty lines. Its not that bad for a main.
Don't get me wrong, I appreciated your suggestion. But I can't see how to apply that code organization to my own project.
Honestly I don't see why do you think Haskell sucks here. This is just plain GTK. If anything it is better with Haskell thanks to static typing, higher order functions, great runtime with GC and other stuff. Equivalent application in plain C would be much longer and carry more bugs, and Python GTK apps are a mess really.
Can you actually point to any GTK MVP framework out there?
In C# I coded a very simple one in few hours (and a more powerful one in a month). MVP isn't that complex pattern, indeed. I use it to organize code: View specific concerns (that know about the specific toolkit, GTK, WinForm etc), a Model that handle business rules and a Presenter that is an adapter between the two. Python could be a valid alternative, btw: I'm writing a "simple" plotting application for financial data and matplotlib is quite flexible. But since I've found very nice coding the business logic in Haskell, I was trying to rapidly build a GUI with it. Giacomo