Home

shapeless

Shapeless is a Scala library designed to support generic and type-level programming. It enables programmers to write code that operates on many different data types by converting values to and from generic representations and by manipulating types directly at compile time. The central ideas are heterogeneous lists (HLists), which are lists whose elements can have different types; records, which pair element types with labels; and coproducts, a type-level sum type for representing alternatives.

The library provides the Generic and LabelledGeneric type classes to convert between a concrete case class

Shapeless is widely used to implement boilerplate-free typeclass derivation, to perform generic programming tasks such as

Limitations include increased compile times and complexity, reliance on advanced features of the Scala type system,

or
sealed
trait
family
and
its
generic
representation.
It
also
includes
a
system
of
polymorphic
functions
(Poly),
lazy
evaluation
helpers
(Lazy),
and
a
set
of
type-level
operators
under
shapeless.ops
for
operations
such
as
mapping,
folding,
selecting
fields,
and
deriving
typeclass
instances.
transforming,
encoding,
or
comparing
data
structures,
and
to
build
generic
serializers
or
validators.
It
has
been
developed
in
the
Scala
community,
notably
by
Miles
Sabin,
and
is
maintained
as
part
of
the
broader
Typelevel
ecosystem,
with
contributions
from
many
users.
and
version
compatibility
concerns
with
newer
Scala
releases.