HaskellTorrent: A concurrent bittorrent client

[ bsd3, network, program ] [ Propose Tags ]

HaskellTorrent provides a BitTorrent client, based on the CML library for concurrency. This is an early preview release which is capable of downloading files from various torrent trackers, but have not yet demonstrated to be correct in all aspects. It is expected that the package currently contains numerous and even grave bugs. Patches to fix any problem are welcome!

[Skip to Readme]
Versions 0.0, 0.1, 0.1.1
Dependencies base (>=3.0 && <=5.0), bytestring, cereal, cml, containers, directory, HsOpenSSL, HTTP, mtl, network, parsec, pretty, random, random-shuffle, time [details]
License BSD-3-Clause
Copyright (c) 2009 Jesper Louis Andersen
Author Jesper Louis Andersen
Maintainer jesper.louis.andersen@gmail.com
Category Network
Source repo head: git clone git://github.com/jlouis/haskell-torrent.git -b master
Uploaded by JesperLouisAndersen at Sat Feb 20 17:23:45 UTC 2010
Distributions NixOS:0.1.1
Executables HaskellTorrent
Downloads 1455 total (10 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2016-12-30 [all 8 reports]
Hackage Matrix CI



Enable debug support


Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info


Maintainer's Corner

For package maintainers and hackage trustees

Readme for HaskellTorrent-0.0

[back to package description]

Haskell Torrent - a haskell bittorrent client.


This is a Haskell bittorrent client. I am the introduction document and I need to be written by some generous soul!


Here is what I do to install haskell torrrent locally on my machine:

cabal install --prefix=$HOME --user

Since we are using the magnificient cabal, this is enough to install haskell torrent in our $HOME/bin directory.


Haskell torrent can currently only do one very simple thing. If you call it with

HaskellTorrent foo.torrent

then it will begin downloading the file in foo.torrent to the current directory via the Bittorrent protocol. Note: Currently we have no support for multifile torrents.

Protocol support

Currently haskell-torrent supports the following BEPs (See the BEP Process document for an explanation of these)

  • 004, 020,

Haskell-torrent is not supporting these BEPs, but strives to do so one day:

  • 003, 005, 006, 007, 010, 012, 015, 009, 023, 018, 021, 022, 024, 026, 027, 028, 029, 030, 031, 032

Haskell-torrent will probably never support these BEPs:

  • 016, 017, 019

Source code Hierarchy

  • Data: Data structures.

    • Queue: Functional queues. Standard variant with two lists.
  • Process: Process definitions for the different processes comprising Haskell Torrent

    • ChokeMgr: Manages choking and unchoking of peers, based upon the current speed of the peer and its current state. Global for multiple torrents.
    • Console: Simple console process. Only responds to 'quit' at the moment.
    • FS: Process managing the file system.
    • Listen: Not used at the moment. Step towards listening sockets.
    • Peer: Several process definitions for handling peers. Two for sending, one for receiving and one for controlling the peer and handle the state.
    • PeerMgr: Management of a set of peers for a single torrent.
    • PieceMgr: Keeps track of what pieces have been downloaded and what are missing. Also hands out blocks for downloading to the peers.
    • Status: Keeps track of uploaded/downloaded/left bytes for a single torrent. Could be globalized.
    • Timer: Timer events.
    • Tracker: Communication with the tracker.
  • Protocol: Modules for interacting with the various bittorrent protocols.

    • BCode: The bittorrent BCode coding. Used by several protocols.
    • Wire: The protocol used for communication between peers.
  • Top Level:

    • Digest: SHA1 digests as used in the bittorrent protocol.
    • FS: Low level Filesystem code. Interacts with files.
    • HaskellTorrent: Main entry point to the code. Sets up processes.
    • Logging: Logging interface.
    • LoggingTypes: Types and instances used by the Logging framework.
    • PeerTypes: Types used by peers.
    • Process: Code for Erlang-inspired processes.
    • RateCalc: Rate calculations for a network socket. We use this to keep track of the current speed of a peer in one direction.
    • Supervisor: Erlang-inspired Supervisor processes.
    • Torrent: Various helpers and types for Torrents.
    • Version.hs.in: Generates Version.hs via the configure script.

Known bugs

  • I have seen the system violating an assertion in the Piece Manager. I think I got it, nailed, but it may show up again.