[Haskell-cafe] ByteString in patterns
Don Stewart
dons at galois.com
Tue Mar 10 19:43:31 EDT 2009
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, 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 terribly widely used. Probably ByteString literals are the
current main use (along with interesting EDSL applications, which was
the original motivation afaik).
-- Don
More information about the Haskell-Cafe
mailing list