Functional Weave
Code in Python

money.sum@1.0.0

impl/python.py

284 bytes · the Python implementation · view raw

Imports name this capability’s declared dependencies, which fune builds next to it in your project; each one links to its page.

from typing import Iterable

from .money_add import add_money  ← from money.add ^1.0.0 · built alongside by fune
from .money_amount import Money, money  ← from money.amount ^1.0.0 · built alongside by fune


def sum_money(amounts: Iterable[Money], currency: str) -> Money:
    total = money(0, currency)
    for amount in amounts:
        total = add_money(total, amount)
    return total