
I have to write a "simple" GUI that plot some timeseries with a few parameterization (dates, times and so on...). The task should be simple, but I'm find using the GTK binding quite weird. I'm surprised that nothing better exists for GUI programming in haskell. I read a few about FRP but AFAIK it doesn't adress simple desktop UI full of input to validate and grid/tree to show. Any suggestion? I've already read the pages on Hackage without much success. At least, can someone point me to the right direction for the codebase organization? Giacomo

Did you try this:
http://en.m.wikibooks.org/wiki/Haskell/GUI
I hope it helps.
Tim
On Jun 9, 2013, at 10:22 AM, Giacomo Tesio
I have to write a "simple" GUI that plot some timeseries with a few parameterization (dates, times and so on...). The task should be simple, but I'm find using the GTK binding quite weird.
I'm surprised that nothing better exists for GUI programming in haskell. I read a few about FRP but AFAIK it doesn't adress simple desktop UI full of input to validate and grid/tree to show.
Any suggestion? I've already read the pages on Hackage without much success. At least, can someone point me to the right direction for the codebase organization?
Giacomo _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners

Thanks, but no, it doesn't help... I have to stick with GTK.
Most of the GUI examples I saw are toy programs.
Leksah is a notable exception, but it's way too complex to be a useful
learning tool.
In OO languages, I'm used to the MVP pattern which helps to organize the
code.
But I'm finding so complex building GUI in haskell that I'm starting to
think that it's not a good choice for such task.
Giacomo
On Mon, Jun 10, 2013 at 2:52 AM, Tim Perry
Did you try this: http://en.m.wikibooks.org/wiki/Haskell/GUI
I hope it helps. Tim
On Jun 9, 2013, at 10:22 AM, Giacomo Tesio
wrote: I have to write a "simple" GUI that plot some timeseries with a few parameterization (dates, times and so on...). The task should be simple, but I'm find using the GTK binding quite weird.
I'm surprised that nothing better exists for GUI programming in haskell. I read a few about FRP but AFAIK it doesn't adress simple desktop UI full of input to validate and grid/tree to show.
Any suggestion? I've already read the pages on Hackage without much success. At least, can someone point me to the right direction for the codebase organization?
Giacomo
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners

If you want a bit more complex GTK programs you can look at these:
https://github.com/Tener/spike -- web browser
https://github.com/Tener/sheep-transfer -- local network file sharing
However, I'm *not* satisfied by the current state of GUI programming in
Haskell. Both programs above are using GTK just because there is nothing
better. GTK is a pain to install on Windows too.
On Mon, Jun 10, 2013 at 10:58 AM, Giacomo Tesio
Thanks, but no, it doesn't help... I have to stick with GTK.
Most of the GUI examples I saw are toy programs. Leksah is a notable exception, but it's way too complex to be a useful learning tool.
In OO languages, I'm used to the MVP pattern which helps to organize the code. But I'm finding so complex building GUI in haskell that I'm starting to think that it's not a good choice for such task.
Giacomo
On Mon, Jun 10, 2013 at 2:52 AM, Tim Perry
wrote: Did you try this: http://en.m.wikibooks.org/wiki/Haskell/GUI
I hope it helps. Tim
On Jun 9, 2013, at 10:22 AM, Giacomo Tesio
wrote: I have to write a "simple" GUI that plot some timeseries with a few parameterization (dates, times and so on...). The task should be simple, but I'm find using the GTK binding quite weird.
I'm surprised that nothing better exists for GUI programming in haskell. I read a few about FRP but AFAIK it doesn't adress simple desktop UI full of input to validate and grid/tree to show.
Any suggestion? I've already read the pages on Hackage without much success. At least, can someone point me to the right direction for the codebase organization?
Giacomo
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners

