on master help sign in
Add back runTabulation, but with explicit keys
commite548510aa4aef05a2d81f774a157e057f62256d3 authorShane O'Brien <shane.obrien@circuithub.com> dateMon 14 Jun 2021, 20:38 (5 years ago) parenta3b32bd
1 file changed+8
src/Rel8/Tabulate.hs+8
src/Rel8/Tabulate.hs+8
@@ -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