The choose method seems to be quite troublesome to use:
getTagContent :: Name -> Consumer Event IO (Maybe (Name, Text))
getTagContent tag = fmap (\content -> fmap (\c -> (tag, c)) content) $ tagIgnoreAttrs tag content
getTagsContent :: [Name] -> Consumer Event IO (Maybe (Name, Text))
getTagsContent tags = choose $ (fmap getTagContent tags)
The compile fails with:
Couldn't match type ‘ConduitM Event o0 IO (Maybe (Name, Text))’
with ‘forall o1. ConduitM Event o1 IO (Maybe (Name, Text))’
Expected type: Name -> Consumer Event IO (Maybe (Name, Text))
Actual type: Name -> ConduitM Event o0 IO (Maybe (Name, Text))
In the first argument of ‘fmap’, namely ‘getTagContent’
In the second argument of ‘($)’, namely ‘(fmap getTagContent tags)’
See also (someone else having this issue): http://stackoverflow.com/questions/33606038/xml-conduit-combining-tagparsers
Asking in #haskell-beginners on Freenode there was a suggestion that the forall in the expansion of Consumer was at the root of this, which seems to make sense, but I've been unable to determine why. Removing the type definition has no material effect on the error either.
The
choosemethod seems to be quite troublesome to use:The compile fails with:
See also (someone else having this issue): http://stackoverflow.com/questions/33606038/xml-conduit-combining-tagparsers
Asking in #haskell-beginners on Freenode there was a suggestion that the forall in the expansion of Consumer was at the root of this, which seems to make sense, but I've been unable to determine why. Removing the type definition has no material effect on the error either.