data-endian-0.1.1: Endian-sensitive data

Safe HaskellSafe
LanguageHaskell98

Data.Endian

Synopsis

Documentation

data Endian Source #

Endianness.

Constructors

LittleEndian

Little-endian

BigEndian

Big-endian

Instances

Bounded Endian Source # 
Enum Endian Source # 
Eq Endian Source # 

Methods

(==) :: Endian -> Endian -> Bool #

(/=) :: Endian -> Endian -> Bool #

Data Endian Source # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Endian -> c Endian #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Endian #

toConstr :: Endian -> Constr #

dataTypeOf :: Endian -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c Endian) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Endian) #

gmapT :: (forall b. Data b => b -> b) -> Endian -> Endian #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Endian -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Endian -> r #

gmapQ :: (forall d. Data d => d -> u) -> Endian -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Endian -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Endian -> m Endian #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Endian -> m Endian #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Endian -> m Endian #

Ord Endian Source # 
Read Endian Source # 
Show Endian Source # 
Ix Endian Source # 
Generic Endian Source # 

Associated Types

type Rep Endian :: * -> * #

Methods

from :: Endian -> Rep Endian x #

to :: Rep Endian x -> Endian #

type Rep Endian Source # 
type Rep Endian = D1 (MetaData "Endian" "Data.Endian" "data-endian-0.1.1-8uxPbJpGjmuKDaF1nxHF2h" False) ((:+:) (C1 (MetaCons "LittleEndian" PrefixI False) U1) (C1 (MetaCons "BigEndian" PrefixI False) U1))

isLittleEndian :: Endian -> Bool Source #

Return True if the supplied value is LittleEndian.

isBigEndian :: Endian -> Bool Source #

Return True if the supplied value is BigEndian.

class EndianSensitive α where Source #

Raw, endian-sensitive data.

Minimal complete definition

swapEndian

Methods

swapEndian :: α -> α Source #

Change the endianness of the argument.

Instances

EndianSensitive Int16 Source # 
EndianSensitive Int32 Source # 
EndianSensitive Int64 Source # 
EndianSensitive Word16 Source # 
EndianSensitive Word32 Source # 
EndianSensitive Word64 Source # 
EndianSensitive CSsize Source # 
EndianSensitive WordPtr Source # 
EndianSensitive IntPtr Source # 
EndianSensitive CShort Source # 
EndianSensitive CUShort Source # 
EndianSensitive CInt Source # 

Methods

swapEndian :: CInt -> CInt Source #

EndianSensitive CUInt Source # 
EndianSensitive CLong Source # 
EndianSensitive CULong Source # 
EndianSensitive CLLong Source # 
EndianSensitive CULLong Source # 
EndianSensitive CPtrdiff Source # 
EndianSensitive CSize Source # 
EndianSensitive CWchar Source # 
EndianSensitive CIntPtr Source # 
EndianSensitive CUIntPtr Source # 
EndianSensitive CIntMax Source # 
EndianSensitive CUIntMax Source # 
EndianSensitive α => EndianSensitive [α] Source # 

Methods

swapEndian :: [α] -> [α] Source #

toLittleEndian :: EndianSensitive α => α -> α Source #

Convert from the native format to little-endian.

fromLittleEndian :: EndianSensitive α => α -> α Source #

Convert from little-endian to the native format.

toBigEndian :: EndianSensitive α => α -> α Source #

Convert from the native format to big-endian.

fromBigEndian :: EndianSensitive α => α -> α Source #

Convert from big-endian to the native format.

toEndian :: EndianSensitive α => Endian -> α -> α Source #

Convert from the native format to the specified endianness.

fromEndian :: EndianSensitive α => Endian -> α -> α Source #

Convert from the specified endianness to the native format.