Skip to content

Instantly share code, notes, and snippets.

@rrmckinley
Created August 20, 2013 17:35
Show Gist options
  • Save rrmckinley/6284631 to your computer and use it in GitHub Desktop.
Save rrmckinley/6284631 to your computer and use it in GitHub Desktop.
object ShapelessTest extends App {
import shapeless._
import record._
import ops.hlist.ToList
import ops.record.{ Keys, Values }
import syntax.singleton._
val ps = List(
("name" ->> "Mel") ::
("age" ->> 90L) ::
("teeth" ->> 2) :: HNil,
("name" ->> "Jude") ::
("age" ->> 99L) ::
("teeth" ->> 3) :: HNil,
("name" ->> "Bif") ::
("age" ->> 1L) ::
("teeth" ->> 1) :: HNil
)
ps.sortBy(_("age") + 0L) // wookie
ps.sortBy(_("teeth") + 0) // wookie
ps.sortBy(_("age")) // no wookie
ps.sortBy(_("teeth")) // no wookie
// - not enough arguments for method sortBy: (implicit ord:
// scala.math.Ordering[Long with
// shapeless.record.KeyTag[String("age")]])List[shapeless.::[String with
// shapeless.record.KeyTag[String("name")],shapeless.::[Long with
// shapeless.record.KeyTag[String("age")],shapeless.::[Int with
// shapeless.record.KeyTag[String("teeth")],shapeless.HNil]]]]. Unspecified
// value parameter ord.
// - No implicit Ordering defined for Long with
// shapeless.record.KeyTag[String("age")].
// - Implicit conversions found: _ => recordOps(_)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment