Better (multi-nested-)tagged types for Scala

  • Zero-dependcy 1 file
  • Scala: 2.11.11, 2.12.1, 2.12.2
  • Wrap in tag with handy apply
  • Able to dive into containers, e.g.
// No matter how many levels, it will stop automatically at appropriate (or fail if no)
val array_5lvl_OfWidth = Width @@ Array(Array(Array(Array(Array(1,2,3))))) // Result: `array_5lvl_OfWidth: Array[Array[Array[Array[Array[Int @@ Width]`
  • Bounded && plain. Combine them all
val offsetsInt = Offsets[Width] @@ (Width @@ Array(1,2,3)) // Result: `Array[Int @@ Width] @@ Offsets[Width]`
  • Multi tagging
val value = Width @@ (Height @@ 5)) // Result: `Int @@ (Height with Width)`
  • Automatically lifts typeclasses to tags

PRs, reviews, questions and comments are welcomed!

1 Like