basement-0.0.15: Foundation scrap box of array & string
License BSD-style
Maintainer Haskell Foundation
Stability experimental
Portability portable
Safe Haskell None
Language Haskell2010

Basement.Endianness

Description

Set endianness tag to a given primitive. This will help for serialising data for protocols (such as the network protocols).

Synopsis

Documentation

class ByteSwap a Source #

Class of types that can be byte-swapped.

e.g. Word16, Word32, Word64

Minimal complete definition

byteSwap

Big Endian

newtype BE a Source #

Big Endian value

Constructors

BE

Fields

Instances

Instances details
Eq a => Eq ( BE a) Source #
Instance details

Defined in Basement.Endianness

( ByteSwap a, Ord a) => Ord ( BE a) Source #
Instance details

Defined in Basement.Endianness

Show a => Show ( BE a) Source #
Instance details

Defined in Basement.Endianness

Bits a => Bits ( BE a) Source #
Instance details

Defined in Basement.Endianness

PrimMemoryComparable a => PrimMemoryComparable ( BE a) Source #
Instance details

Defined in Basement.PrimType

PrimType a => PrimType ( BE a) Source #
Instance details

Defined in Basement.PrimType

Associated Types

type PrimSize ( BE a) :: Nat Source #

NormalForm a => NormalForm ( BE a) Source #
Instance details

Defined in Basement.NormalForm

type PrimSize ( BE a) Source #
Instance details

Defined in Basement.PrimType

toBE :: ByteSwap a => a -> BE a Source #

Convert a value in cpu endianess to big endian

fromBE :: ByteSwap a => BE a -> a Source #

Convert from a big endian value to the cpu endianness

Little Endian

newtype LE a Source #

Little Endian value

Constructors

LE

Fields

Instances

Instances details
Eq a => Eq ( LE a) Source #
Instance details

Defined in Basement.Endianness

( ByteSwap a, Ord a) => Ord ( LE a) Source #
Instance details

Defined in Basement.Endianness

Show a => Show ( LE a) Source #
Instance details

Defined in Basement.Endianness

Bits a => Bits ( LE a) Source #
Instance details

Defined in Basement.Endianness

PrimMemoryComparable a => PrimMemoryComparable ( LE a) Source #
Instance details

Defined in Basement.PrimType

PrimType a => PrimType ( LE a) Source #
Instance details

Defined in Basement.PrimType

Associated Types

type PrimSize ( LE a) :: Nat Source #

NormalForm a => NormalForm ( LE a) Source #
Instance details

Defined in Basement.NormalForm

type PrimSize ( LE a) Source #
Instance details

Defined in Basement.PrimType

toLE :: ByteSwap a => a -> LE a Source #

Convert a value in cpu endianess to little endian

fromLE :: ByteSwap a => LE a -> a Source #

Convert from a little endian value to the cpu endianness

System Endianness

endianness :: Endianness Source #

endianness of the current architecture