A dependently typed library for auto lifting and auto mapping of functions based on category theory but exposing an api that works in harmony with the standard Scala library.
AutoLifts is organized in a multi-project structure. The following modules are available for download:
autolift-core- contains type class definitions, syntax extensions and contexts.
autolift-algebird- an implementation of core type classes backed by the Algebird project.
autolift-cats- an implementation of core type classes backed by the Cats project.
autolift-scalaz- an implementation of core type classes backed by the Scalaz project.
The core module is a dependency of algebird, cats and scalaz. While it forms the backbone of AutoLifts and can be downloaded, it is not a standalone project. Subprojects such as docs and bench are for reference only.
The current released branch is 0.7 and compiled against Scala version 2.11 and 2.12. If using SBT add the following to the build definition:
libraryDependencies += "com.github.wheaties" %% "autolift-[backend]" % "0.7"
where "backend" is one of algebird, cats or scalaz. As stated above, core will be downloaded as a dependency.
Due note, the api will be subject to change as the library develops and progresses to a 1.0 release. We do not, however, expect there to be any fundamental changes to functionality. Also of note, we expect that the majority of common use items will remain a permanent fixture from this point forward, i.e.
A generalization on the concept of lifting such that functions can be lifted to arbitrarily deep nestings and stacks of Functors, Applicatives, Monads and Traversables. Or, put another way, adds a more powerful
fold that figures out where the best application site is based upon the type of the function. This functionality is exposed via syntax extensions and auto-lifting contexts.
For example, working with a nested type structure, syntax extensions make the following possible:
scala> def addOne(x: Int) = x + 1 scala> val in = Option(List(1, 2, 3)) scala> in liftMap addOne res0: Option[List[Int]] = Some(List(2, 3, 4))
or alternatively the same could be accomplished by wrapping a function in a reusable context:
scala> val liftedOne = liftMap(addOne) scala> liftedOne(List(1, 2, 3)) res1: List[Int] = List(2, 3, 4) scala> liftedOne(List(Option(1), None)) res2: List[Option[Int]] = List(Some(2), None)