BAM Weblog

Foldable1/Traverse1 for scalaz

Brian McKenna — 2012-06-24

I’ve started work on adding Foldable1 and Traverse1 to scalaz. Pretty similar to the semigroupoids package:

http://hackage.haskell.org/packages/archive/semigroupoids/1.3.2.1/doc/html/Data-Semigroup-Foldable.html

The idea is to move over the following from Foldable to Foldable1:

  • foldMap1
  • foldr1
  • foldl1
  • maximum
  • minimum

Those functions will then be total and won’t need to return Option. Other methods can be defined in Foldable1 (e.g. suml1, sumr1) which will only require a Semigroup instead of a Monoid.

I’m also creating Traverse1 which relaxes Traverse’s Applicative restrictions to Apply.

My incomplete changes live on my fork.

Please enable JavaScript to view the comments powered by Disqus.