If you were looking for Shapeless, here is the link.
Shapelse (shape + else) is a small abstraction layer on top of Shapeless. As an abstraction layer it has less freedom in usage but in some cases it's more convenient to use.
Shapelse allows deriving strictly defined Shapes for your ADTs (what is ADT?).
Why? Originally, I needed to implement automatic derivation for Json Schema encoders. But then I realized that similar structure can be used in different cases, for example, if you need print your data in table view with pretty column titles. That's why it was extracted into this library.
Currently, Shapelse supports the following types:
Type | Comment |
---|---|
primitives | Boolean , Char , String , Byte , Short , Int , Long , Float , Double |
case classes (products)* | |
sealed traits extended by case classes (coproducts)* | |
Option * |
|
List * |
* Can contain any other supported types.
Shape is a simple algebraic data type:
Let's say, you have the following annotation and ADT:
case class says(s: String) extends StaticAnnotation
sealed trait Animal
@says("oof") case class Dog(name: String) extends Animal
@says("meow") case class Cat(name: String) extends Animal
TBD