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

Scala direct syntax DSL #66

Merged
merged 6 commits into from
May 17, 2023
Merged

Scala direct syntax DSL #66

merged 6 commits into from
May 17, 2023

Conversation

nomisRev
Copy link
Contributor

No description provided.

@@ -57,8 +57,11 @@ inline fun <A> ai(noinline block: suspend AIScope.() -> A): AI<A> = block
*
* This operator is **terminal** meaning it runs and completes the _chain_ of `AI` actions.
*/
suspend inline fun <A> AI<A>.getOrElse(crossinline orElse: suspend (AIError) -> A): A =
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We weren't using reified here.

@OptIn(ExperimentalTime::class)
suspend inline fun <reified A> AI<A>.getOrElse(crossinline orElse: suspend (AIError) -> A): A =
suspend fun <A> AIScope(block: suspend AIScope.() -> A, orElse: suspend (AIError) -> A): A =
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We needed a way to construct AIScope from Scala, so it cannot be inline. This method allows us to have an convenient entry point from Scala.

@nomisRev
Copy link
Contributor Author

nomisRev commented May 16, 2023

@xebia-functional/team-ai This PR is ready for review. I propose we merge this skeleton, so we can continue in parallel on filling in some smaller parts. WDYT?

Copy link
Contributor

@juanpedromoreno juanpedromoreno left a comment

Choose a reason for hiding this comment

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

Sounds good to me, thanks @nomisRev !

@nomisRev nomisRev merged commit 9cae441 into main May 17, 2023
@nomisRev nomisRev deleted the scala-direct-dsl branch May 17, 2023 07:58
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.

4 participants