No description, website, or topics provided.
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.idea Initial commit. Feb 9, 2019
project Initial commit. Feb 9, 2019
src Initial commit. Feb 9, 2019
.gitignore
LICENSE Initial commit. Feb 9, 2019
README.adoc No asciidoc rendering for .ad files? Feb 9, 2019
build.sbt Initial commit. Feb 9, 2019

README.adoc

zygf.boxed

This is a tiny typeclass library for Scala that facilitates generic conversions between unboxed and boxed types on the JVM.

It might sometimes, possibly be somewhat useful for interop with Java code.

Usage

import zygf.boxed._

Obtaining a runtime class object with no ClassTag allocation overhead:

def foo[T: UnboxedClass]: Class[T] = Boxed.unboxedClass[T]

Obtaining a runtime class object for the boxed variant of a type, with no ClassTag allocation overhead:

def foo[T: BoxedClass](implicit boxed: Boxed[T]): Class[box.Type] = Boxed.boxedClass[T]

Typing a generic function that takes an unboxed type argument and has a boxed return type:

def foo[T](implicit boxed: Boxed[T]): boxed.Type = boxed.box(???)