This is the point: in
https://github.com/Tener/sheep-transfer/blob/master/src/sheep-gtk.hs the
main function requires 196 lines!
How can this be acceptable? GTK is a good toolkit by itself. As far as I
can see, the problem here is haskell: I can't see how I can build a simple,
basic MVP framework on top of gtk2hs.
Probably I've finally found something relevant at which Haskell sucks.
Still I can't understand how haskellers code GUI when they really need to.
Do they use another language and interact with haskell programs via pipes?
Giacomo
On Mon, Jun 10, 2013 at 11:17 AM, Krzysztof Skrzętnicki
If you want a bit more complex GTK programs you can look at these:
https://github.com/Tener/spike -- web browser https://github.com/Tener/sheep-transfer -- local network file sharing
However, I'm *not* satisfied by the current state of GUI programming in Haskell. Both programs above are using GTK just because there is nothing better. GTK is a pain to install on Windows too.
On Mon, Jun 10, 2013 at 10:58 AM, Giacomo Tesio
wrote: Thanks, but no, it doesn't help... I have to stick with GTK.
Most of the GUI examples I saw are toy programs. Leksah is a notable exception, but it's way too complex to be a useful learning tool.
In OO languages, I'm used to the MVP pattern which helps to organize the code. But I'm finding so complex building GUI in haskell that I'm starting to think that it's not a good choice for such task.
Giacomo
On Mon, Jun 10, 2013 at 2:52 AM, Tim Perry
wrote: Did you try this: http://en.m.wikibooks.org/wiki/Haskell/GUI
I hope it helps. Tim
On Jun 9, 2013, at 10:22 AM, Giacomo Tesio
wrote: I have to write a "simple" GUI that plot some timeseries with a few parameterization (dates, times and so on...). The task should be simple, but I'm find using the GTK binding quite weird.
I'm surprised that nothing better exists for GUI programming in haskell. I read a few about FRP but AFAIK it doesn't adress simple desktop UI full of input to validate and grid/tree to show.
Any suggestion? I've already read the pages on Hackage without much success. At least, can someone point me to the right direction for the codebase organization?
Giacomo
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners

About this, I do not know the Haskell gtk bindings, but I know GTK.
In the example you gave it appears that the code builds the GUI by itself.
I think the code would be much more concise if it was using glade files
instead, which appears to be supported:
http://projects.haskell.org/gtk2hs/docs/tutorial/glade/
Probably with glade the code will be of acceptable verbosity.
For my own user interfaces otherwise I turned towards the web, even for
local applications (on port :8000).
Emmanuel
On Mon, Jun 10, 2013 at 12:00 PM, Giacomo Tesio
This is the point: in https://github.com/Tener/sheep-transfer/blob/master/src/sheep-gtk.hs the main function requires 196 lines!
How can this be acceptable? GTK is a good toolkit by itself. As far as I can see, the problem here is haskell: I can't see how I can build a simple, basic MVP framework on top of gtk2hs.
Probably I've finally found something relevant at which Haskell sucks. Still I can't understand how haskellers code GUI when they really need to. Do they use another language and interact with haskell programs via pipes?
Giacomo
On Mon, Jun 10, 2013 at 11:17 AM, Krzysztof Skrzętnicki
wrote: If you want a bit more complex GTK programs you can look at these:
https://github.com/Tener/spike -- web browser https://github.com/Tener/sheep-transfer -- local network file sharing
However, I'm *not* satisfied by the current state of GUI programming in Haskell. Both programs above are using GTK just because there is nothing better. GTK is a pain to install on Windows too.
On Mon, Jun 10, 2013 at 10:58 AM, Giacomo Tesio
wrote: Thanks, but no, it doesn't help... I have to stick with GTK.
Most of the GUI examples I saw are toy programs. Leksah is a notable exception, but it's way too complex to be a useful learning tool.
In OO languages, I'm used to the MVP pattern which helps to organize the code. But I'm finding so complex building GUI in haskell that I'm starting to think that it's not a good choice for such task.
Giacomo
On Mon, Jun 10, 2013 at 2:52 AM, Tim Perry
wrote: Did you try this: http://en.m.wikibooks.org/wiki/Haskell/GUI
I hope it helps. Tim
On Jun 9, 2013, at 10:22 AM, Giacomo Tesio
wrote: I have to write a "simple" GUI that plot some timeseries with a few parameterization (dates, times and so on...). The task should be simple, but I'm find using the GTK binding quite weird.
I'm surprised that nothing better exists for GUI programming in haskell. I read a few about FRP but AFAIK it doesn't adress simple desktop UI full of input to validate and grid/tree to show.
Any suggestion? I've already read the pages on Hackage without much success. At least, can someone point me to the right direction for the codebase organization?
Giacomo
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners

