
I want to choose a GUI library for my project. Some background: I'm a beginner to functional programming and have been working through Haskell books for a few months now. I'm not just learning Haskell for s**ts and giggles; my purpose is to write music-composition-related code; in particular, I want to write a graphical musical score editor. (Why write my own editor, you may ask? Because I want to fully integrate it with computer-assisted-composition algorithms that I plan to write, also in Haskell.) I decided to use Haskell for its great features as a functional programming language. Regarding a choice of GUI library, I want these factors: - it needs to provide at a minimum a drawing surface, a place I can draw lines and insert characters, in addition to all the standard widgets and layout capabilities we have to come to expect from a GUI library. - This is a Windows application. - it needs to be non-confusing for an intermediate-beginner Haskeller. Hopefully good documentation and examples will exist on the web. - It might be nice to have advanced graphics capability such as Qt provides, things like antialiasied shapes, and a canvas with efficient refresh (refereshes only the area that was exposed, and if your canvas items are only primitives, it can do refreshes from within C++ (no need to touch your Haskell code at all). However I'm wondering if qtHaskell fits my criteria "well-documented" and "lots of examples aimed at beginners". Thanks, Mike

On Sat, Aug 29, 2009 at 8:03 AM, Michael Mossey
I want to choose a GUI library for my project. Some background: I'm a beginner to functional programming and have been working through Haskell books for a few months now. I'm not just learning Haskell for s**ts and giggles; my purpose is to write music-composition-related code; in particular, I want to write a graphical musical score editor. (Why write my own editor, you may ask? Because I want to fully integrate it with computer-assisted-composition algorithms that I plan to write, also in Haskell.) I decided to use Haskell for its great features as a functional programming language.
Regarding a choice of GUI library, I want these factors:
- it needs to provide at a minimum a drawing surface, a place I can draw lines and insert characters, in addition to all the standard widgets and layout capabilities we have to come to expect from a GUI library.
- This is a Windows application.
- it needs to be non-confusing for an intermediate-beginner Haskeller. Hopefully good documentation and examples will exist on the web.
- It might be nice to have advanced graphics capability such as Qt provides, things like antialiasied shapes, and a canvas with efficient refresh (refereshes only the area that was exposed, and if your canvas items are only primitives, it can do refreshes from within C++ (no need to touch your Haskell code at all). However I'm wondering if qtHaskell fits my criteria "well-documented" and "lots of examples aimed at beginners".
I've never used it myself, but if you're going to be drawing a lot perhaps cairo is right for you? http://cairographics.org/hscairo/ I suspect you'll have to be "self-taught" here. Gtk2Hs and WxHaskell are probably the most mature gui libs for Haskell. Yet with either one you may end up dropping down into GDI/GDI+ or opengl on windows to get what you want. GDI/GDI+ is confusing in any language, but good books/resources do exist. So perhaps the trick here is to translate good documentation from other languages/sources into Haskell examples. You could do this as a warm up exercise before starting on your music editor. Jason

Jason Dagit wrote:
I've never used it myself, but if you're going to be drawing a lot perhaps cairo is right for you? http://cairographics.org/hscairo/
I suspect you'll have to be "self-taught" here. Gtk2Hs and WxHaskell are probably the most mature gui libs for Haskell. Yet with either one you may end up dropping down into GDI/GDI+ or opengl on windows to get what you want. GDI/GDI+ is confusing in any language, but good books/resources do exist. So perhaps the trick here is to translate good documentation from other languages/sources into Haskell examples. You could do this as a warm up exercise before starting on your music editor.
Jason
Thanks, Jason. My drawing needs are pretty rudimentary. A music editor doesn't need much more than the ability to draw lines and characters. A nice addition would be antialiased curves such as Qt offers but that is optional. A so-called "canvas" sometimes offers optimized drawing updates, so the editor doesn't have to redraw the entire page if one portion of it changes. That is not strictly necessary, and in fact it wouldn't be hard to implement a bit of that functionality myself. -Mike

On Sat, 29 Aug 2009, Michael Mossey wrote:
I want to choose a GUI library for my project. Some background: I'm a beginner to functional programming and have been working through Haskell books for a few months now. I'm not just learning Haskell for s**ts and giggles; my purpose is to write music-composition-related code; in particular, I want to write a graphical musical score editor. (Why write my own editor, you may ask? Because I want to fully integrate it with computer-assisted-composition algorithms that I plan to write, also in Haskell.)
Nice to know. Things in this direction are also implemented in http://hackage.haskell.org/package/haskore You find a lot about music programmed in Haskell in http://www.haskell.org/haskellwiki/Category:Music and in the haskell-art mailing list: http://lists.lurk.org/mailman/listinfo/haskell-art So, good luck with your GUI based music editor!

I recommend qtHaskell.
I am a big fan of Qt in general. It has good documentation and extensive
examples, is very well designed, and has a good license. I'd even say the
C++ version is good choice for beginners (certainly easier to understand/use
than say GTK).
The qtHaskell bindings are also pretty good. The documentation and examples
are not as extensive, but you can usually use the C++ documentation to fill
in the gaps.
Being already familiar with C++ Qt, using qtHaskell was a snap. However, if
you're unfamiliar with both Qt and Haskell it will probably be confusing at
first. Though I'd bet money the GTK bindings aren't any better in that
regard.
I'd still say you'd be more productive with qtHaskell in the long run.
- Job
On Sat, Aug 29, 2009 at 11:03 AM, Michael Mossey
I want to choose a GUI library for my project. Some background: I'm a beginner to functional programming and have been working through Haskell books for a few months now. I'm not just learning Haskell for s**ts and giggles; my purpose is to write music-composition-related code; in particular, I want to write a graphical musical score editor. (Why write my own editor, you may ask? Because I want to fully integrate it with computer-assisted-composition algorithms that I plan to write, also in Haskell.) I decided to use Haskell for its great features as a functional programming language.
Regarding a choice of GUI library, I want these factors:
- it needs to provide at a minimum a drawing surface, a place I can draw lines and insert characters, in addition to all the standard widgets and layout capabilities we have to come to expect from a GUI library.
- This is a Windows application.
- it needs to be non-confusing for an intermediate-beginner Haskeller. Hopefully good documentation and examples will exist on the web.
- It might be nice to have advanced graphics capability such as Qt provides, things like antialiasied shapes, and a canvas with efficient refresh (refereshes only the area that was exposed, and if your canvas items are only primitives, it can do refreshes from within C++ (no need to touch your Haskell code at all). However I'm wondering if qtHaskell fits my criteria "well-documented" and "lots of examples aimed at beginners".
Thanks, Mike _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Hello Job, Tuesday, September 1, 2009, 1:16:38 AM, you wrote:
I recommend qtHaskell.
how it's in areas of - memory deallocation when it's no more need - is it automatic or manual? - unicode support - compatibiliy with latest ghc versions - does it build by Cabal or we need to wait while gurus release installers for Windows? - does it use native GUI controls on Windows or draws them itself? i'm asking because those questions arise when using other libs -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com

Deallocation is automatic (just like C++ Qt)
C++ Qt has excellent unicode support. I haven't explicit tried it in
qtHaskell, but as far as I know it should work just fine.
Unfortunatly it does not currently build just with cabal, however the build
scripts are very clean (no configure) and the haskell half is cabalized.
To build on windows you only need the haskell platform and the Qt SDK
(and then you either have to put the ghc path into Qts qtEnv.bat (what I
did), or you have to put the Qt paths into the system path) and then you run
the qtHaskells build.bat and you're done.
To build on linux you need the haskell platform and Qt4 dev libraries
(they are probably in your distros package manager) and then you run the
qtHaskells build script, and your done. Umm, with one gotcha, on my system I
had to replace two instances of 'gmake' in the build script with 'make'. You
might not have to do that on your system.
Qt uses the native APIs to draw controls, so your apps look appropriate on
different platforms.
- Job
On Tue, Sep 1, 2009 at 12:43 AM, Bulat Ziganshin
Hello Job,
Tuesday, September 1, 2009, 1:16:38 AM, you wrote:
I recommend qtHaskell.
how it's in areas of - memory deallocation when it's no more need - is it automatic or manual? - unicode support - compatibiliy with latest ghc versions - does it build by Cabal or we need to wait while gurus release installers for Windows? - does it use native GUI controls on Windows or draws them itself?
i'm asking because those questions arise when using other libs
-- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com
participants (5)
-
Bulat Ziganshin
-
Henning Thielemann
-
Jason Dagit
-
Job Vranish
-
Michael Mossey