[Haskell-cafe] mapping an Enumerator

2011-12-21 Thread Kannan Goundan
I'm using the Data.Enumerator library. I'm trying to write a map function that converts an Enumerator of one type to another. Something like: mapEnum :: Monad m = (a - b) - Enumerator a m r - Enumerator b m r Any hints? (My exact use case is that I have a

Re: [Haskell-cafe] mapping an Enumerator

2011-12-21 Thread Michael Snoyman
On Wed, Dec 21, 2011 at 12:35 PM, Kannan Goundan kan...@cakoose.com wrote: I'm using the Data.Enumerator library.  I'm trying to write a map function that converts an Enumerator of one type to another. Something like:   mapEnum :: Monad m =          (a - b) -          Enumerator a m r -    

Re: [Haskell-cafe] mapping an Enumerator

2011-12-21 Thread Kannan Goundan
Michael Snoyman wrote: On Wed, Dec 21, 2011 at 12:35 PM, Kannan Goundan kan...@cakoose.com wrote: I'm using the Data.Enumerator library.  I'm trying to write a map function that converts an Enumerator of one type to another. Something like:   mapEnum :: Monad m =          (a - b) -      

Re: [Haskell-cafe] mapping an Enumerator

2011-12-21 Thread Michael Snoyman
On Wed, Dec 21, 2011 at 12:59 PM, Kannan Goundan kan...@cakoose.com wrote: Michael Snoyman wrote: On Wed, Dec 21, 2011 at 12:35 PM, Kannan Goundan kan...@cakoose.com wrote: I'm using the Data.Enumerator library.  I'm trying to write a map function that converts an Enumerator of one type to

Re: [Haskell-cafe] mapping an Enumerator

2011-12-21 Thread Kannan Goundan
Michael Snoyman wrote: On Wed, Dec 21, 2011 at 12:59 PM, Kannan Goundan kan...@cakoose.com wrote: Michael Snoyman wrote: On Wed, Dec 21, 2011 at 12:35 PM, Kannan Goundan kan...@cakoose.com wrote: I'm using the Data.Enumerator library.  I'm trying to write a map function that converts an

Re: [Haskell-cafe] mapping an Enumerator

2011-12-21 Thread Erik de Castro Lopo
Kannan Goundan wrote: You're right -- now that I think about it, I don't really care what the type of 'r' is. (Boy, I could have saved several hours today if I had realized that earlier :-) I seem to be hitting exactly the same problem. I constrain my types too early and the compiler can't

Re: [Haskell-cafe] mapping an Enumerator

2011-12-21 Thread John Millikin
The presence of (Step b m r) is an artifact of Haskell's type system. It can be removed through use of language extensions and 'forall' to give a more aesthetically pleasing signature, but there should be no behavioral difference. On Wed, Dec 21, 2011 at 03:26, Michael Snoyman mich...@snoyman.com