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