@@ -8,6 +8,7 @@ module Rel8.Tabulate
88 ( Tabulation
99 , tabulate
1010 , tabulateA
11+ , runTabulation
1112 , fromQuery
1213 , liftQuery
1314 , prebind
@@ -132,6 +133,13 @@ instance (EqTable k, Table Expr a, Semigroup a) => Monoid (Tabulation k a)
132133 mempty = emptyTable
133134
134135
136+runTabulation :: EqTable k => Query k -> Tabulation k a -> Query (k, a)
137+runTabulation ks tabulation = do
138+ k <- ks
139+ a <- lookup k tabulation
140+ pure (k, a)
141+
142+
135143liftQuery :: Query a -> Tabulation k a
136144liftQuery query = Tabulation $ const $ fmap (Nothing,) query
137145