Data.Endian

data-endian-0.1.1: Endian-sensitive data

Safe Haskell | Safe
Language | Haskell98

Data.Endian

Synopsis

- data Endian
  - = LittleEndian
  - | BigEndian
- isLittleEndian :: Endian -> Bool
- isBigEndian :: Endian -> Bool
- class EndianSensitive α where
- toLittleEndian :: EndianSensitive α => α -> α
- fromLittleEndian :: EndianSensitive α => α -> α
- toBigEndian :: EndianSensitive α => α -> α
- fromBigEndian :: EndianSensitive α => α -> α
- toEndian :: EndianSensitive α => Endian -> α -> α
- fromEndian :: EndianSensitive α => Endian -> α -> α

# Documentation

data Endian #

Endianness.

Constructors

LittleEndian | Little-endian
BigEndian | Big-endian

Instances

Bounded Endian # |
Methods minBound :: Endian # maxBound :: Endian #
Enum Endian # |
Methods succ :: Endian -> Endian # pred :: Endian -> Endian # toEnum :: Int -> Endian # fromEnum :: Endian -> Int # enumFrom :: Endian -> [Endian] # enumFromThen :: Endian -> Endian -> [Endian] # enumFromTo :: Endian -> Endian -> [Endian] # enumFromThenTo :: Endian -> Endian -> Endian -> [Endian] #
Eq Endian # |
Methods (==) :: Endian -> Endian -> Bool # (/=) :: Endian -> Endian -> Bool #
Data Endian # |
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 # |
Methods compare :: Endian -> Endian -> Ordering # (<) :: Endian -> Endian -> Bool # (<=) :: Endian -> Endian -> Bool # (>) :: Endian -> Endian -> Bool # (>=) :: Endian -> Endian -> Bool # max :: Endian -> Endian -> Endian # min :: Endian -> Endian -> Endian #
Read Endian # |
Methods readsPrec :: Int -> ReadS Endian # readList :: ReadS [Endian] # readPrec :: ReadPrec Endian # readListPrec :: ReadPrec [Endian] #
Show Endian # |
Methods showsPrec :: Int -> Endian -> ShowS # show :: Endian -> String # showList :: [Endian] -> ShowS #
Ix Endian # |
Methods range :: (Endian, Endian) -> [Endian] # index :: (Endian, Endian) -> Endian -> Int # unsafeIndex :: (Endian, Endian) -> Endian -> Int inRange :: (Endian, Endian) -> Endian -> Bool # rangeSize :: (Endian, Endian) -> Int # unsafeRangeSize :: (Endian, Endian) -> Int
Generic Endian # |
Associated Types type Rep Endian :: * -> * # Methods from :: Endian -> Rep Endian x # to :: Rep Endian x -> Endian #
type Rep Endian # |
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 #

Return `True` if the supplied value is `LittleEndian`.

isBigEndian :: Endian -> Bool #

Return `True` if the supplied value is `BigEndian`.

class EndianSensitive α where #

Raw, endian-sensitive data.

Minimal complete definition

swapEndian

Methods

swapEndian :: α -> α #

Change the endianness of the argument.

Instances

EndianSensitive Int16 # |
Methods swapEndian :: Int16 -> Int16 #
EndianSensitive Int32 # |
Methods swapEndian :: Int32 -> Int32 #
EndianSensitive Int64 # |
Methods swapEndian :: Int64 -> Int64 #
EndianSensitive Word16 # |
Methods swapEndian :: Word16 -> Word16 #
EndianSensitive Word32 # |
Methods swapEndian :: Word32 -> Word32 #
EndianSensitive Word64 # |
Methods swapEndian :: Word64 -> Word64 #
EndianSensitive CSsize # |
Methods swapEndian :: CSsize -> CSsize #
EndianSensitive WordPtr # |
Methods swapEndian :: WordPtr -> WordPtr #
EndianSensitive IntPtr # |
Methods swapEndian :: IntPtr -> IntPtr #
EndianSensitive CShort # |
Methods swapEndian :: CShort -> CShort #
EndianSensitive CUShort # |
Methods swapEndian :: CUShort -> CUShort #
EndianSensitive CInt # |
Methods swapEndian :: CInt -> CInt #
EndianSensitive CUInt # |
Methods swapEndian :: CUInt -> CUInt #
EndianSensitive CLong # |
Methods swapEndian :: CLong -> CLong #
EndianSensitive CULong # |
Methods swapEndian :: CULong -> CULong #
EndianSensitive CLLong # |
Methods swapEndian :: CLLong -> CLLong #
EndianSensitive CULLong # |
Methods swapEndian :: CULLong -> CULLong #
EndianSensitive CPtrdiff # |
Methods swapEndian :: CPtrdiff -> CPtrdiff #
EndianSensitive CSize # |
Methods swapEndian :: CSize -> CSize #
EndianSensitive CWchar # |
Methods swapEndian :: CWchar -> CWchar #
EndianSensitive CIntPtr # |
Methods swapEndian :: CIntPtr -> CIntPtr #
EndianSensitive CUIntPtr # |
Methods swapEndian :: CUIntPtr -> CUIntPtr #
EndianSensitive CIntMax # |
Methods swapEndian :: CIntMax -> CIntMax #
EndianSensitive CUIntMax # |
Methods swapEndian :: CUIntMax -> CUIntMax #
EndianSensitive α => EndianSensitive [α] # |
Methods swapEndian :: [α] -> [α] #

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

Convert from the native format to little-endian.

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

Convert from little-endian to the native format.

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

Convert from the native format to big-endian.

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

Convert from big-endian to the native format.

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

Convert from the native format to the specified endianness.

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

Convert from the specified endianness to the native format.