Oh, that was my mistake. `Data.Aeson.Parser.json'` takes `ByteString` input, not `Text`. The solution is to:

* remove the `decodeUTF8` lens completely since you don't need to decode anything for parsing JSON
* use `Pipes.ByteString.lines` instead of `Pipes.Text.lines`
* Change the type signature of `loop` to have a `FreeT (Producer ByteString) ...` instead of `FreeT (Producer Text) ...`

I think that should fix it for you.

On 02/12/2014 05:20 PM, Pierre R wrote:
Thanks so much for your help, Gabriel.

I am surely missing something totally obvious but how do I force `Pipes.Attoparsec.parse` to use the `Data.Attoparsec.Text.Parser` ? I would believe this would be picked up by the signature (Parser Text) but it isn't for some reasons):

jsonParser :: Monad m  => Parser Text m (Either PA.ParsingError Value)
jsonParser = PA.parse json'

  Couldn't match type `ByteString' with `Text'
Expected type: attoparsec-0.11.1.0:Data.Attoparsec.Internal.Types.Parser
                     Text Value
Actual type: attoparsec-0.11.1.0:Data.Attoparsec.ByteString.Internal.Parser
                     Value
    In the first argument of `PA.parse', namely json'
    In the expression: PA.parse json'
    In an equation for `jsonParser': jsonParser = PA.parse json'
--
You received this message because you are subscribed to the Google Groups "Haskell Pipes" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].

--
You received this message because you are subscribed to the Google Groups "Haskell 
Pipes" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].

Reply via email to