Re: [Haskell-cafe] ByteString in patterns

2009-03-11 Thread Manlio Perillo
Don Stewart ha scritto: manlio_perillo: Don Stewart ha scritto: [...] {-# LANGUAGE OverloadedStrings #-} import qualified Data.ByteString.Char8 as C isMatch :: C.ByteString - Bool isMatch match = True isMatch _ = False main = print . map isMatch . C.lines =

Re: [Haskell-cafe] ByteString in patterns

2009-03-11 Thread Don Stewart
manlio_perillo: Don Stewart ha scritto: manlio_perillo: Don Stewart ha scritto: [...] {-# LANGUAGE OverloadedStrings #-} import qualified Data.ByteString.Char8 as C isMatch :: C.ByteString - Bool isMatch match = True isMatch _ = False main = print . map

Re: [Haskell-cafe] ByteString in patterns

2009-03-11 Thread Daniel Fischer
Am Mittwoch, 11. März 2009 17:09 schrieb Manlio Perillo: Don Stewart ha scritto: manlio_perillo: Don Stewart ha scritto: [...] {-# LANGUAGE OverloadedStrings #-} import qualified Data.ByteString.Char8 as C isMatch :: C.ByteString - Bool isMatch match = True

Re: [Haskell-cafe] ByteString in patterns

2009-03-11 Thread Manlio Perillo
Don Stewart ha scritto: [...] Then there is something I'm missing. Your code does not compile. Sure it does: As Daniel suggested, I'm using an old bytestring version that came with Debian Etch (GHC 6.8.2). Thanks Manlio ___ Haskell-Cafe

Re: [Haskell-cafe] ByteString in patterns

2009-03-10 Thread Bryan O'Sullivan
On Tue, Mar 10, 2009 at 3:28 PM, Manlio Perillo manlio_peri...@libero.itwrote: This seems impossible, since ByteString data constructor is not available. You can use view patterns, per http://www.serpentine.com/blog/2009/01/11/fun-with-haskell-view-patterns/

Re: [Haskell-cafe] ByteString in patterns

2009-03-10 Thread Bulat Ziganshin
Hello Manlio, Wednesday, March 11, 2009, 1:28:13 AM, you wrote: Using normal String type I can define a pattern like: But if I want to use ByteString, what should I do? This seems impossible, since ByteString data constructor is not available. for numeric types, it works via Num instances.

Re: [Haskell-cafe] ByteString in patterns

2009-03-10 Thread Don Stewart
manlio_perillo: Hi. Using normal String type I can define a pattern like: let foo baz = 777 foo baz 777 But if I want to use ByteString, what should I do? This seems impossible, since ByteString data constructor is not available. -XOverloadedStrings e.g. {-# LANGUAGE

Re: [Haskell-cafe] ByteString in patterns

2009-03-10 Thread Manlio Perillo
Don Stewart ha scritto: manlio_perillo: Hi. Using normal String type I can define a pattern like: let foo baz = 777 foo baz 777 But if I want to use ByteString, what should I do? This seems impossible, since ByteString data constructor is not available. -XOverloadedStrings Perfect,

Re: [Haskell-cafe] ByteString in patterns

2009-03-10 Thread Don Stewart
manlio_perillo: Don Stewart ha scritto: manlio_perillo: Hi. Using normal String type I can define a pattern like: let foo baz = 777 foo baz 777 But if I want to use ByteString, what should I do? This seems impossible, since ByteString data constructor is not available.

Re: [Haskell-cafe] ByteString in patterns

2009-03-10 Thread Manlio Perillo
Don Stewart ha scritto: [...] -XOverloadedStrings Perfect, thanks. Is this supported by other Haskell implementations, or planned for Haskell'? Not as far as I know. It was added to GHC just over 2 years ago, http://article.gmane.org/gmane.comp.lang.haskell.cvs.all/31022 and isn't

Re: [Haskell-cafe] ByteString in patterns

2009-03-10 Thread Manlio Perillo
Don Stewart ha scritto: [...] {-# LANGUAGE OverloadedStrings #-} import qualified Data.ByteString.Char8 as C isMatch :: C.ByteString - Bool isMatch match = True isMatch _ = False main = print . map isMatch . C.lines = C.getContents What is the reason why

Re: [Haskell-cafe] ByteString in patterns

2009-03-10 Thread Don Stewart
manlio_perillo: Don Stewart ha scritto: [...] {-# LANGUAGE OverloadedStrings #-} import qualified Data.ByteString.Char8 as C isMatch :: C.ByteString - Bool isMatch match = True isMatch _ = False main = print . map isMatch . C.lines = C.getContents What