NineP-0.0.1: 9P2000 in pure Haskell

PortabilityOnly tested on GHC 6.12.1, uses TypeSynonnymInstances
MaintainerDavid Leimbach <>




Binary serialization of 9P messages to and from lazy ByteStrings. This library does not currently provide any networking support or wrappers for easy to write clients or servers, though that may come with time as we decide the best way to implement these.

Perhaps interesting about 9P is that the messages are send in little endian as opposed to the somewhat misnamed network byte order that most people refer to for big endian.

It's fairly easy to use runPut or runGet to generate or parse 9P messages example:

send sock $ runPut (put (Msg TTVersion (-1) & Tversion 1024 9P2000))

This sends a lazy ByteString over a socket to begin a handshake of a 9P connection with a server, negotiating the use of the 9P2000 protocol, with a maximum message size of 1KB, using a tag of (-1) (known as NOTAG in 9P space.

This 9P implementation has been lightly tested against an Inferno operating system share with no authentication successfully.


Bin is the little endian encode/decode class for 9P2000

class Bin a whereSource


get :: Get aSource

put :: a -> PutSource

The Qid class ( for details)

data Qid Source

A Plan 9 Qid type. See for more information




like stat for unix filesystems, but for 9P2000

data Stat Source

Provides information on a path entry at a 9P2000 server


The Msg type is an enveleope for 9P2000 messages

data Msg Source

The message envelope type for all 9P2000 messages




Tag is the (possibly misnamed) message payload type

data Tag Source

A type that enumerates all the valid (and one invalid) message types in 9P2000


VarMsg is an algebraic type allowing for the various types of messages 9P2000 can have to be grouped under one type

data VarMsg Source

A variable message type that encapsulates the valid kinds of messages in a 9P2000 payload