[Haskell-cafe] Re: ANNOUNCE: The Monad.Reader - Issue 6

apfelmus at quantentunnel.de apfelmus at quantentunnel.de
Wed Jan 31 08:39:27 EST 2007


Wouter Swierstra wrote:
> I pleased to announce that the latest issue of The Monad.Reader is now
> available:
> [...]

Horray, the long awaited new issue of my favorite breakfast reading is out!

> * Bernie Pope - Getting a Fix from the Right Fold
> [...]

Concerning the strictness of dwBackwards, it suffices to make the
pattern match on (ys,xs) irrefutable:

    dwBackwards predicate = fst . dwPairs predicate

    dwPairs :: (a -> Bool) -> [a] -> ([a], [a])
    dwPairs predicate = foldr combine base
        where
-->     combine next ~(ys, xs)
            | predicate next = (ys, next:xs)
            | otherwise = (next:xs, next:xs)
        base = ([], [])


Regards,
apfelmus



More information about the Haskell-Cafe mailing list