Skip to content
This repository has been archived by the owner on Sep 1, 2020. It is now read-only.

Latest commit

 

History

History
101 lines (71 loc) · 4.04 KB

2.12.0.md

File metadata and controls

101 lines (71 loc) · 4.04 KB

Typelevel Scala 2.12.0

The Typelevel Scala additions to Lightbend Scala 2.12.0 can be found on the branch 2.12.0-bin-typelevel of this repository.

Typelevel Scala 2.12.0 offers the following fixes and features over Lightbend Scala 2.12.0,

  • Support for literal types (aka SIP-23) — proposed for Lightbend Scala 2.12.1.

    Implements literal types. Enabled by -Yliteral-types.

    Literals can now appear in type position, designating the corresponding singleton type. A scala.ValueOf[T] type class and corresponding scala.Predef.valueOf[T] operator has been added yielding the unique value of types with a single inhabitant. Support for scala.Symbol literal types has been added.

  • A partial fix for SI-7046 — proposed for Lightbend Scala 2.12.1.

    The macro API call knownDirectSubclasses now yields the correct result in most cases and will report an error in cases where it is unable to yield the correct result.

    This is only a partial fix because subclasses defined in local scopes might be missed by knownDirectSubclasses. In mitigation it is very likely that a local subclass would represent an error in any scenario where knownDirectSubclasses might be used. An error will be reported in these cases.

    Full details on the pull request.

The following have already been merged in Lightbend Scala 2.12.x and so are included here automatically,

  • Support for partial unification (ie. a fix for SI-2712) — merged in Lightbend Scala 2.12.0-RC1.

    An improvement to type inference for type constructors, enabled by the -Ypartial-unification scalac option. This has many benefits for libraries, such as Cats and Scalaz, which make extensive use of higher-kinded types.

    Full details on the pull request.

  • A fix for SI-9760 — merged in Lightbend Scala 2.12.0-RC1.

    Higher kinded type arguments are now refined by GADT pattern matching. Details can be found on the ticket.

How to use Typelevel Scala 2.12.0 with SBT

There are two requirements for using Typelevel Scala in your existing projects,

  • You must be using (or be able to switch to) Lightbend Scala 2.12.0.
  • You must be using (or be able to switch to) SBT 0.13.13 or later. Earlier versions of SBT don't have full support for using an alternative scalaOrganization.

If these conditions are met the following steps will build your project with Typelevel Scala,

  • Ensure that your project/build.properties specifies SBT 0.13.13,

    sbt.version=0.13.13
    
  • Add the following to your build.sbt immediately next to where you set scalaVersion,

    scalaOrganization in ThisBuild := "org.typelevel"
    

    Alternatively, if you want to try Typelevel Scala without modifying your build.sbt you can instead create a file local.sbt at the root of your project with the following content,

    scalaOrganization in ThisBuild := "org.typelevel"
    

    This will be merged with your main build definitions and can be added to .gitignore or .git/info/exclude if so desired.

Now your build should function as before but using the Typelevel Scala toolchain instead of the Lightbend one. You can verify this from the SBT prompt,

> show scalaOrganization
[info] org.typelevel
>

How to use Typelevel Scala 2.12.0 with Maven

If you are using maven with the scala-maven-plugin, set the <scalaOrganization> to org.typelevel,

<plugin>
  <groupId>net.alchim31.maven</groupId>
  <artifactId>scala-maven-plugin</artifactId>
  <version>3.2.1</version>
  <configuration>
    <scalaOrganization>org.typelevel</scalaOrganization>
  </configuration>
</plugin>