A relaxed chat room about all things Scala. Beginner questions welcome. https://scala-lang.org/conduct/ applies
SethTisue on 2.13.x
2.12: new Scala SHA (#1399) unfork specs2 Merge commit '4bafba0925491ab34… and 1 more (compare)
SethTisue on 2.12.x
unfork specs2 (compare)
ok
is what I want
Anyone has an idea how to override common configuration in included configuration that referenced with environment variable? For example, I have common.conf
that has all common configurations and local.conf
that override common configurations as per local environment.
common.conf
myapp {
server-address = ${SERVER_HOSTNAME}
server-port = ${SERVER_PORT}
}
----------------------
local.conf
include "common"
# override default (Common) settings
myapp {
server-address = "localhost"
server-port = 9000
}
while loading local.conf
. I am getting below error.
Could not resolve substitution to a value: ${SERVER_HOSTNAME}
items => s"find $itemNum in the available list" >> items.map(_.itemNumber).should(contain(itemNum))
I wasted a day struggling with this:
trait Model {
type State
}
trait Algorithm {
val model: Model
type State = model.State
def infer: State
}
val m: Model = new Model {
type State = Int
}
val a = new Algorithm {
val model = m
def infer = 1
}
This throws an error:
ScalaFiddle.scala:21: error: type mismatch;
found : scala.this.Int(1)
required: $anon.this.State
(which expands to) $anon.this.model.State
def infer = 1
^
I stared at the longest time on the definition of val a
because that's where the error was coming from, but eventually realized the cause was my definition of val m
. If I remove the : Model
and make it val m = new Model {...}
it works.
: Model
you remove the refinement
m: Model {type State = Int }
Int
later
List[Algorithm]
Algorithm[State]
you woudn't be able to put them in a List with a proper type