Yes, I'm using Glade.
Using web is an option, but for the particular UI I'm working on it's quite
wrong. And BTW, that's equivalent to using Javascript, instead of Haskell,
to code the GUI.
Giacomo
On Mon, Jun 10, 2013 at 12:06 PM, Emmanuel Touzery
About this, I do not know the Haskell gtk bindings, but I know GTK.
In the example you gave it appears that the code builds the GUI by itself.
I think the code would be much more concise if it was using glade files instead, which appears to be supported: http://projects.haskell.org/gtk2hs/docs/tutorial/glade/
Probably with glade the code will be of acceptable verbosity.
For my own user interfaces otherwise I turned towards the web, even for local applications (on port :8000).
Emmanuel
On Mon, Jun 10, 2013 at 12:00 PM, Giacomo Tesio
wrote: This is the point: in https://github.com/Tener/sheep-transfer/blob/master/src/sheep-gtk.hs the main function requires 196 lines!
How can this be acceptable? GTK is a good toolkit by itself. As far as I can see, the problem here is haskell: I can't see how I can build a simple, basic MVP framework on top of gtk2hs.
Probably I've finally found something relevant at which Haskell sucks. Still I can't understand how haskellers code GUI when they really need to. Do they use another language and interact with haskell programs via pipes?
Giacomo
On Mon, Jun 10, 2013 at 11:17 AM, Krzysztof Skrzętnicki
wrote:
If you want a bit more complex GTK programs you can look at these:
https://github.com/Tener/spike -- web browser https://github.com/Tener/sheep-transfer -- local network file sharing
However, I'm *not* satisfied by the current state of GUI programming in Haskell. Both programs above are using GTK just because there is nothing better. GTK is a pain to install on Windows too.
On Mon, Jun 10, 2013 at 10:58 AM, Giacomo Tesio
wrote: Thanks, but no, it doesn't help... I have to stick with GTK.
Most of the GUI examples I saw are toy programs. Leksah is a notable exception, but it's way too complex to be a useful learning tool.
In OO languages, I'm used to the MVP pattern which helps to organize the code. But I'm finding so complex building GUI in haskell that I'm starting to think that it's not a good choice for such task.
Giacomo
On Mon, Jun 10, 2013 at 2:52 AM, Tim Perry
wrote: Did you try this: http://en.m.wikibooks.org/wiki/Haskell/GUI
I hope it helps. Tim
On Jun 9, 2013, at 10:22 AM, Giacomo Tesio
wrote: I have to write a "simple" GUI that plot some timeseries with a few parameterization (dates, times and so on...). The task should be simple, but I'm find using the GTK binding quite weird.
I'm surprised that nothing better exists for GUI programming in haskell. I read a few about FRP but AFAIK it doesn't adress simple desktop UI full of input to validate and grid/tree to show.
Any suggestion? I've already read the pages on Hackage without much success. At least, can someone point me to the right direction for the codebase organization?
Giacomo
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners

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.
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?
On Mon, Jun 10, 2013 at 12:00 PM, Giacomo Tesio
This is the point: in https://github.com/Tener/sheep-transfer/blob/master/src/sheep-gtk.hs the main function requires 196 lines!
How can this be acceptable? GTK is a good toolkit by itself. As far as I can see, the problem here is haskell: I can't see how I can build a simple, basic MVP framework on top of gtk2hs.
Probably I've finally found something relevant at which Haskell sucks. Still I can't understand how haskellers code GUI when they really need to. Do they use another language and interact with haskell programs via pipes?
Giacomo
On Mon, Jun 10, 2013 at 11:17 AM, Krzysztof Skrzętnicki
wrote: If you want a bit more complex GTK programs you can look at these:
https://github.com/Tener/spike -- web browser https://github.com/Tener/sheep-transfer -- local network file sharing
However, I'm *not* satisfied by the current state of GUI programming in Haskell. Both programs above are using GTK just because there is nothing better. GTK is a pain to install on Windows too.
On Mon, Jun 10, 2013 at 10:58 AM, Giacomo Tesio
wrote: Thanks, but no, it doesn't help... I have to stick with GTK.
Most of the GUI examples I saw are toy programs. Leksah is a notable exception, but it's way too complex to be a useful learning tool.
In OO languages, I'm used to the MVP pattern which helps to organize the code. But I'm finding so complex building GUI in haskell that I'm starting to think that it's not a good choice for such task.
Giacomo
On Mon, Jun 10, 2013 at 2:52 AM, Tim Perry
wrote: Did you try this: http://en.m.wikibooks.org/wiki/Haskell/GUI
I hope it helps. Tim
On Jun 9, 2013, at 10:22 AM, Giacomo Tesio
wrote: I have to write a "simple" GUI that plot some timeseries with a few parameterization (dates, times and so on...). The task should be simple, but I'm find using the GTK binding quite weird.
I'm surprised that nothing better exists for GUI programming in haskell. I read a few about FRP but AFAIK it doesn't adress simple desktop UI full of input to validate and grid/tree to show.
Any suggestion? I've already read the pages on Hackage without much success. At least, can someone point me to the right direction for the codebase organization?
Giacomo
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners

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

