Created
February 18, 2015 10:58
-
-
Save milessabin/743407c0c46a6eaa17ce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scala> import ops.nat._ | |
import ops.nat._ | |
scala> def foo[T, N <: Nat](l: Sized[Seq[T], N])(implicit ev: LTEq[N, _3]) = l | |
foo: [T, N <: shapeless.Nat](l: shapeless.Sized[Seq[T],N])(implicit ev: shapeless.ops.nat.LTEq[N,shapeless.nat._3])shapeless.Sized[Seq[T],N] | |
scala> val l1 = Sized(1, 2, 3) | |
l1: shapeless.Sized[scala.collection.immutable.IndexedSeq[Int],shapeless.nat._3] = shapeless.Sized@17191095 | |
scala> val l2 = Sized(1, 2, 3, 4) | |
l2: shapeless.Sized[scala.collection.immutable.IndexedSeq[Int],shapeless.nat._4] = shapeless.Sized@babb5a21 | |
scala> foo(l1) | |
res3: shapeless.Sized[Seq[Int],shapeless.nat._3] = shapeless.Sized@17191095 | |
scala> foo(l2) | |
<console>:21: error: could not find implicit value for parameter ev: shapeless.ops.nat.LTEq[shapeless.nat._4,shapeless.nat._3] | |
foo(l2) | |
^ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment