I see, thanks! Apart from Dual, what is the purpore of the "Endo" monoid? I don't recall seeing something like it in other optics.
On Tuesday, March 29, 2016 at 12:44:05 AM UTC+2, Gabriel Gonzalez wrote: > > Without it the `Endo` `Monoid` folds things in the wrong order and leaks > space. > > Before using `Dual`, `handles` would give weird behavior like this: > > >>> fold (handles folded list) [“abc”, “def”] > “fedcba" > > > After using `Dual`, `handles` folds things in the right order > > On Mar 28, 2016, at 2:25 PM, Daniel Díaz <diaz.c...@gmail.com > <javascript:>> wrote: > > Hi, > > In the foldl library, the definition of Handler > <http://hackage.haskell.org/package/foldl-1.2.0/docs/Control-Foldl.html#t:Handler> > > is: > > type Handler a b = forall x. (b -> Const > <http://hackage.haskell.org/package/base-4.8.2.0/docs/Control-Applicative.html#t:Const> > (Dual > <http://hackage.haskell.org/package/base-4.8.2.0/docs/Data-Monoid.html#t:Dual> > (Endo > <http://hackage.haskell.org/package/base-4.8.2.0/docs/Data-Monoid.html#t:Endo> > x)) > b) -> a -> Const > <http://hackage.haskell.org/package/base-4.8.2.0/docs/Control-Applicative.html#t:Const> > (Dual > <http://hackage.haskell.org/package/base-4.8.2.0/docs/Data-Monoid.html#t:Dual> > (Endo > <http://hackage.haskell.org/package/base-4.8.2.0/docs/Data-Monoid.html#t:Endo> > x)) > a > > > It resembles the definition of a lens/traversal/fold, but what does the > Dual > <http://hackage.haskell.org/package/base-4.8.2.0/docs/Data-Monoid.html#t:Dual> > (Endo > <http://hackage.haskell.org/package/base-4.8.2.0/docs/Data-Monoid.html#t:Endo> > x) part do? > > -- > 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 haskell-pipe...@googlegroups.com <javascript:>. > To post to this group, send email to haskel...@googlegroups.com > <javascript:>. > > > -- 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 haskell-pipes+unsubscr...@googlegroups.com. To post to this group, send email to haskell-pipes@googlegroups.com.