Dorian Codes
06/22/2021, 3:40 PMdata class Config(val map: Map<String, String>) {
suspend fun <A> parse(read: Read<A>, key: String) = either<ConfigError, A> {
val value = Validated.fromNullable(map[key]) {
ConfigError.MissingConfig(key)
}.bind()
val readVal = Validated.fromNullable(read.read(value)) {
ConfigError.ParseConfig(key)
}.bind()
readVal
}
In particular I wasn't able to call bind()
from a Validated
. Is that something I am missing? Also I noticed that bind()
is not listed among the functions for Validated
in the docs. I'm using arrow-core version 0.11.0
Cody Mikol
06/22/2021, 5:18 PMCody Mikol
06/22/2021, 5:19 PMthis
context inside the either { } lambdaDorian Codes
06/23/2021, 12:29 PM