On Monday, February 10, 2014 3:40:35 AM UTC-5, Danny Navarro wrote:

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. 
>
 
I wondered about this yesterday, thinking that `zoom`, `view` and maybe 
`over`
are the only essential operations. But with e.g.

      pview :: Monad m 
            => FoldLike' (Producer b m s) (Producer a m r) (Producer b m s)
            -> Producer a m r -> Producer b m s
      pview = view

      pzoom :: Monad m 
             => LensLike' (Zooming m c) (Producer a m r) (Producer b m s) 
             -> StateT (Producer b m s) m c -> StateT (Producer a m r) m c
      pzoom = zoom

the first few lines of the error message tended 
to be a little better, but these would 
be followed by the familiar explosion unpacking 
the synonyms for `Producer` and  `LensLike`.  
(I sort of favor exporting something like these since
it is in any case odd to have to decide amongst
libraries in order to apply a function to an argument)

I worried about this when the lenses were first 
introduced, but after Gabriel's wonderful parsing 
tutorial, it seemed to me that it was obviously 
worth it. Now I don't know what to think. 

It did occur to me that if one backs up a 
little it might seem like plain common sense 
that the lenses belong in separate associated 
modules. No one would recommend a global 
replacement of `fst` by `_1` , and similarly 
in other cases, especially given the type `_1` 
has in Control.Lens. 

One problem with this is that it is pretty clear 
that the use of the lenses with zoom is an  
essential ingredient of the parser concept 
Gabriel is explaining. One wouldn't want to 
duplicate each function, once for operating 
on Producers and again for operating on 
StateT (Producers ...)

Michael



-- 
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