Module

WAGS.Universe.Bin

Package
purescript-wags
Repository
mikesol/purescript-wags

#Bit Source

data Bit

A single bit

#I Source

data I :: Bit

An on bit

Instances

#O Source

data O :: Bit

An off bit

Instances

#Bits Source

data Bits

0 or more bits. Note that, in all of the class operations on Bits, the lowest bit is in the leftmost position and the calculation proceeds from left to right. This is the opposite of how bits are usually represented (lowest on the right and highest on the left) but is more compuationally efficient.

#Bc Source

data Bc :: Bit -> Bits -> Bits

Cons for bits

Instances

#Ptr Source

type Ptr = Bits

Ptr is an alias for bits

#PtrList Source

data PtrList

A list of pointers

#toInt' Source

toInt' :: forall (i :: Bits). BinToInt i => Proxy i -> Int

Cast a binary value to an int

#toInt Source

toInt :: forall (i :: Bits). BinToInt i => Int

Cast a binary value to an int

#BinSucc Source

class BinSucc (i :: Bits) (o :: Bits) | i -> o

Class representing the successor function for binary values.

Instances

#BinSub Source

class BinSub (l :: Bits) (r :: Bits) (o :: Bits) | l r -> o

Class representing subtraction of binary values if l is greater than r and Bn otherwise.

Instances

#BinSub' Source

class BinSub' (carrying :: Type) (l :: Bits) (r :: Bits) (o :: Bits) | carrying l r -> o

Internal class helping with binary subtraction.

Instances

#Beq Source

class Beq (a :: Bit) (b :: Bit) (tf :: Type) | a b -> tf

Class asking if two bits are equal and responding t if true and f otherwise, aka NOT XOR.

Instances

#BinEq Source

class BinEq (a :: Bits) (b :: Bits) (tf :: Type) | a b -> tf

Class asking if two binary values are equal and responding t if true and f otherwise.

Instances

#AllZerosToNull Source

class AllZerosToNull (i :: Bits) (o :: Bits) | i -> o

Class that turns a list of Os to Bn.

Instances

#RemoveTrailingZeros Source

class RemoveTrailingZeros (i :: Bits) (o :: Bits) | i -> o

Class that removes trailing 0s from a binary number.

Instances

#type (+:) Source

Operator alias for WAGS.Universe.Bin.PtrListCons (right-associative / precedence 5)

#PtrListKeepSingleton Source

class PtrListKeepSingleton (ptrListA :: PtrList) (ptrListB :: PtrList) (ptrListC :: PtrList) | ptrListA ptrListB -> ptrListC

Like Alt for a list of pointers that also serves as an assertion that the positive result, if one exists, is a single pointer.

Instances

#BinToInt Source

class BinToInt (i :: Bits)  where

Internal helper class to cast a binary value to an int.

Members

  • toInt'' :: Int -> Proxy i -> Int

    Not for public use - used internally in public functions toInt' and toInt.

Instances