Assuming most new users will be using `zoom` and `view` initially, would it be feasible to implement dummy versions for just `zoom` and `view` with more concrete types? They could be recommended for debugging and learning but should be replaced in real code.
On Mon, Feb 10, 2014 at 8:51 AM, Kyle Van Berendonck <[email protected]> wrote: > I don't think teaching users how to "hack around" the titanic type error > issue is really a solution though, and certainly not in pipes-parse because > people who are interested in a particular pipes library are less likely to > read it there. > > > On Monday, February 10, 2014 3:28:13 AM UTC+11, Gabriel Gonzalez wrote: >> >> 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]. -- 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].
