portability of Data.ByteString.Lazy
Duncan Coutts
duncan.coutts at worc.ox.ac.uk
Thu Nov 2 06:51:48 EST 2006
On Thu, 2006-11-02 at 10:37 +0000, Ross Paterson wrote:
> Data.ByteString.Lazy defines ByteString as a type synonym, and then
> uses that in instances, which isn't permitted by Haskell 98. How about
> defining a newtype ByteString in Data.ByteString.Lazy.Base instead?
It is defined as a newtype in Data.ByteString.Lazy.Base. But that module
also defines the strict variant, so within the same module they needed
different names. So we could just use the original name in the instance
declarations.
that is, .Base has:
data ByteString = ...
newtype LazyByteString = LPS [ByteString]
and .Lazy has:
type ByteString = Base.LazyByteString
So in .Lazy we can just use
instance Eq Base.LazyByteString where
...
Or we could use a separate .Lazy.Base module for exposing the lower
level internals of the lazy version and then not use a type alias at
all.
Duncan
More information about the Libraries
mailing list