HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulememory-0.18.0Haskell2010

Data.Memory.Endian

  • 3 types
  • 1 class
  • 5 values
  • Packagememory-0.18.0
  • Exports9
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceEndian.hs
datadata Endianness
#

represent the CPU endianness

Big endian system stores bytes with the MSB as the first byte. Little endian system stores bytes with the LSB as the first byte.

middle endian is purposely avoided.

Instances2Eq, Show
newtypenewtype BE a
#

Big Endian value

Constructors

Instances3Eq, Show, Storable
  • Eq a => Eq (BE a)Defined in memory-0.18.0 · Data.Memory.Endian
  • Show a => Show (BE a)Defined in memory-0.18.0 · Data.Memory.Endian
  • Storable a => Storable (BE a)Defined in memory-0.18.0 · Data.Memory.Endian
newtypenewtype LE a
#

Little Endian value

Constructors

Instances3Eq, Show, Storable
  • Eq a => Eq (LE a)Defined in memory-0.18.0 · Data.Memory.Endian
  • Show a => Show (LE a)Defined in memory-0.18.0 · Data.Memory.Endian
  • Storable a => Storable (LE a)Defined in memory-0.18.0 · Data.Memory.Endian
valuefromBE :: ByteSwap a => BE a -> a
#

Convert from a big endian value to the cpu endianness

valuetoBE :: ByteSwap a => a -> BE a
#

Convert a value in cpu endianess to big endian

valuefromLE :: ByteSwap a => LE a -> a
#

Convert from a little endian value to the cpu endianness

valuetoLE :: ByteSwap a => a -> LE a
#

Convert a value in cpu endianess to little endian

classclass Storable a => ByteSwap a where
#

Class of types that can be byte-swapped.

e.g. Word16, Word32, Word64

Instances3ByteSwap