I noticed today that I can pattern match against lazy bytestrings when using the OverloadedStrings extension:

import Data.ByteString.Char8 ()
import Data.ByteString.Lazy.Char8

f :: ByteString -> Bool
f "abc" = True
f _ = False

main = do
print $ f $ fromChunks ["abc"]
print $ f $ fromChunks ["a","bc"]

When I run the above, I get:

True
True

Given that pattern matching is based on data constructors, how is it possible that (Chunk "abc Empty) and (Chunk "a" (Chunk "bc" Empty)) match the same pattern?

Tom