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

M.LEB

Description

Implements LEB128 (Little-Endian Base 128) variable-length encoding for arbitrary finite-bit integers, used in the Minecraft protocol.

Synopsis

Documentation

newtype LEB a Source #

a LEB128 (unsigned) encoded integer. the integer itself may or may not be signed

Constructors

LEB 

Fields

Instances

Instances details
Functor LEB Source # 
Instance details

Defined in M.LEB

Methods

fmap :: (a -> b) -> LEB a -> LEB b #

(<$) :: a -> LEB b -> LEB a #

Lift a => Lift (LEB a :: Type) Source # 
Instance details

Defined in M.LEB

Methods

lift :: Quote m => LEB a -> m Exp #

liftTyped :: forall (m :: Type -> Type). Quote m => LEB a -> Code m (LEB a) #

Data a => Data (LEB a) Source # 
Instance details

Defined in M.LEB

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> LEB a -> c (LEB a) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (LEB a) #

toConstr :: LEB a -> Constr #

dataTypeOf :: LEB a -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (LEB a)) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (LEB a)) #

gmapT :: (forall b. Data b => b -> b) -> LEB a -> LEB a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> LEB a -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> LEB a -> r #

gmapQ :: (forall d. Data d => d -> u) -> LEB a -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> LEB a -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> LEB a -> m (LEB a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> LEB a -> m (LEB a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> LEB a -> m (LEB a) #

Bounded a => Bounded (LEB a) Source # 
Instance details

Defined in M.LEB

Methods

minBound :: LEB a #

maxBound :: LEB a #

Enum a => Enum (LEB a) Source # 
Instance details

Defined in M.LEB

Methods

succ :: LEB a -> LEB a #

pred :: LEB a -> LEB a #

toEnum :: Int -> LEB a #

fromEnum :: LEB a -> Int #

enumFrom :: LEB a -> [LEB a] #

enumFromThen :: LEB a -> LEB a -> [LEB a] #

enumFromTo :: LEB a -> LEB a -> [LEB a] #

enumFromThenTo :: LEB a -> LEB a -> LEB a -> [LEB a] #

Generic (LEB a) Source # 
Instance details

Defined in M.LEB

Associated Types

type Rep (LEB a) 
Instance details

Defined in M.LEB

type Rep (LEB a) = D1 ('MetaData "LEB" "M.LEB" "mmm-0.1.0.0-oCDsNp3EBL2JzoyA6cTai" 'True) (C1 ('MetaCons "LEB" 'PrefixI 'True) (S1 ('MetaSel ('Just "getleb") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))

Methods

from :: LEB a -> Rep (LEB a) x #

to :: Rep (LEB a) x -> LEB a #

Num a => Num (LEB a) Source # 
Instance details

Defined in M.LEB

Methods

(+) :: LEB a -> LEB a -> LEB a #

(-) :: LEB a -> LEB a -> LEB a #

(*) :: LEB a -> LEB a -> LEB a #

negate :: LEB a -> LEB a #

abs :: LEB a -> LEB a #

signum :: LEB a -> LEB a #

fromInteger :: Integer -> LEB a #

Read a => Read (LEB a) Source # 
Instance details

Defined in M.LEB

Integral a => Integral (LEB a) Source # 
Instance details

Defined in M.LEB

Methods

quot :: LEB a -> LEB a -> LEB a #

rem :: LEB a -> LEB a -> LEB a #

div :: LEB a -> LEB a -> LEB a #

mod :: LEB a -> LEB a -> LEB a #

quotRem :: LEB a -> LEB a -> (LEB a, LEB a) #

divMod :: LEB a -> LEB a -> (LEB a, LEB a) #

toInteger :: LEB a -> Integer #

Real a => Real (LEB a) Source # 
Instance details

Defined in M.LEB

Methods

toRational :: LEB a -> Rational #

Show a => Show (LEB a) Source # 
Instance details

Defined in M.LEB

Methods

showsPrec :: Int -> LEB a -> ShowS #

show :: LEB a -> String #

showList :: [LEB a] -> ShowS #

NFData a => NFData (LEB a) Source # 
Instance details

Defined in M.LEB

Methods

rnf :: LEB a -> () #

Eq a => Eq (LEB a) Source # 
Instance details

Defined in M.LEB

Methods

(==) :: LEB a -> LEB a -> Bool #

(/=) :: LEB a -> LEB a -> Bool #

Ord a => Ord (LEB a) Source # 
Instance details

Defined in M.LEB

Methods

compare :: LEB a -> LEB a -> Ordering #

(<) :: LEB a -> LEB a -> Bool #

(<=) :: LEB a -> LEB a -> Bool #

(>) :: LEB a -> LEB a -> Bool #

(>=) :: LEB a -> LEB a -> Bool #

max :: LEB a -> LEB a -> LEB a #

min :: LEB a -> LEB a -> LEB a #

Hashable a => Hashable (LEB a) Source # 
Instance details

Defined in M.LEB

Methods

hashWithSalt :: Int -> LEB a -> Int

hash :: LEB a -> Int

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

Defined in M.Pack.Internal.Num

Methods

pack :: LEB a -> Builder Source #

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

Defined in M.Pack.Internal.Num

Methods

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

type Rep (LEB a) Source # 
Instance details

Defined in M.LEB

type Rep (LEB a) = D1 ('MetaData "LEB" "M.LEB" "mmm-0.1.0.0-oCDsNp3EBL2JzoyA6cTai" 'True) (C1 ('MetaCons "LEB" 'PrefixI 'True) (S1 ('MetaSel ('Just "getleb") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))

type VarInt = LEB Int32 Source #

VarInt

type VarLong = LEB Int64 Source #

VarLong

decodeleb Source #

Arguments

:: (Monad m, FiniteBits a, Num a) 
=> m Word8

accept any Word8 value

-> m (LEB a)

LEB128 encoded integer

decode an unsigned LEB128 encoded integer

the actual integer may or may not be signed; the encoding itself is "unsigned"

encodeleb :: (FiniteBits a, Integral a) => LEB a -> Builder Source #

encode an LEB128 encoded integer into a Builder