[Haskell-cafe] Num instance for Lazy ByteStrings (was:
NumLazyByteString Package License)
thomas.dubuisson at gmail.com
Mon Mar 8 12:10:17 EST 2010
Tristan and other interested parties on the Cafe,
Answering your question first, Tristan: I was going to use BSD3 (if it
isn't already) for the NumLazyByteString.
For the cafe too:
A while ago I made a Num instance for LPS; it is currently on my
code.haskell.org account. Notice this isn't on Hackage yet and the
semantics will be different soon. Most notably I want to ensure
divide and anything else implemented through 'asInteger' and
'asInteger2' results in a bytestring of length equal to the largest of
If that isn't clear then let me be very explicit. NumLazyByteString
intentionally allows overflow! If you want operations (mod 2^40) then
you need only work with bytestrings of length 5 bytes and the
operations will result in 5 byte ByteString. This is already true for
basic operations (bit operations, +, -, *) but is not yet done for
quot, rem, quotRem, divMod, mod, /, and other you can see leverage
Integer instead of using custom code.
Any desire for non-overflowing operations (basically, re-expressing
Integer as LazyByteString) would have to be done as an newtype with a
Num instance that grows the bytestring to the necessary level,
preventing overflow prior to calling NumLazyByteString.
Finally, I intend for numerous operations to be lazy. If you add two
infinite bytestrings you should be able to get the result of that
operation (modulo some finite value) using NumLazyByteString. This is
obviously not true for those operations leveraging Integer.
Any comments or requests on the future of this Library are welcome -
I'll probably get around to finishing it and putting it on Hackage in
a couple weeks.
On Sun, Mar 7, 2010 at 9:24 PM, Tristan Ravitch <travitch at cs.wisc.edu> wrote:
> I found myself adding Bits and Num instances for ByteStrings when I
> found your implementation (which is much better than mine was shaping
> up to be). Do you have any particular license in mind for it?
> I used it in an implementation of the Delta Debugging algorithm
> (http://www.st.cs.uni-saarland.de/dd/), which I was thinking I would
> like to release, and wanted to make sure the licensing could work out
> Tristan Ravitch
> travitch at cs.wisc.edu
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (GNU/Linux)
> -----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 197 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20100308/f9205415/signature.bin
More information about the Haskell-Cafe