[Haskell-cafe] Re: The Proliferation of List-Like Types
ben.franksen at online.de
Wed Feb 20 17:18:51 EST 2008
John Goerzen wrote:
> On 2008-02-20, Jules Bean <jules at jellybean.co.uk> wrote:
>> Not directly, no.
>> The point about Foldable, Functor, and Monad, is that they enforce the
>> connection between container and contents. If the contents is of type
>> "a", the container is of type "f a" for a fixed type constructor 'f'.
>> This works for , Seq, and so on, but fails for ByteString.
> Right. In a pure abstract sense, we humans know there is a
> relationship between container and contents: a ByteString always
> contains a Word8 (or a Char8 if we choose the alternative
> But that is not expressed in the type of ByteString.
Hm, making a function out of a constant is easy on the value level, just use
(const x) instead of (x). So, what about wrapping ByteString in a GADT,
data ByteString' a where
BS' :: Word8 -> ByteString' Word8
? I probably overlooked something important here...
More information about the Haskell-Cafe