typelevel-toolkit
A toolkit of great libraries to start building Typelevel apps on JVM, Node.js, and Native!
Our very own flavour of the Scala Toolkit.
The toolkit does not yet support Scala Native 0.5.x series.
Overview
Typelevel toolkit is a meta library that currently includes these libraries:
- Cats and Cats Effect
- fs2 and fs2 I/O
- fs2 data csv and its generic module
- Http4s Ember client
- Circe and http4s integration
- Decline Effect
- Munit Cats Effect
and it's published for Scala 2.13 and 3.3+.
To use it with Scala CLI use this directive:
//> using toolkit typelevel:default
Albeit being created to be used with Scala CLI, typelevel-toolkit can be imported into your build.sbt
using:
libraryDependencies ++= Seq(
"org.typelevel" %% "toolkit" % "0.1.29",
"org.typelevel" %% "toolkit-test" % "0.1.29" % Test
)
// use %%% for Scala.js and Scala Native
libraryDependencies ++= Seq(
"org.typelevel" %%% "toolkit" % "0.1.29",
"org.typelevel" %%% "toolkit-test" % "0.1.29" % Test
)
Quick Start
Getting started with the toolkit is as simple as running a single command:
scala-cli --power new typelevel/toolkit.g8
Example
//> using toolkit typelevel:default
import cats.effect.*
object Hello extends IOApp.Simple:
def run = IO.println("Hello toolkit!")
//> using toolkit typelevel:default
import cats.effect._
object Hello extends IOApp.Simple {
def run = IO.println("Hello toolkit!")
}
Scala Native usage
Since the native flavour of most of the Typelevel libraries is, at the moment, built against Scala Native 0.4.15, when using Scala CLI you have to declare the Scala native's version, i.e.
//> using toolkit typelevel:default
//> using platform native
//> using nativeVersion 0.4.15
import cats.effect.*
object Hello extends IOApp.Simple:
def run = IO.println("Hello toolkit!")
//> using toolkit typelevel:default
//> using platform native
//> using nativeVersion 0.4.17
import cats.effect._
object Hello extends IOApp.Simple {
def run = IO.println("Hello toolkit!")
}
Native Image
When building GraalVM Native Image the --no-fallback
option is required, otherwise native-image will try searching
a static reflection configuration for this Enumeration method. Thus using this flag is safe only if you're not using
Enumerations in your codebase, see this comment for more info.