/plankton

minimal Predef replacement for scala

Primary LanguageScala

Plankton

This project was created to provide alternative options to scala.Predef as a set of default imports.

Requirements

You must be using a scalac which supports -Ysysdef and -Ypredef, right now the only released compiler which does this is the typelevel compiler version 2.12.1 or greater, although there is a ticket open with the upstream compiler to add this feature, see this pull request.

So at least for now, you'll need this in your build.sbt:

scalacOrganization := "org.typelevel"
scalacVersion := "2.12.1"

Quick Start

The easiest way to use plankton is to use the sbt-plugin, which will set your scalacOptions. Add or modify a file such as project/plguins.sbt:

resolvers += Resolver.url(
  "bintray-stew",
  url("http://dl.bintray.com/stew/plankton"))(
  Resolver.ivyStylePatterns)

addSbtPlugin("io.github.stew" % "sbt-plankton" % "0.0.7")

Then in your project definition (usually in build.sbt), you enable the plugin, and select a planktonFlavor:

resolvers += Resolver.url(
  "bintray-stew",
  url("http://dl.bintray.com/stew/plankton"))(
  Resolver.ivyStylePatterns)

enablePlugins(ZooPlankton)

If I had more sbt-fu, I'd get rid of this "resolvers += crap", perhaps once I move this to sonatype.

There are currently two flavors offered:

  • Phyto - A minimal Predef with just a safe subset of the standard Predef
  • Zoo - A Predef that also includes Typelevel Cats

This feature relies on the -Ypredef and -Ysysdef scalac compiler flags added to Typelevel scala. See for more information.

Compiler Flags

We trust Rob