[Haskell-beginners] Passing data between programs.

Patrick LeBoutillier patrick.leboutillier at gmail.com
Wed Apr 13 03:13:31 CEST 2011


Hi,

Sometimes what I like to do is just make my backend program read
commands from stdin and answer  back on stdout.

That keeps it simple, plus it's easy to test the backend.

Then from the frontend you can start the backend using pipes as
described by Mike earlier. From Perl I would probably use something
like http://search.cpan.org/~rjbs/perl-5.12.3/ext/IPC-Open2/lib/IPC/Open2.pm,
there probably is something similar for Python.

Patrick


On Tue, Apr 12, 2011 at 11:35 AM, MAN <elviotoccalino at gmail.com> wrote:
> Pipes seem a bit better than sockets. I'm investigating the possibility
> right now. As I read about sockets I remembered there's Haskell bindings
> to DBus... has anybody used it? ever? (last update was over 4 years
> ago).
>
> El mar, 12-04-2011 a las 00:45 -0400, Mike Meyer escribió:
>> 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
>> issues.
>>
>> 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:
>> http://www.hpl.hp.com/techreports/Compaq-DEC/WRL-91-6.html
>>
>>        <mike
>
>
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>



-- 
=====================
Patrick LeBoutillier
Rosemère, Québec, Canada



More information about the Beginners mailing list