
Hi guys. Here's a fairly basic question. I have several ideas for programs that I'd like to write. They all involve placing "units" of some kind, and then drawing "connections" between those units. How feasible is it to program such a thing in Haskell? Where would you start? (Gtk2hs is the only graphics API I'm familiar with using at present.)

On Dec 7, 2007 1:50 PM, Andrew Coppin
Hi guys.
Here's a fairly basic question. I have several ideas for programs that I'd like to write. They all involve placing "units" of some kind, and then drawing "connections" between those units. How feasible is it to program such a thing in Haskell? Where would you start? (Gtk2hs is the only graphics API I'm familiar with using at present.)
Do you need to update positions of the units in real time? Do they even evolve over time, or are you just trying to visualise? If it's the latter, you might just take a collection of units and connections between them, output them in the graphviz [0] format, and see the resulting drawing. Graphviz is for visualising arbitrary graphs, and it's quite good at it. If you're thinking of writing games, then this suggestion likely won't help; but you didn't specify anything about real-time update, so I thought I'd mention it. -- Denis [0] http://www.graphviz.org/

Denis Bueno wrote:
On Dec 7, 2007 1:50 PM, Andrew Coppin
wrote: Hi guys.
Here's a fairly basic question. I have several ideas for programs that I'd like to write. They all involve placing "units" of some kind, and then drawing "connections" between those units. How feasible is it to program such a thing in Haskell? Where would you start? (Gtk2hs is the only graphics API I'm familiar with using at present.)
A bit off-topic for this list, but seeing as I'm replying anyway, I've done something like that with SVG and Javascript: http://www.blurty.com/users/claudiusmaximus/day/2007/10/03#419 I imagine (having never used it) Gtk has similar ways to bind "event listeners" to "graphical elements" to implement drag and drop type stuff, and it will most likely be much less error-prone than Javascript (I still haven't got the drag and drop right in Graphgrow...).
Do you need to update positions of the units in real time? Do they even evolve over time, or are you just trying to visualise?
If it's the latter, you might just take a collection of units and connections between them, output them in the graphviz [0] format, and see the resulting drawing. Graphviz is for visualising arbitrary graphs, and it's quite good at it.
Coincidentally I tried this the other day: http://www.blurty.com/users/claudiusmaximus/day/2007/12/06#426 Claude -- http://claudiusmaximus.goto10.org

Claude Heiland-Allen wrote:
A bit off-topic for this list, but seeing as I'm replying anyway, I've done something like that with SVG and Javascript:
http://www.blurty.com/users/claudiusmaximus/day/2007/10/03#419
Woah! Damn, that must have taken quite a while...
I imagine (having never used it) Gtk has similar ways to bind "event listeners" to "graphical elements" to implement drag and drop type stuff, and it will most likely be much less error-prone than Javascript (I still haven't got the drag and drop right in Graphgrow...).
I imagine it would be possible to do this with Gtk2hs - in the same way that it's "possible" to evaluate any computable function in any Turing-complete programming language. It doesn't look especially "simple" or "easy" though. Does anybody know of a better way?

Denis Bueno wrote:
Do you need to update positions of the units in real time? Do they even evolve over time, or are you just trying to visualise?
If it's the latter, you might just take a collection of units and connections between them, output them in the graphviz [0] format, and see the resulting drawing. Graphviz is for visualising arbitrary graphs, and it's quite good at it.
If you're thinking of writing games, then this suggestion likely won't help; but you didn't specify anything about real-time update, so I thought I'd mention it.
Well, for starters, take a look at KLogic. It's a nice program, but it has two small problems: 1. Sometimes it produces outright incorrect results. 2. It crashes with extreme frequency. I'd like to write a similar program in Haskell that does not have these properties. Of course, simulating a bunch of logic gates is a pretty trivial programming task. All the difficulty is in making a usable UI. I have ideas for several other programs which would require more or less the same kind of UI - you add things to the screen and wire them up. The things in question are different. But it's still things that need wiring up. I was wondering if any tools already exist to tackle this kind of thing...?

Andrew Coppin wrote:
Well, for starters, take a look at KLogic.
http://alts.homelinux.net/shots/195-0.jpg This is the kind of thing I'd like to end up with.

On Dec 8, 2007 8:19 PM, Andrew Coppin
Andrew Coppin wrote:
Well, for starters, take a look at KLogic.
http://alts.homelinux.net/shots/195-0.jpg
This is the kind of thing I'd like to end up with.
Such a GUI would also be cool for visually programming Functional Reactive Programming systems using yampa, by connecting Signal Transformers using the arrow combinators. It would be a glorified version of the arrow "do" notation syntax.

Bit Connor wrote:
On Dec 8, 2007 8:19 PM, Andrew Coppin
wrote: http://alts.homelinux.net/shots/195-0.jpg This is the kind of thing I'd like to end up with.
Such a GUI would also be cool for visually programming Functional Reactive Programming systems using yampa, by connecting Signal Transformers using the arrow combinators. It would be a glorified version of the arrow "do" notation syntax.
Such a GUI would be cool for a number of projects. It still needs to exist first. ;-)

On Dec 8, 2007 10:15 PM, Andrew Coppin
Bit Connor wrote:
On Dec 8, 2007 8:19 PM, Andrew Coppin
wrote: http://alts.homelinux.net/shots/195-0.jpg This is the kind of thing I'd like to end up with.
Such a GUI would also be cool for visually programming Functional Reactive Programming systems using yampa, by connecting Signal Transformers using the arrow combinators. It would be a glorified version of the arrow "do" notation syntax.
Such a GUI would be cool for a number of projects. It still needs to exist first. ;-)
What about Gnome Canvas? It's a widget for Gtk+. I don't think there are haskell bindings for it. Gtk2hs already has bindings to a number of gtk/gnome extensions... maybe Gnome Canvas can be next on the list? Here are screenshots: http://gstreamer.freedesktop.org/data/images/gst-editor/gst-editor-0.4.1.png http://gstreamer.freedesktop.org/data/images/gst-editor/gst-editor-ambisonic... Peace, Bit

Bit Connor wrote:
On Dec 8, 2007 10:15 PM, Andrew Coppin
wrote: Bit Connor wrote:
On Dec 8, 2007 8:19 PM, Andrew Coppin
wrote: http://alts.homelinux.net/shots/195-0.jpg This is the kind of thing I'd like to end up with.
Such a GUI would also be cool for visually programming Functional Reactive Programming systems using yampa, by connecting Signal Transformers using the arrow combinators. It would be a glorified version of the arrow "do" notation syntax.
Such a GUI would be cool for a number of projects. It still needs to exist first. ;-)
What about Gnome Canvas? It's a widget for Gtk+. I don't think there are haskell bindings for it. Gtk2hs already has bindings to a number of gtk/gnome extensions... maybe Gnome Canvas can be next on the list?
I'm told gnome canvas is deprecated? Gtk2Hs has some Cairo bindings though, which are capable of quite pretty stuff. Jules

Andrew Coppin wrote:
Such a GUI would be cool for a number of projects. It still needs to
exist first. ;-)
I don't think anyone has mentioned this: http://haskell.org/Blobs which I haven't used, though the screenshots look good.

On Sat, 8 Dec 2007, Bit Connor wrote:
On Dec 8, 2007 8:19 PM, Andrew Coppin
wrote: Andrew Coppin wrote:
Well, for starters, take a look at KLogic.
http://alts.homelinux.net/shots/195-0.jpg
This is the kind of thing I'd like to end up with.
Such a GUI would also be cool for visually programming Functional Reactive Programming systems using yampa, by connecting Signal Transformers using the arrow combinators. It would be a glorified version of the arrow "do" notation syntax.
Reminds me on http://www.haskell.org/pipermail/haskell-cafe/2007-August/030972.html

Andrew Coppin

Tom Davies wrote:
Andrew Coppin
writes: [snip]
You might like to look at OpenQuark: http://labs.businessobjects.com/cal/ -- its 'GemCutter' provides a visual environment for linking together functions written in a Haskell-like language.
I'm not sure if it would be flexible enough for you out of the box, but it's open source so you might be able to adapt it.
Looks interesting anyway... Thanks for the tip.
participants (8)
-
Andrew Coppin
-
Bit Connor
-
Claude Heiland-Allen
-
Denis Bueno
-
Henning Thielemann
-
Jules Bean
-
Tim Docker
-
Tom Davies