
On Wed, Sep 11, 2013 at 7:15 AM, Duncan Coutts wrote: On Wed, 2013-09-11 at 15:56 +0200, Nicolas Trangez wrote: I looked into this when this thread started, but bumped into at least
one 'issue': when defining (OTOH) something like import qualified Data.ByteString as BS
import qualified Data.ByteString.Char8 as BS8 class Foldable t where
type Elem c :: *
foldr :: (Elem t -> b -> b) -> b -> t -> b instance Foldable BS.ByteString where
type Elem BS.ByteString = Word8
foldr = BS.foldr instance Foldable BS8.ByteString where
type Elem BS8.ByteString = Char
foldr = BS8.foldr which fails because BS.ByteString and BS8.ByteString are the same. Right. I fear there's very little one could do about that. We do have
one single type that is a specialised container for two types. That's
fairly unusual. I'd probably just use Word8, especially since Char stuff
is a bit iffy since it's really "Char8" not a full Char. It happens in containers and unordered-containers as well and I suspect we
will see it any time we want both a lazy and strict (in the container
sense) version of a data type.
-- Johan