Module

Data.Binary.Class

Package
purescript-binary
Repository
Unisay/purescript-binary

#charToBit Source

#bitToChar Source

#lsb Source

lsb :: Bits -> Bit

Least significant bit

#msb Source

msb :: Bits -> Bit

most significant bit

#align Source

align :: Bits -> Bits -> Tuple Bits Bits

align length by adding zeroes from the left

#head Source

head :: Bits -> Bit

#tail Source

tail :: Bits -> Bits

#init Source

init :: Bits -> Bits

#last Source

last :: Bits -> Bit

#drop Source

drop :: Int -> Bits -> Bits

#take Source

take :: Int -> Bits -> Bits

#uncons Source

uncons :: Bits -> { head :: Bit, tail :: Bits }

#length Source

#Binary Source

class (Ord a) <= Binary a  where

Members

Instances

#isOdd Source

isOdd :: forall a. Binary a => a -> Boolean

#isEven Source

isEven :: forall a. Binary a => a -> Boolean

#toBinString Source

toBinString :: forall a. Binary a => a -> String

#tryFromBinString Source

tryFromBinString :: forall a. Fixed a => String -> Maybe a

#diffBits Source

#FitsInt Source

class (Binary a) <= FitsInt a  where

Members

Instances

#Fixed Source

class (Bounded a, Binary a) <= Fixed a  where

Members

Instances

#tryToInt Source

tryToInt :: forall a. Binary a => a -> Maybe Int

#tryFromInt Source

tryFromInt :: forall a. Fixed a => Int -> Maybe a

#modAdd Source

modAdd :: forall a. Fixed a => a -> a -> a

#modMul Source

modMul :: forall a. Fixed a => a -> a -> a

#diffFixed Source

diffFixed :: forall a. Fixed a => a -> a -> a

#add Source

add :: forall a. Binary a => a -> a -> Overflow Bit a

Unsigned binary addition Returns overflow bit

#unsafeAdd Source

unsafeAdd :: forall a. Binary a => a -> a -> a

Unsigned binary addition Discards overflow bit

#unsafeRightShift Source

unsafeRightShift :: forall a. Binary a => a -> a

#unsafeLeftShift Source

unsafeLeftShift :: forall a. Binary a => a -> a

#Elastic Source

class (Binary a) <= Elastic a  where

Members

Instances

#addLeadingZeros Source

addLeadingZeros :: forall a. Elastic a => Int -> a -> a

#stripLeadingZeros Source

stripLeadingZeros :: forall a. Elastic a => a -> a

#extendAdd Source

extendAdd :: forall a. Elastic a => a -> a -> a

#tryFromBinStringElastic Source

#fromInt Source

fromInt :: forall a. Elastic a => Int -> a

#half Source

half :: forall a. Elastic a => a -> a

#double Source

double :: forall a. Elastic a => a -> a

#diffElastic Source

diffElastic :: forall a. Elastic a => a -> a -> a

#divMod Source

divMod :: forall a. Elastic a => a -> a -> Tuple a a

#multiply Source

multiply :: forall a. Elastic a => a -> a -> a

#Radix Source

newtype Radix

The number of unique digits (including zero) used to represent integers in a specific base.

Instances

#bin Source

bin :: Radix

The base-2 system.

#oct Source

oct :: Radix

The base-8 system.

#dec Source

dec :: Radix

The base-10 system.

#hex Source

hex :: Radix

The base-16 system.

#toStringAs Source

toStringAs :: forall a. Binary a => Radix -> a -> String