Is there a way to declare an implicit val inside a for comprehension?
No, there isn’t. There is a ticket though: https://issues.scala-lang.org/browse/SI-2823
No, there isn’t. There is a ticket though: https://issues.scala-lang.org/browse/SI-2823
This is the triple-equals operator from ScalaTest. Have a look at this page: Getting Started with FunSuite. It says: ScalaTest lets you use Scala’s assertion syntax, but defines a triple equals operator (===) to give you better error messages. The following code would give you an error indicating only that an assertion failed: assert(1 == … Read more
It is strange that no one had suggested NIO.2 operations (available since Java 7): import java.nio.file.{Paths, Files} import java.nio.charset.StandardCharsets Files.write(Paths.get(“file.txt”), “file contents”.getBytes(StandardCharsets.UTF_8)) I think this is by far the simplest and easiest and most idiomatic way, and it does not need any dependencies sans Java itself.