Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Abstract Algebra for Scala.

This branch is 53 commits ahead and 0 commits behind master

Fetching latest commit…

Cannot retrieve the latest commit at this time

README.md

Algebird Build Status

Abstract algebra for Scala. This code is targeted at building aggregation systems (via Scalding or Storm). It was originally developed as part of Scalding's Matrix API, where Matrices had values which are elements of Monoids, Groups, or Rings. Subsequently, it was clear that the code had broader application within Scalding and on other projects within Twitter.

Maven

Current version is 0.1.1. groupid="com.twitter" artifact="algebird_2.9.2".

Questions

Why not use Scalaz's Monoid trait?

The answer is a mix of the following:

  • The trait itself is tiny, we just need zero and plus, it is the implementations for all the types that are important. We wrote a code generator to derive instances for all the tuples, and by hand wrote monoids for List, Set, Option, Map, and several other objects used for counting (DecayedValue for exponential decay, AveragedValue for averaging, HyperLogLog for approximate cardinality counting). It's the instances that are useful in scalding and elsewhere.
  • We needed this to work in scala 2.8, and it appeared that Scalaz 7 didn't support 2.8. We've since moved to 2.9, though.
  • We also needed Ring and Field, and those are not (as of the writing of the code) in Scalaz.
  • If you want to interop, it is trivial to define implicit conversions to and from Scalaz Monoid.
  • Scalaz is big and scary for some people. We have enough trouble with adoption without scaring people with Cokleisli star operators.

Authors

License

Copyright 2012 Twitter, Inc.

Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0

Something went wrong with that request. Please try again.