Re: [Haskell-cafe] Using IsString with attoparsec

2011-01-29 Thread Yitzchak Gale
I wrote:
>>> I suggest adding the following type-specialized variants to
>>> Data.Attoparsec.Char8:
>>>
>>> (<*.) :: Applicative f => f a -> f ByteString -> f a
>>> (<*.) = (<*)
>>>
>>> (.*>) :: Applicative f => f ByteString -> f a -> f a
>>> (.*>) = (*>)

Bryan O'Sullivan wrote:
>> Sounds reasonable. Send a patch?

Felipe Almeida Lessa wrote:
> Done!  It will be in attoparsec-text 0.8.2.0.

Fantastic.! Felipe, thanks so much for this patch, and for
the IsString instance in attoparsec-text.

Regards,
Yitz

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Using IsString with attoparsec

2011-01-28 Thread Felipe Almeida Lessa
On Wed, Jan 26, 2011 at 7:43 PM, Bryan O'Sullivan  wrote:
> On Tue, Jan 25, 2011 at 5:16 AM, Yitzchak Gale  wrote:
>>
>> I suggest adding the following type-specialized variants to
>> Data.Attoparsec.Char8:
>>
>> (<*.) :: Applicative f => f a -> f ByteString -> f a
>> (<*.) = (<*)
>>
>> (.*>) :: Applicative f => f ByteString -> f a -> f a
>> (.*>) = (*>)
>
> Sounds reasonable. Send a patch?

Done!  It will be in attoparsec-text 0.8.2.0.

Bryan, I don't know how to give you a patch using Mercurial, so I've
used 'hg export -r 231 -o ../attoparsec_applicative.hg_export'.  The
patch is basically the same as attoparsec-text's.

Cheers! =)

-- 
Felipe.


attoparsec_applicative.hg_export
Description: Binary data
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Using IsString with attoparsec

2011-01-26 Thread Bryan O'Sullivan
On Tue, Jan 25, 2011 at 5:16 AM, Yitzchak Gale  wrote:

> I suggest adding the following type-specialized variants to
> Data.Attoparsec.Char8:
>
> (<*.) :: Applicative f => f a -> f ByteString -> f a
> (<*.) = (<*)
>
> (.*>) :: Applicative f => f ByteString -> f a -> f a
> (.*>) = (*>)
>

Sounds reasonable. Send a patch?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Using IsString with attoparsec

2011-01-25 Thread Yitzchak Gale
Using the IsString instance for Parser in attoparsec is really nice,
but unfortunately, you can't use it out of the box for the most common
case.

One would like to be able to write parsers in this style:

"(" *> stuff <* ")"

But the types of *> and <* are too general - there is no way for
the type checker to figure out which instance of IsString to use
for the discarded parameter.

I suggest adding the following type-specialized variants to
Data.Attoparsec.Char8:

(<*.) :: Applicative f => f a -> f ByteString -> f a
(<*.) = (<*)

(.*>) :: Applicative f => f ByteString -> f a -> f a
(.*>) = (*>)

Once attoparsec-text gets its IsString instance, I would
add the same thing to Data.Attoparsec.Text, with ByteString
replaced by Text.

I have been using those for both attoparsec and attoparsec-text,
and I find them extremely useful.

Thanks,
Yitz

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe