@@ -1449,7 +1449,11 @@ withUnions tables =
1449
1449
bracket (unions tables) closeTable
1450
1450
1451
1451
{- |
1452
- Create a table that contains the left-biased union of the entries of the given tables.
1452
+ Create a table that contains the union of the entries of the given tables.
1453
+
1454
+ If the given key is a member of a single input table, then the same key and value occur in the output table.
1455
+ Otherwise, the values for duplicate keys are combined using 'resolve' from left to right.
1456
+ If the 'resolve' function behaves like 'const', then this computes a left-biased union.
1453
1457
1454
1458
The worst-case disk I\/O complexity of this operation is \(O(n)\).
1455
1459
@@ -1651,7 +1655,7 @@ _withInternalTables (Table (table :: Internal.Table m h) :| tables) action =
1651
1655
Get the amount of remaining union debt.
1652
1656
This includes the union debt of any table that was part of the union's input.
1653
1657
1654
- The worst-case disk I\/O complexity of this operation is \(O\ (1)\).
1658
+ The worst-case disk I\/O complexity of this operation is \(O(1)\).
1655
1659
-}
1656
1660
{-# SPECIALISE
1657
1661
remainingUnionDebt ::
@@ -1669,6 +1673,12 @@ remainingUnionDebt (Table table) =
1669
1673
{- |
1670
1674
Supply the given amount of union credits.
1671
1675
1676
+ This reduces the union debt by /at least/ the number of supplied union credits.
1677
+ It is therefore advisable to query 'remainingUnionDebt' every once in a while to see what the current debt is.
1678
+
1679
+ This function returns any surplus of union credits as /leftover/ credits when a union has finished.
1680
+ In particular, if the returned number of credits is positive, then the union is finished.
1681
+
1672
1682
The worst-case disk I\/O complexity of this operation is \(O(b)\),
1673
1683
where the variable \(b\) refers to the amount of credits supplied.
1674
1684
0 commit comments