So I was thinking some more about this, and I was wondering if perhaps the
solution would be to simply explain in the `pipes-parse` tutorial how to
simplify type errors using the trick of defining an intermediate non-lens
function.
The tutorial would say (in more words) that if you have a type error with a
`lens` of type `Lens (Producer a m x) (Producer b m y)` while using `view`,
then you should convert it to an intermediate ordinary function like this:
intermediate :: Producer a m x -> Producer b m y
intermediate = view lens
... then use that `intermediate` function for better type error inference.
Similarly, if you have a type error using the `lens` with a `zoom`, then
you convert it to the following intermediate ordinary function:
intermediate:: StateT (Producer b m y) m r -> StateT (Producer a m x) m
r
intermediate = zoom lens
Teaching beginners how to do this would help them improve type errors
without having to add redundant functions to the API.
--
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].