1

I'm new to Scala and I'm using the shapeless library to manipulate tuples. (Though this isn't specific to shapeless)

I've run in to a problem related to implicit parameters, which I don't quite understand. Here are there signatures:

def reverse(implicit reverse: Reverse[T]): reverse.Out = reverse(t) def drop[N <: Nat](implicit drop: Drop[T, N]): drop.Out = drop(t) 

And here is it in use:

val foo = ("foo","bar","other").reverse val bar = ("foo","bar","other").drop(1) 

However on Scala 2.10 I get this error:

Error:(25, 37) could not find implicit value for parameter reverse: shapeless.ops.tuple.Reverse[(String, String, String)] val zzy = ("foo","bar","other").reverse

Error:(29, 37) not enough arguments for method reverse: (implicit reverse: shapeless.ops.tuple.Reverse[(String, String, String)])reverse.Out. Unspecified value parameter reverse. val foo = ("foo","bar","other").reverse

 ^ 

I'm not sure what the implicit parameter is that it is trying to reference, or why I need it. Also, this seems to work on 2.11 (but IntelliJ flags it)

1 Answer 1

3

On Scala 2.10.x you need to have the macro-paradise plugin included in your build: see the shapeless documentation here.

IntelliJ often reports spurious errors against code which uses aspects of the Scala type system which it doesn't have adequate support for. This is especially true of code which uses dependent method types as reverse and drop above do (notice that the result type of the methods depend on the argument values). In all cases the command line compiler is authoritative.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.