I have to write a "simple" GUI that plot some timeseries with a few
Giacomo Tesio
I'm surprised that nothing better exists for GUI programming in haskell. I
read a few about FRP but AFAIK it doesn't adress simple desktop UI full of input to validate and grid/tree to show.
Any suggestion? I've already read the pages on Hackage without much success. At least, can someone point me to the right direction for the codebase
organization? Why did FRP not work for you? You could try reactive-banana[1], which has specific support for GUI. If you want something closer to MVP, binding-gtk[2][3] might help. If you post more details about your application, someone may be able to suggest a better way of structuring it. MVP originates from OO, and OO-centric patterns are usually not the best way to go about something in Haskell. [1] http://www.haskell.org/haskellwiki/Reactive-banana [2] http://code.accursoft.com/binding [3] http://hackage.haskell.org/package/binding-gtk

What I'm looking for is a framework that help me to
1) design composable UI abstractions suited to my application needs (eg, a
*CustomerSelector*): let's call these views
2) connect such abstractions to actual implementations (GTK, Wx or anything
else)
3) send userActions to Presenters (one for each view) so that they can
handle them operating with a pure domain model and sending back to views
updates
This is not that complex to achieve in OOP, but I can't see HOW to build an
even basic framework that give me this.
Actually, that's probably my fault.
Giacomo
On Mon, Jun 10, 2013 at 12:53 PM, harry
Giacomo Tesio
writes: I have to write a "simple" GUI that plot some timeseries with a few parameterization (dates, times and so on...). The task should be simple, but I'm find using the GTK binding quite weird.
I'm surprised that nothing better exists for GUI programming in haskell. I read a few about FRP but AFAIK it doesn't adress simple desktop UI full of input to validate and grid/tree to show.
Any suggestion? I've already read the pages on Hackage without much success. At least, can someone point me to the right direction for the codebase organization?
Why did FRP not work for you? You could try reactive-banana[1], which has specific support for GUI. If you want something closer to MVP, binding-gtk[2][3] might help.
If you post more details about your application, someone may be able to suggest a better way of structuring it. MVP originates from OO, and OO-centric patterns are usually not the best way to go about something in Haskell.
[1] http://www.haskell.org/haskellwiki/Reactive-banana [2] http://code.accursoft.com/binding [3] http://hackage.haskell.org/package/binding-gtk
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners

There have been some higher level systems that abstract over lower level
bindings (e.g. Fruit / WxFruit, the port of Clean's ObjectIO...), but they
seem to lose traction and suffer from bit-rot.
At the moment I wouldn't know what the best option is.
On 10 June 2013 14:50, Giacomo Tesio
This is not that complex to achieve in OOP, but I can't see HOW to build an even basic framework that give me this. Actually, that's probably my fault.
participants (6)
-
Emmanuel Touzery
-
Giacomo Tesio
-
harry
-
Krzysztof Skrzętnicki
-
Stephen Tetley
-
Tim Perry