[Haskell-cafe] bindings to the xmms_remote API, GList and something more

Andrea Rossato mailing_list at istitutocolli.org
Fri Sep 21 03:08:13 EDT 2007


I think there's a huge flaw in the Haskell design: if you conceive
such a powerful and expressive programming language, one that empowers
even the most ignorant computer user to write complex applications,
instead of sticking to basic shell scripting - the only domain
graspable by such stupid pseudo-coders -, well you end up with
messages like this one flooding the mailing list you are providing for
your users. This is what I call inevitability...

To make a short story long, I needed some client for the Audacious
media player, something I could use to remote control it and, since
I'm addicted to Haskell, instead of surfing the web to find a suitable
client I surfed the web to find the API documentation. With the FFI,
in a matter of half an hour I had the client with all the commands I

(The long introduction was written just to let you know that you'd
better not waste too much time with what follows...;-)

So far so good, but, since everything was so easy, I thought: "Why not
packaging a library (and the client) for Hackage? Maybe others may be
willing to use it, maybe..."

And then the problems start, problems due to my basic ignorance of the
C language ("How comes you dare to import in Haskell functions written
in a language you don't even understand?" you should replay!).

Basically there are two C types I'm having problem with:

1. GList: even though I read the gtk2hs code I do not exactly
   understand how to create a GList to feed to this function:

    void xmms_remote_playlist_add(gint session, GList * list);

    As far as I understand this function takes a session number and a
    list of files' names. Still I seem not to be able to create a
    wrapper function around the imported one.

2. what a "gchar ** list" is? As far as my C goes, it should be an array
   of strings, right? What should I use on the Haskell side, newArray?
   void xmms_remote_playlist(gint session, gchar ** list, gint num,
	                           gboolean enqueue);

3. c2hs v. hsc2hs? Which should I prefer? In c2hs I write {#pointer *
   GList#}. What is the equivalent in hsc2hs?

4. As I said, I solved my personal problem: I imported enough
   functions to create the client I needed. Releasing the library is
   just something I would like to do, to give something back to the
   Haskell community. So this is something useful if I can provide
   robust and well designed code. This is a name space question: what
   is the name of the exported module? Sound.XMMS, Sound.XmmsRemote?
   Is the some kind of convention I should be referring to?

Sorry if I was too long. Moreover I'm asking help I need just to
publish a piece of software that is probably useless. Do not waste
your time. But if you do, well... thank you, I really appreciate.


More information about the Haskell-Cafe mailing list