Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SuspendExact #34

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

SuspendExact #34

wants to merge 1 commit into from

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