neko-kai / izumi-reflect

TypeTag without scala-reflect

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build [Github Actions]

izumi-reflect

In case something looks like a TypeTag and works like a TypeTag it may be considered as a replacement for the TypeTag

izumi-reflect is a fast, lightweight, portable and efficient alternative for TypeTag from scala-reflect.

izumi-reflect uses its own lightweight model of Scala types and provides a simulator of an important part of Scala typechecker.

Why it's better than scala-reflect

  1. izumi-reflect compiles and initializes lot faster than scala-reflect tags,
  2. izumi-reflect supports ScalaJS and ScalaNative,
  3. izumi-reflect allows you to obtain tags for unapplied types (F[_]) and combine them in runtime.

Credits

izumi-reflect has been implemented by 7mind as part of Izumi and donated to ZIO. This repository contains an independent and more conservative copy of the code comparing to Izumi one.

Izumi

Limitations

izumi-reflect model is imperfect, though "good enough" for the vast majority of the usecases.

Known limitations are:

  1. Type boundaries support is very limited because of a problematic behavior of Scala 2.13 compiler,
  2. Recursive type boundaries/existentials are not supported,
  3. Path-Dependent Types are handled by symbolic names and may cause unexpected false-positives (comparing to Scala typer).

Build

build.sbt is generated by sbtgen. During development you may not want to mess with ScalaJS and ScalaNative, you may generate a pure-JVM Scala project:

./sbtgen.sc

Once you finished tinkering with the code you may want to generate full project and test it for all the platforms:

./sbtgen.sc --js --native

About

TypeTag without scala-reflect

License:Other


Languages

Language:Scala 99.0%Language:Shell 1.0%