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

Decimal IR for DivWithDefault has the wrong return type #1130

Open
michelchan opened this issue Jan 4, 2024 · 0 comments
Open

Decimal IR for DivWithDefault has the wrong return type #1130

michelchan opened this issue Jan 4, 2024 · 0 comments
Assignees
Labels
task Task level project item

Comments

@michelchan
Copy link
Contributor

The SDK doesn't match the IR for Decimal.divideWithDefault. This is causing issues when implementing it properly in Morphir-Scala because it doesn't match.

DivWithDefault SDK implementation that returns Decimal:

{-| Divide two decimals providing a default for the cases the calculation fails, such as divide by zero or overflow/underflow.
-}
divWithDefault : Decimal -> Decimal -> Decimal -> Decimal
divWithDefault default a b =
div a b |> Maybe.withDefault default

DivWithDefault IR that returns Maybe Decimal:

, vSpec "divWithDefault" [ ( "default", decimalType () ), ( "a", decimalType () ), ( "b", decimalType () ) ] (maybeType () (decimalType ()))

It should be Decimal.

@michelchan michelchan added the task Task level project item label Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
task Task level project item
Projects
None yet
Development

No branches or pull requests

1 participant