Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Naturals represented via ASCII numerals.
A concept which sees occasional use in places where neither speed nor size efficiency matter.
The tar file format uses it, apparently to sidestep making a decision on byte ordering. Though digits are encoded "big-endian", so, uh. I don't get it.
I don't really see the usage of these. It seems silly and inefficient, aimed solely at easing debugging.
Synopsis
- newtype AsciiNat (base :: Natural) = AsciiNat {}
- asciiNatCompare :: AsciiNat b1 -> AsciiNat b2 -> Ordering
- octalFromAsciiDigit :: Word8 -> Maybe Word8
- natToAsciiBytes :: (Word8 -> Word8) -> Natural -> Natural -> Builder
- asciiBytesToNat :: (Word8 -> Maybe Word8) -> Natural -> ByteString -> Either Word8 Natural
- digits :: forall b a. (Integral a, Integral b) => a -> a -> NonEmpty b
Documentation
newtype AsciiNat (base :: Natural) Source #
A Natural
represented in binary as an ASCII string, where each character
a is a digit in the given base (> 1).
Show
instances display the stored number in the given base. If the base has
a common prefix (e.g. 0x
for hex), it is used.
Instances
KnownNat base => Data (AsciiNat base) Source # | |
Defined in Binrep.Type.AsciiNat gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> AsciiNat base -> c (AsciiNat base) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (AsciiNat base) # toConstr :: AsciiNat base -> Constr # dataTypeOf :: AsciiNat base -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (AsciiNat base)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (AsciiNat base)) # gmapT :: (forall b. Data b => b -> b) -> AsciiNat base -> AsciiNat base # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> AsciiNat base -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> AsciiNat base -> r # gmapQ :: (forall d. Data d => d -> u) -> AsciiNat base -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> AsciiNat base -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> AsciiNat base -> m (AsciiNat base) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> AsciiNat base -> m (AsciiNat base) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> AsciiNat base -> m (AsciiNat base) # | |
Generic (AsciiNat base) Source # | |
Show (AsciiNat 2) Source # | |
Show (AsciiNat 8) Source # | |
Show (AsciiNat 10) Source # | |
Show (AsciiNat 16) Source # | |
KnownNat base => BLen (AsciiNat base) Source # | The bytelength of an |
Get (AsciiNat 8) Source # | |
Put (AsciiNat 8) Source # | |
Eq (AsciiNat base) Source # | |
Ord (AsciiNat base) Source # | |
Defined in Binrep.Type.AsciiNat compare :: AsciiNat base -> AsciiNat base -> Ordering # (<) :: AsciiNat base -> AsciiNat base -> Bool # (<=) :: AsciiNat base -> AsciiNat base -> Bool # (>) :: AsciiNat base -> AsciiNat base -> Bool # (>=) :: AsciiNat base -> AsciiNat base -> Bool # | |
type Rep (AsciiNat base) Source # | |
Defined in Binrep.Type.AsciiNat | |
type CBLen (AsciiNat base) Source # | |