byte-order-0.1.1.0: Portable big-endian and little-endian conversions

Safe HaskellSafe
LanguageHaskell2010

System.ByteOrder.Class

Synopsis

Documentation

class FixedOrdering (b :: ByteOrder) where Source #

A byte order that can be interpreted as a conversion function. This class is effectively closed. The only instances are for BigEndian and LittleEndian. It is not possible to write more instances since there are no other inhabitants of ByteOrder.

Methods

toFixedEndian :: Bytes a => a -> a Source #

Instances
FixedOrdering LittleEndian Source # 
Instance details

Defined in System.ByteOrder.Class

Methods

toFixedEndian :: Bytes a => a -> a Source #

FixedOrdering BigEndian Source # 
Instance details

Defined in System.ByteOrder.Class

Methods

toFixedEndian :: Bytes a => a -> a Source #

class Bytes a where Source #

Types that are represented as a fixed-sized word. For these types, the bytes can be swapped. The instances of this class use byteswapping primitives and compile-time knowledge of native endianness to provide portable endianness conversion functions.

Methods

toBigEndian :: a -> a Source #

Convert from a native-endian word to a big-endian word.

toLittleEndian :: a -> a Source #

Convert from a native-endian word to a little-endian word.