[Haskell-cafe] Num instance for Lazy ByteStrings (was: NumLazyByteString Package License)

Thomas DuBuisson thomas.dubuisson at gmail.com
Mon Mar 8 18:13:23 EST 2010


> Is NumLazyByteString a newtype around Bytestring.Lazy that interprets the
> bit stream represented by the ByteString as integer?

Not exactly.  There is not newtype wrapper.  NumLazyByteString is:

instance Num L.ByteString where
 ...
instance Enum L.ByteString where
 ...
instance Integral L.ByteString where
 ...
instance Bits L.ByteString where
 ...

> If so, could this also
> be done using a newtype around [Integer], where appropriately large Integers
> are used? If yes, you may find
>  http://code.haskell.org/numeric-prelude/src/Number/Positional.hs
>  useful.

Thanks for the pointer.


More information about the Haskell-Cafe mailing list