HORIZON HASKELLDocslts/ghc-9.14.x45dd5372026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · 45dd537 · 2026-10-11

Modulehosc-0.21.1Haskell2010

Sound.Osc.Coding.Byte

Byte-level coding utility functions. Plain forms are big-endian, little-endian forms have _le suffix.

  • 66 values
  • Packagehosc-0.21.1
  • Exports66
  • LanguageHaskell2010
  • LicenceGPL-3.0-only
  • SourceByte.hs

Encode

10 declarations

Encode/Int

8 declarations
valueencode_u16 :: Int -> ByteString
#

Encode an un-signed 16-bit integer.

Example1 expression
encode_u16 0x0102 == ByteString.Lazy.pack [1,2]True
valueencode_u16_le :: Int -> ByteString
#

Little-endian.

Example1 expression
encode_u16_le 0x0102 == ByteString.Lazy.pack [2,1]True
valueencode_u32 :: Int -> ByteString
#

Encode an unsigned 32-bit integer.

Example1 expression
ByteString.Lazy.unpack (encode_u32 0x01020304)[1,2,3,4]
valueencode_u32_le :: Int -> ByteString
#

Little-endian.

Example1 expression
ByteString.Lazy.unpack (encode_u32_le 0x01020304)[4,3,2,1]

Encode/Float

4 declarations
valueencode_f32 :: Float -> ByteString
#

Encode a 32-bit IEEE floating point number.

Example1 expression
ByteString.Lazy.unpack (encode_f32 3.141)[64,73,6,37]
valueencode_f64 :: Double -> ByteString
#

Encode a 64-bit IEEE floating point number.

Example1 expression
ByteString.Lazy.unpack (encode_f64 3.141)[64,9,32,196,155,165,227,84]

Encode/Ascii

1 declaration

Decode

7 declarations

Decode/Int

10 declarations
valuedecode_i32 :: ByteString -> Int
#

Decode a signed 32-bit integer.

Example1 expression
decode_i32 (ByteString.Lazy.pack [0x00,0x00,0x03,0xe7]) == 0x03e7True
valuedecode_u32 :: ByteString -> Int
#

Decode an unsigned 32-bit integer.

Example1 expression
decode_u32 (ByteString.Lazy.pack [1,2,3,4]) == 0x01020304True
valuedecode_u32_le :: ByteString -> Int
#

Little-endian variant of decode_u32.

Example1 expression
decode_u32_le (ByteString.Lazy.pack [1,2,3,4]) == 0x04030201True

Decode/Float

3 declarations
valuedecode_f32 :: ByteString -> Float
#

Decode a 32-bit IEEE floating point number.

Example1 expression
decode_f32 (ByteString.Lazy.pack [64,73,6,37])3.141

Decode/Ascii

1 declaration

IO

5 declarations

Io/Int

8 declarations

Io/Float

2 declarations

Io/Ascii

1 declaration

Util

3 declarations

Bundle header as a lazy ByteString.

Example1 expression
ByteString.Lazy.length bundleHeader8
valuealign :: (Num i, Bits i) => i -> i
#

The number of bytes required to align an Osc value to the next 4-byte boundary.

Example1 expression
map align [0::Int .. 7][0,3,2,1,0,3,2,1]
Example1 expression
map align [512::Int .. 519][0,3,2,1,0,3,2,1]

ByteString

3 declarations