[Haskell-beginners] Passing data between programs.

Mike Meyer mwm at mired.org
Tue Apr 12 06:45:10 CEST 2011

On Tue, 12 Apr 2011 00:45:57 -0300
MAN <elviotoccalino at gmail.com> wrote:

> I've had this problem for a while now, and it's about time I recognize I
> need help :P
> I've written a few programs in Haskell that excel at numeric and/or
> complex computations; I love the efficiency of the language. I do not
> love, however, writing GUIs for this pieces of software.
> Perhaps it's the echoes of bad times past when trying to install gtk2hs,
> or that I know I can crank up some decent UIs in other languages faster.
> Whatever the reason, I've been thinking of writing the GUI for my
> programs as an extension of the program itself, possibly in another
> language.
> Assuming the GUI is written in, say, Python, and want to pass data to
> the underlying Haskell program, how to send it? I'd like to avoid
> touching the disk, but I don't have enough experience to answer my own
> questions:
> - command line arguments? what if data is large?

Pipes? At least on Unix. One of the two halves of the program starts
the other, with standard input & output for the child going to/from
the parent.

> - client GUI, server Haskell program, and unix sockets? is there a
> simpler way?

These days, pipes seem to be built on top of/using the same
architecture as sockets, so the difference between this and my pipes
suggestion is that the pipes doesn't have to deal with rendezvous

Come to think of it, Joel Bartlett at DECWRL had a system called ezd
that looked a lot like this, except he did it the other way around:
his server (written in Scheme) provided high-level (for the time)
graphics primitives whose interface was a pair of pipes. I played with
it some back in the day, and I recall it as pretty spiffy (especially
using Bartlett's Scheme compiler for the front end).

And the internet hasn't forgotten it! I found a copy of his WRL Tech
Report on it:

Mike Meyer <mwm at mired.org>		http://www.mired.org/consulting.html
Independent Software developer/SCM consultant, email for more information.

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org

More information about the Beginners mailing list