
I'm hacking a library for writing XMPP clients, and just decided that my work is good enough to call it version 0.0.1. Find source and documentation here: http://www.dtek.chalmers.se/~henoch/text/hsxmpp.html It contains a werewolf bot as an example. I wanted the bot to speak several languages, but I couldn't find any library that would make that easier, so I wrote one myself, in Translate.hs. Is there any other way to do that? What do other projects use? The library contains an event loop: it waits for data from the network, treats it as events and handles them. (the loop is in runXMPP in XMPPMonad.hs, and the actual waiting is in getString in TCPConnection.hs) I can imagine that it might be useful to integrate this in another event loop, e.g. to create a chat client with a GUI. Do you have any thoughts on whether and how to do that? Magnus

On Sun, Apr 08, 2007 at 02:03:03AM +0200, Magnus Henoch wrote:
I'm hacking a library for writing XMPP clients, and just decided that my work is good enough to call it version 0.0.1. Find source and documentation here:
Congrats, you are (at least) the third person to do this. Jeremy Shaw (stepcut): http://www.n-heptane.com/nhlab/repos/haskell-xmpp/ Dimitry Astopov (ADEpt): http://adept.linux.kiev.ua:1080/repos/xmpp
http://www.dtek.chalmers.se/~henoch/text/hsxmpp.html
It contains a werewolf bot as an example. I wanted the bot to speak several languages, but I couldn't find any library that would make that easier, so I wrote one myself, in Translate.hs. Is there any other way to do that? What do other projects use?
I don't know what werewolf is, but maybe you were looking for something like this: http://www.cse.unsw.edu.au/~dons/lambdabot/Plugin/Babel.hs
The library contains an event loop: it waits for data from the network, treats it as events and handles them. (the loop is in runXMPP in XMPPMonad.hs, and the actual waiting is in getString in TCPConnection.hs) I can imagine that it might be useful to integrate this in another event loop, e.g. to create a chat client with a GUI. Do you have any thoughts on whether and how to do that?
The best way to do that is with select(2), known in Haskell as forkIO. Stefan

On Sat, Apr 07, 2007 at 06:34:21PM -0700, Stefan O'Rear wrote:
On Sun, Apr 08, 2007 at 02:03:03AM +0200, Magnus Henoch wrote:
I'm hacking a library for writing XMPP clients, and just decided that my work is good enough to call it version 0.0.1. Find source and documentation here:
Congrats, you are (at least) the third person to do this.
Jeremy Shaw (stepcut): http://www.n-heptane.com/nhlab/repos/haskell-xmpp/
Dimitry Astopov (ADEpt): http://adept.linux.kiev.ua:1080/repos/xmpp
Oops. Forgot to mention you are the first to get yours into a releasable state :) Stefan

At Sat, 7 Apr 2007 18:34:21 -0700, Stefan O'Rear wrote:
On Sun, Apr 08, 2007 at 02:03:03AM +0200, Magnus Henoch wrote:
I'm hacking a library for writing XMPP clients, and just decided that my work is good enough to call it version 0.0.1. Find source and documentation here:
Congrats, you are (at least) the third person to do this.
Jeremy Shaw (stepcut): http://www.n-heptane.com/nhlab/repos/haskell-xmpp/
In my library I try to preserve the extensible nature of XMPP. It was my hope that people could add support for XMMP Extension Protocols (XEP), by writing additional modules without having to make any changes to the existing modules. As can be seen on this page: http://www.xmpp.org/extensions/ There are a *ton* of proposed extensions, so this seems like an admirable goal. Each extension could be distributed as a seperate cabal package, and provide a module like: Network.Protocol.XMPP.XEP1234 I think that I perhaps acheived my goal, but unfortunately, I think the API is pretty ugly and hard to use. It would be great to see someone figure out a better way to do it. Also, anyone interested in making an XMPP library should probably be aware of the development version of HaXml: http://www.cs.york.ac.uk/fp/HaXml-devel/ which includes this module: http://www.cs.york.ac.uk/fp/HaXml-devel/HaXml/Text-XML-HaXml-SAX.html "A streaming XML parser, using a method known as SAX. SAX isn't really a standard, but an implementation, so it's just an "SAX-like" parser. This module allows you parse an XML document without having to evaluate it as a whole. This is needed for protocols like jabber, which use xml streams for communication." j. ps. If this proposal were already implemented: "Open Data Types and Open Functions" by Andres and Ralf: http://www.informatik.uni-bonn.de/~loeh/OpenDatatypes.pdf it might be easy to make an extensible XMPP library :) But, I am not convinced that it can't be done with what we have today.

On Sat, Apr 07, 2007 at 08:01:41PM -0700, Jeremy Shaw wrote:
Also, anyone interested in making an XMPP library should probably be aware of the development version of HaXml:
http://www.cs.york.ac.uk/fp/HaXml-devel/
which includes this module:
http://www.cs.york.ac.uk/fp/HaXml-devel/HaXml/Text-XML-HaXml-SAX.html
"A streaming XML parser, using a method known as SAX. SAX isn't really a standard, but an implementation, so it's just an "SAX-like" parser. This module allows you parse an XML document without having to evaluate it as a whole. This is needed for protocols like jabber, which use xml streams for communication."
Or perhaps better yet, this one: http://www.cs.york.ac.uk/fp/HaXml-devel/HaXml/Text-XML-HaXml-ParseLazy.html Through the Power of Haskell - LAZY DOM! NB: xmpp clients are required to not attempt error recovery, so the "weakness" of ParseLazy is relatively inconsequential. Stefan

On Apr 8, 2007, at 2:03 , Magnus Henoch wrote:
I'm hacking a library for writing XMPP clients, and just decided that my work is good enough to call it version 0.0.1. Find source and documentation here:
http://www.dtek.chalmers.se/~henoch/text/hsxmpp.html
It contains a werewolf bot as an example. I wanted the bot to speak several languages, but I couldn't find any library that would make that easier, so I wrote one myself, in Translate.hs. Is there any other way to do that? What do other projects use?
You could use GF and its grammar library to generate text in multiple languages, see http://www.cs.chalmers.se/~aarne/GF/ GF is written in Haskell and can be used as a library. I work with GF daily, so feel free to ask me any questions you may have.
...
/Björn
participants (4)
-
Bjorn Bringert
-
Jeremy Shaw
-
Magnus Henoch
-
Stefan O'Rear