{-
  Purpose:
    Test bifold code shown in post:
      http://article.gmane.org/gmane.comp.lang.haskell.cafe/83874
-}

module Bifold where
  {--}
  bifold :: (l -> a -> r -> (r,l)) -> (l,r) -> [a] -> (r,l)
  bifold _ (l,r) [] = (r,l)
  bifold f (l,r) (a:as) = (ra,las)
   where (ras,las) = bifold f (la,r) as
         (ra,la) = f l a ras
  {--}
