on master help sign in
Add back runTabulation, but with explicit keys
e548510Shane O'Brien
src/Rel8/Tabulate.hs+8
@@ -8,6 +8,7 @@ module Rel8.Tabulate
8 ( Tabulation
8 ( Tabulation
9 , tabulate
9 , tabulate
10 , tabulateA
10 , tabulateA
11+ , runTabulation
11 , fromQuery
12 , fromQuery
12 , liftQuery
13 , liftQuery
13 , prebind
14 , prebind
@@ -132,6 +133,13 @@ instance (EqTable k, Table Expr a, Semigroup a) => Monoid (Tabulation k a)
132 mempty = emptyTable
133 mempty = emptyTable
133
134
134
135
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+
135liftQuery :: Query a -> Tabulation k a
143liftQuery :: Query a -> Tabulation k a
136liftQuery query = Tabulation $ const $ fmap (Nothing,) query
144liftQuery query = Tabulation $ const $ fmap (Nothing,) query
137
145