Skip to content

Conversation

@CLOVIS-AI
Copy link

@CLOVIS-AI CLOVIS-AI commented Jul 28, 2023

Prototype for SuspendExact, which aims to allow validation using external services (e.g. verify that an ID does in fact exist).

Closes #33

public suspend fun fromOrNull(value: Input): Output? = from(value).getOrNull()

public suspend fun fromOrThrow(value: Input): Output =
when (val result = from(value)) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this should use recover({ spec(value) }) { throw ExactException(it) }? To prevent the unnecessary indirection using Either

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Code style

2 participants