HORIZON HASKELLDocslts/ghc-10.0.x8fef28d2026-11-02Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8fef28d · 2026-11-02

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

Encode

Encode/Int

Encode an un-signed 16-bit integer.

Example1 expression
encode_u16 0x0102 == ByteString.Lazy.pack [1,2]True

Encode an unsigned 32-bit integer.

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

Encode/Float

Encode a 32-bit IEEE floating point number.

Example1 expression
ByteString.Lazy.unpack (encode_f32 3.141)[64,73,6,37]

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

Decode

Decode/Int

Decode a signed 32-bit integer.

Example1 expression
decode_i32 (ByteString.Lazy.pack [0x00,0x00,0x03,0xe7]) == 0x03e7True

Decode an unsigned 32-bit integer.

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

Little-endian variant of decode_u32.

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

Decode/Float

Decode a 32-bit IEEE floating point number.

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

Decode/Ascii

IO

Io/Int

Io/Float

Io/Ascii

Util

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