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

Modulebasement-0.0.16Haskell2010

Basement.Endianness

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

  • 3 types
  • 1 class
  • 5 values
  • Packagebasement-0.0.16
  • Exports9
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceEndianness.hs
classclass ByteSwap a where
#

Class of types that can be byte-swapped.

e.g. Word16, Word32, Word64

Instances3ByteSwap

Big Endian

3 declarations
newtypenewtype BE a
#

Big Endian value

Constructors

Instances8Eq, Ord, Show, Bits, PrimType, NormalForm, …
valuetoBE :: ByteSwap a => a -> BE a
#

Convert a value in cpu endianess to big endian

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

Convert from a big endian value to the cpu endianness

Little Endian

3 declarations
newtypenewtype LE a
#

Little Endian value

Constructors

Instances8Eq, Ord, Show, Bits, PrimType, NormalForm, …
valuetoLE :: ByteSwap a => a -> LE a
#

Convert a value in cpu endianess to little endian

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

Convert from a little endian value to the cpu endianness

System Endianness

2 declarations