[Haskell-cafe] Is there Functor instance of Enumerator'
Alexander Solla
alex.solla at gmail.com
Fri Jul 1 19:44:46 CEST 2011
On Fri, Jul 1, 2011 at 7:38 AM, yi huang <yi.codeplayer at gmail.com> wrote:
> Say i want to compose Enumerator ByteString m b and Iteratee Builder
> m b, so I try to transform the enum to Enumerator Builder m b,
> providing function ByteString -> Builder. It's like implement a
> Functor instance for Enumerator. But i failed, there are no way to
> make type system happy.
> Am I right that there is no Functor instance of Enumerator?
I'm pretty sure there is one, but it's a functor over b. So something like:
instance Functor (Enumerator a m)
I think you want to use an Enumeratee:
enumerateeByteStringBuilder :: Enumeratee ByteString Builder m b
Check out map :: (a -> b) -> Enumeratee a b m c
http://hackage.haskell.org/packages/archive/enumerator/0.4.0.1/doc/html/Data-Enumerator.html#v:map
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110701/49bcfda7/attachment.htm>
More information about the Haskell-Cafe
mailing list