mmm-0.1.0.0: Minecraft 1.21.4 implementation in Haskell
Copyright(c) axionbuster 2025
LicenseBSD-3-Clause
Safe HaskellNone
LanguageGHC2021

M.Pack.Internal.Num

Description

Implements Pack and Unpack instances for numeric types and Bool, including integral types, floating point numbers, and LEB128 encoding.

Synopsis

Documentation

packleb32 :: Integral a => a -> Builder Source #

pack as an LEB128-encoded Int32

unpackleb32 :: forall a (st :: ZeroBitType) r. Integral a => Parser st r a Source #

unpack from an LEB128-encoded Int32

packfi :: (Integral a, Pack a, Integral b) => b -> Builder Source #

pack b in the format of a

unpackfi :: forall a b (st :: ZeroBitType) r. (Integral a, Unpack a, Integral b) => Parser st r b Source #

unpack b from a number in the format of a

guardnat :: forall a (st :: ZeroBitType) r. (Num a, Ord a, Show a) => String -> a -> Parser st r a Source #

ensure the number is non-negative

Orphan instances

Pack Int16 Source # 
Instance details

Methods

pack :: Int16 -> Builder Source #

Pack Int32 Source # 
Instance details

Methods

pack :: Int32 -> Builder Source #

Pack Int64 Source # 
Instance details

Methods

pack :: Int64 -> Builder Source #

Pack Int8 Source # 
Instance details

Methods

pack :: Int8 -> Builder Source #

Pack Word16 Source # 
Instance details

Methods

pack :: Word16 -> Builder Source #

Pack Word32 Source # 
Instance details

Methods

pack :: Word32 -> Builder Source #

Pack Word64 Source # 
Instance details

Methods

pack :: Word64 -> Builder Source #

Pack Word8 Source # 
Instance details

Methods

pack :: Word8 -> Builder Source #

Pack Bool Source # 
Instance details

Methods

pack :: Bool -> Builder Source #

Pack Double Source # 
Instance details

Methods

pack :: Double -> Builder Source #

Pack Float Source # 
Instance details

Methods

pack :: Float -> Builder Source #

Unpack Int16 Source # 
Instance details

Methods

unpack :: forall (st :: ZeroBitType) r. Parser st r Int16 Source #

Unpack Int32 Source # 
Instance details

Methods

unpack :: forall (st :: ZeroBitType) r. Parser st r Int32 Source #

Unpack Int64 Source # 
Instance details

Methods

unpack :: forall (st :: ZeroBitType) r. Parser st r Int64 Source #

Unpack Int8 Source # 
Instance details

Methods

unpack :: forall (st :: ZeroBitType) r. Parser st r Int8 Source #

Unpack Word16 Source # 
Instance details

Methods

unpack :: forall (st :: ZeroBitType) r. Parser st r Word16 Source #

Unpack Word32 Source # 
Instance details

Methods

unpack :: forall (st :: ZeroBitType) r. Parser st r Word32 Source #

Unpack Word64 Source # 
Instance details

Methods

unpack :: forall (st :: ZeroBitType) r. Parser st r Word64 Source #

Unpack Word8 Source # 
Instance details

Methods

unpack :: forall (st :: ZeroBitType) r. Parser st r Word8 Source #

Unpack Bool Source # 
Instance details

Methods

unpack :: forall (st :: ZeroBitType) r. Parser st r Bool Source #

Unpack Double Source # 
Instance details

Methods

unpack :: forall (st :: ZeroBitType) r. Parser st r Double Source #

Unpack Float Source # 
Instance details

Methods

unpack :: forall (st :: ZeroBitType) r. Parser st r Float Source #

(FiniteBits a, Integral a) => Pack (LEB a) Source # 
Instance details

Methods

pack :: LEB a -> Builder Source #

(FiniteBits a, Num a) => Unpack (LEB a) Source # 
Instance details

Methods

unpack :: forall (st :: ZeroBitType) r. Parser st r (LEB a) Source #