How to solve such as scenario with arrow? ```fun P...
# arrow
z
How to solve such as scenario with arrow?
Copy code
fun Program.handleRead(id: String?): UserMapper =
    id?.let {
        UUID.fromString(it)?.let { uuid ->
            queries.read(uuid)?.toMapper()
        } ?: throw UUIDWrongFormatException()
    } ?: throw UserNotFoundException()
y
Try the Either monad maybe?
z
But it will be to strict
tagless final
would be nice.
p
MonadError than
ApplicativeError even
i
I used custom error types (instead of exceptions) when it makes sense together with Either and IO (https://github.com/istonikula/realworld-api), I also tried tagless final approach (https://github.com/istonikula/realworld-api/pull/27)
z
Thanks guys