Re: [Haskell-cafe] Pattern matching on lazy bytestrings: how does it work?

2011-04-23 Thread Helgi Kristvin Sigurbjarnarson
On Fri, Apr 22, 2011 at 11:52:32PM -0700, Tom Brow wrote: > I noticed today that I can pattern match against lazy bytestrings when using > the OverloadedStrings extension: [..] > Given that pattern matching is based on data constructors, how is it possible > that (Chunk "abc Empty) and (Chunk "a" (

Re: [Haskell-cafe] Pattern matching on lazy bytestrings: how does it work?

2011-04-23 Thread Stephen Tetley
Surely `fromChunks` is making the both lines in the code snippet the same? Also, in your last sentence I think you've miscalculated the shape of the initial input. Best wishes Stephen ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.h

[Haskell-cafe] Pattern matching on lazy bytestrings: how does it work?

2011-04-22 Thread Tom Brow
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"]