Type signature in a where clause

Viewed 3016

I've written a function similar to Data.Enumerator.List.map that makes an Iteratee compatible with an Enumerator that feeds a different Stream type.

import Data.Enumerator

test :: Monad m => (ao -> ai) -> Iteratee ai m b -> Iteratee ao m b
test f iter = go $$ iter
   where go (Continue k) = continue $
            \stream -> go $$ k (fmap f stream)
         go (Yield res _) = yield res EOF

If I omit the type signature for go, this will work just fine. However, I'd like to include it but I'm unable to determine what the correct signature should be. Here's what I think it should be:

go :: Monad m => Step ai m b -> Iteratee ao m b

but that doesn't work.
I need some advice on finding the correct type signature for go.

2 Answers
Related