TPFS-0.1: Tagged plain file system in which a file can only have multiple tags and nothing more.

System.TPFS.Device

Description

Defines a readable and writable random-access device class, and some supporting classes.

Synopsis

Documentation

class (Functor m, Applicative m, Monad m, Interleave m) => Device m h whereSource

Methods

dGetSource

Arguments

:: Integral i 
=> h

The device handle.

-> Address

The address to read from.

-> i

The number of bytes to read.

-> m ByteString

The read bytestring. If read past EOF, the remaining bytes should be nulls.

Reads bytes from the device. It should never return less than the requested number of bytes.

dPutSource

Arguments

:: h

The device handle.

-> Address

Address to write at.

-> ByteString

String to write.

-> m () 

Writes bytes to the device.

Instances

class Monad m => Interleave m whereSource

Only necessary for IO -- the default implementation should be sufficient for most monads.

Methods

interleave :: m a -> m aSource

Instances

class Binary a => BinarySize a whereSource

Methods

binarySize :: a -> (Integer, Integer)Source

Returns a minimum and maximum size (in bytes) for an encoded object of this type. The actual value of the object itself should be discarded; this should be a constant.