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

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Tue Mar 9 13:06:44 EST 2010

On Mar 9, 2010, at 09:41 , Yitzchak Gale wrote:
> Henning Thielemann wrote:
>>> Is NumLazyByteString a newtype around Bytestring.Lazy
>>> that interprets the bit stream represented by the ByteString
>>> as integer?
> Thomas DuBuisson wrote:
>> Not exactly.  There is not newtype wrapper.  NumLazyByteString is:
>> instance Num L.ByteString where
>>  ...
> Are you absolutely certain that this is the one and only
> canonical instance that can ever exist that makes sense?
> Otherwise, please use a newtype wrapper.

Or from the other direction:  you're in essence declaring that *any*  
ByteString can be used as a Num, etc.  This strikes me as inviting  
confusion, at the very least; I'd strongly prefer the type system to  
help me distinguish ByteStrings used as Nums from those used as  
Strings, instead of quietly doing unexpected things (or issuing odd  
type errors) because I accidentally passed the wrong argument.

brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20100309/97bfa9d3/PGP-0001.bin

More information about the Haskell-Cafe mailing list