Last active
December 16, 2015 15:09
-
-
Save felipehummel/5453999 to your computer and use it in GitHub Desktop.
This file contains hidden or 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> trait MyTrait extends (String => Int => Int) | |
defined trait MyTrait | |
scala> class X extends MyTrait { | |
| def apply(x: String)(i: Int): Int = 10 | |
| } | |
<console>:8: error: class X needs to be abstract, since method apply in trait Function1 of type (v1: String)Int => Int is not defined | |
(Note that T1 does not match String) | |
class X extends MyTrait { |
This file contains hidden or 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> class X extends MyTrait { | |
| def apply(x: String): Int => Int = (x: Int) => 10 | |
| } | |
defined class X |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This works:
scala> class X extends MyTrait {
| def apply(x: String): Int => Int = (x: Int) => 10
| }
defined class X