Skip to content

Decimal IR for DivWithDefault has the wrong return type #1130

Description

@michelchan

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.

Activity

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

Metadata

Metadata

Assignees

Labels

taskTask level project item

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions