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.carr...@gmail.com> 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-pipes+unsubscr...@googlegroups.com > <mailto:haskell-pipes+unsubscr...@googlegroups.com>. > To post to this group, send email to haskell-pipes@googlegroups.com > <mailto:haskell-pipes@googlegroups.com>. -- 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.