This is a little trick to turn an executable Java jar.
It works on all unixy like systems including Linux, MacOS, Cygwin, and Windows Linux subsystem.
$ ls
hello.jar| scala> import shapeless._, syntax.singleton._, record._ | |
| import shapeless._ | |
| import syntax.singleton._ | |
| import record._ | |
| scala> object ->> { | |
| | def unapply[K, V](f: FieldType[K, V])(implicit k: Witness.Aux[K]) = Option((k.value, f: V)) | |
| | } | |
| defined module $minus$greater$greater |
Some of these practices might be based on wrong assumptions and I'm not aware of it, so I would appreciate any feedback.
avoiding some dependency conflicts:
~/.sbt/{0.13,1.0}/plugins/plugins.sbtundeclaredCompileDependencies and make the obvious missing dependencies explicit by adding them to libraryDependencies of each sub-projectunusedCompileDependencies and remove some obvious unused libraries. This has false positives, so ; reload; Test/compile after each change and ultimately run all tests to see that it didn't break anythingundeclaredCompileDependenciesTest to the CI pipeline, so that it will fail if you have some undeclared dependencieskeeping dependencies up to date and resolving conflicts:
Daniel Ciocîrlan recently published a video showcasing a dependency-injection (DI) approach developed by Martin Odersky that uses Scala's implicit resolution to wire dependencies automatically. (See also his reddit post.)
The basic pattern for defining services in Odersky's approach is as follows:
class Service(using Provider[(Dep1, Dep2, Dep3)])