Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
- data SDNV a
- encodeSDNV :: (Bits a, Integral a) => a -> SDNV a
- decodeSDNV :: (Bits a, Integral a) => SDNV a -> a
- safeDecodeSDNV :: (Bits a, Integral a) => SDNV a -> Maybe a
- isValidSDNV :: forall a. (Bits a, Integral a) => SDNV a -> Bool
Documentation
encodeSDNV :: (Bits a, Integral a) => a -> SDNV a Source #
Encode a value into SDNV. Please note that encoding of variable length negative values such as of type Integer results in sign lost.
decodeSDNV :: (Bits a, Integral a) => SDNV a -> a Source #
Decode SDNV into an integral value.
This function doesn't check SDNV integrity and size,
and in certain cases may produce incorrect results.
See safeDecodeSDNV
.
safeDecodeSDNV :: (Bits a, Integral a) => SDNV a -> Maybe a Source #
Decode SDNV into an intergral value.
This function uses isValidSDNV
to detect incorrectly encoded SDNV,
and to check for overflow in case of finite size types.