I have a simple for-comprehension code:
def nameFormatter(request: SomeRequest) : FormattedData = {
for {
config <- ZIO.fromOption(configuration.get(request.name)).orElseFail( new Exception("Unknown config"))
name = config.data.name.pipe(SomeName)
} yield FormattedData(
name,
request.age
)
}
But this method returns:
ZIO[Any, Exception, FormattedData]
I would like to change this method to return only FormattedData
, not the whole ZIO. Is it possible? Or maybe I should somehow read returned type and get value from it?