![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Hobbyist Programmer
|
Haskell: IRC bot
Over the past couple of days I've been working on an IRC bot in haskell. I believe it to be ready for an 0.1 release, and so here it is:
http://austin.youareinferior.net/infinity-0.1.tar.gz The interesting thing about this bot is the plugin system. I wanted it to be extendable, and so I decided that I would go the route of plugins. I opt'd for a library that allowed this called hs-plugins, and it's worked out really well. Essentially you can write a plugin in the Plugins/ directory, start the bot, and on startup the bot will compile and load it. Everything such as what arguments and whatnot is sent to the bot is done by the core, and in the core there're several built in commands (quit, list, etc. etc..)This is still very much a work in progress and I'm hacking away on the 0.2 release which has about 4 goals (2 of which I've already finished): - Implement the configuration dynamically so it doesn't have to be compiled into core like it is now (finished) - Move the core commands into their own system plugin (finished; the only exception to this is the quit command which kind of needs to be in the core...) - Implement a more robust IRC parsing solution as the current one is ad-hoc and I very much dislike the code (Parsec) - Implement the ability to reload plugins in-situ. This will require some form of inter-thread synchronization such as Software Transactional Memory so the global list of plugins is not tampered with incorrectly; this will also require updating the API for the plugins since they too have access to things like the list of plugins (this will most likely require reworking of the ReaderT monad I use for an environment inside the IRC thread; I will probably move to using StateT.) Once 0.2 is out I will consider it *much* more usable and stable than 0.1; aside from the above there're also several things I've rectified already. So like I said, this is a work in progress although I do consider 0.1 'usable.' Note: you will need linux if you wish to compile and run the bot as hs-plugins does not like windows. I've also only tested this on i386 linux so if anybody would like to try it on other platforms and get it to work that'd be awesome. Happy hacking. ![]() |
|
|
|
|
|
#2 |
|
Programming Guru
![]() Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5
![]() |
I haven't had time to read through all of the source, but I will the moment I get some more spare time, as it's a rather interesting piece of work. The plug-in system is new to me, and I'll be dissecting that eventually, and I'll be interested in seeing how you implement software transactional memory as well.
|
|
|
|
|
|
#3 |
|
Hobbyist Programmer
|
Thanks for the feedback, I was beginning to think my bot wouldn't attract any replies.
The plugin system is actually remarkably simple in terms of just loading and compiling the code for use by the system itself, in fact, I actually blogged on the matter just a few days ago, in case it happens to interest you. The case example is infinity and the code I used in it is actually the code that's used for infinity's code loading. In the latest darcs repo (which isn't published right now,) I've already fixed a few bugs and several shortcomings already, so consider this release somewhat a field test.I have been rather busy so 0.2 isn't quite on schedule but I hope it to be out soon (at the very least, before school starts,) I've looked into a darcs repo on the code.haskell.org server, so even if it's not out you can pull the most recent repo (I'm quite religious about a repo always being in a buildable state when I push patches.) Last edited by Mad_guy; Aug 14th, 2007 at 8:55 PM. |
|
|
|
|
|
#4 |
|
Programming Guru
![]() Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5
![]() |
I noticed that blog entry, as I happened across it by accident when searching Reddit for another article on Haskell. I haven't had time to go over it in detail, but I've already cast my eye across it. I look forward to your next version
![]() |
|
|
|
|
|
#5 |
|
Hobbyist Programmer
|
Re: Haskell: IRC bot
So, after ridiculous amounts of my work being prolonged, I've finally gotten around to getting to the next version of my irc bot, 0.3.
You may be wondering what happened to 0.2; you can think of it as a small intermediate step in which I "deleted lots and lots of code" and have this much better new code available. ![]() There is a darcs repository available at: http://code.haskell.org/infinity/src And you can get a (current) snapshot tarball from: http://code.haskell.org/infinity/sna...0071019.tar.gz Please note this thing still is not fully done. Everything actually works, but there're some corner cases that need to be addressed. The most notable, there is a race condition that is prevalent upon reboots of the code when the bot is on multiple servers. This is the main thing, but I've made some way with it and it should be fixed sometime in the near future. Aside from that and any other little bugs that pop up, most of the changing code up until the actual source release will probably be just tweaks, so expect this to accurately reflect the final bot. ![]() |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Haskell | Arevos | Other Programming Languages | 25 | Jun 3rd, 2007 4:34 PM |
| Haskell tutorial: writing a blacklist engine using the Writer Monad | Mad_guy | Show Off Your Open Source Projects | 6 | Apr 14th, 2007 3:14 PM |
| Haskell fun: hsh -- a busybox spinoff in haskell | Mad_guy | Existing Project Development | 2 | Mar 16th, 2007 4:10 PM |
| Haskell ideas? | Mad_guy | Other Programming Languages | 3 | Feb 5th, 2007 9:16 PM |
| Anyone with knowledge of Haskell? | BungalowBill | Other Programming Languages | 16 | Oct 30th, 2006 12:27 PM |