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 mail
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
>
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 _
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 =<<
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 =<
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 i
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 terr
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 construc
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
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.
{-# LAN
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
On Tue, Mar 10, 2009 at 3:28 PM, Manlio Perillo wrote:
> 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/
___
Haskell-Ca
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.
Thanks Manlio Perillo
___
13 matches
Mail list logo