Shapeless: Exploring Generic Programming in Scala
Why Stack Overflow recommends it
Stack Overflow users link it as a primary introduction to shapeless, both for learning the library and as the source of examples such as natural transformations over higher-kinded types.
Recommended by 1 people across 1 different months, 2013 to 2015.
What it is
Miles Sabin presents shapeless at the 2012 Northeast Scala Symposium, showing generic (polytypic) programming in Scala, where programs are parametrized by the shape of data types. He demonstrates the library's capabilities and explains the type class and dependent type techniques behind it. Recorded by InfoQ.
What people said
Recommends 4lex1v · 2013-06 · Stack Overflow · on “how do i start learning shapeless concepts in scala”
I don't know if thats an answer you wan't, but the best push for me to start learning/using shapeless was a couple of Miles videos from different Scala conferences : From flatmap [LINK] ScalaNE 2012 [this video] ScalaNE 2013 [LINK] His forgotten blog [LINK] And as a big practise - i'm writing a lot using Spray toolkit [LINK] , it uses shapeless inside. So try to write some web server or some client. Also a github's wiki contains good intro for the library. Great idea - try to rewrite some case classes into shapeless records with hlists, it's pretty cool to use it with some JSON converter =). Much of it is some generic kind of stuff wich is not very useful in real project, but if you want better u
Cites George · 2013-04 · Stack Overflow · on “How to convert a Tuple of Tuples to a Map”
If you are willing to pull a dependency into your project, this kind of typelevel things are what shapeless [LINK] is good for: > shapeless-core/console [warn] Credentials file /home/folone/.ivy2/.credentials does not exist [info] Compiling 24 Scala sources to /home/folone/workspace/shapeless/core/target/scala-2.11/classes... [info] Starting scala interpreter... [info] Welcome to Scala version 2.11.0-20130205-141957-132e09fc2e (OpenJDK 64-Bit Server VM, Java 1.7.0_17). Type in expressions to have them evaluated. Type :help for more information. scala> import shapeless._ import shapeless._ scala> import Tuples._ import Tuples._ scala> val tuples = (("a", 3), ("b", 1), ("c", 7), ("z", 10)) tup
Cites Kevin Meredith · 2015-04 · Stack Overflow · on “Trait with Higher-Kinded Types”
Given the following trait (from this helpful shapeless talk [this video] ): scala> trait NatT[F[_], G[_]] { def apply[T](f: F[T]): G[T] } warning: there were two feature warnings; re-run with -feature for details defined trait NatT I believe this means that NatT accepts two higher-kinded parameters: F and G . With this assumption, I tried to make an instance where F and G have type Option : scala> case object Maybe extends NatT[Option, Option] { | override def apply(f: Option[Int]) = f | } <console>:8: error: object creation impossible, since method apply in trait NatT of type [T](f: Option[T])Option[T] is not de fined case object Maybe extends NatT[Option, Option] { ^ <console>:9: error: method