Mutare.Decimal.ModeSwap (mutare_decimal v0.1.0)

Copy Markdown View Source

:decimal_mode_swap — swaps Decimal rounding and string-format mode atoms.

The family targets mode arguments whose legal value set is Decimal-specific:

Decimal.round(num, places, :half_up)     # -> :half_down / :half_even
Decimal.round(num, places, :ceiling)     # -> :floor
Decimal.round(num, places, :up)          # -> :down
Decimal.to_string(num, :normal)          # -> :xsd / :raw
Decimal.to_string(num, :scientific, opts) # -> :normal / :xsd / :raw

Piped calls are supported when the mode argument is visible in the pipe stage.

Ownership split with the drop families: where dropping the mode argument already yields the default-mode program — Mutare.Decimal.DefaultDrop drops round/3's mode (equivalent to :half_up) and Mutare.Decimal.LimitsDrop drops to_string/2's format (equivalent to :scientific) — this family does not also swap to that default, so the two never mint the same mutant. to_string/3's format has no drop twin (LimitsDrop drops its trailing options instead), so :scientific stays a swap target there. Because :half_up can then never be a swap target, it is not part of this family's variant vocabulary.

Summary

Functions

The target-mode labels accepted by qualified mutare ignore directives.

Functions

variants()

@spec variants() :: [atom()]

The target-mode labels accepted by qualified mutare ignore directives.