Introduction to Shapeless !

Knoldus Blogs

Shapeless is a type class and dependent type based generic programming library for Scala. It is an Open Source project under the Apache License v2, hosted on github.

Well, simply put, it is a well known library for generic programming in scala.

Earlier, reflection APIs were used to write generic programs. However, since reflection is usually done in runtime, it sacrifices type-safety, and introduces runtime failures.

But luckily, Shapeless is there to solve problems during compilation where they would normally be tackled in runtime. Shapeless aims to give you confidence that if a piece of code compiles, it will run as well.

Using Shapeless:

To include the Shapeless in your SBT project for scala 2.11.8 you should add the following in your SBT build,

libraryDependencies ++= Seq("com.chuusai" %% "shapeless" % "2.3.1")

Shapeless has a wide range of features. Lets have a look at two of…

View original post 651 more words

Leave a comment