@@ -41,11 +41,10 @@ import Rel8.Generic.Table
42import Rel8.Generic.Record ( Record(..) )
42import Rel8.Generic.Record ( Record(..) )
43import Rel8.Generic.Reify ( ARep )
43import Rel8.Generic.Reify ( ARep )
44−import Rel8.Schema.Context.Label ( Labelable, labeler, unlabeler )
45import Rel8.Schema.HTable ( HTable )
44import Rel8.Schema.HTable ( HTable )
46import Rel8.Schema.HTable.Either ( HEitherTable(..) )
45import Rel8.Schema.HTable.Either ( HEitherTable(..) )
47import Rel8.Schema.HTable.Identity ( HIdentity(..), HType )
46import Rel8.Schema.HTable.Identity ( HIdentity(..), HType )
48−import Rel8.Schema.HTable.Label ( hlabel, hunlabel )
47+import Rel8.Schema.HTable.Label ( hlabel, hrelabel, hunlabel )
49import Rel8.Schema.HTable.List ( HListTable )
48import Rel8.Schema.HTable.List ( HListTable )
50import Rel8.Schema.HTable.Maybe ( HMaybeTable(..) )
49import Rel8.Schema.HTable.Maybe ( HMaybeTable(..) )
51import Rel8.Schema.HTable.NonEmpty ( HNonEmptyTable )
50import Rel8.Schema.HTable.NonEmpty ( HNonEmptyTable )
@@ -61,7 +60,6 @@ import Rel8.Schema.Reify
62import Rel8.Schema.Result
61import Rel8.Schema.Result
63 ( Col( R ), Result
62 ( Col( R ), Result
65 , null, nullifier, unnullifier
63 , null, nullifier, unnullifier
66 , vectorizer, unvectorizer
64 , vectorizer, unvectorizer
@@ -247,20 +245,20 @@ instance (Table Result a, Table Result b) => Table Result (Either a b) where
248 toColumns = \case
246 toColumns = \case
249 Left table -> HEitherTable
247 Left table -> HEitherTable
250− { htag = HIdentity (R IsLeft)
248+ { htag = hlabel (HType (R IsLeft))
251− , hleft = hlabel labeler (hnullify nullifier (toColumns table))
249+ , hleft = hlabel (hnullify nullifier (toColumns table))
252− , hright = hlabel labeler (hnulls (const null))
250+ , hright = hlabel (hnulls (const null))
254 Right table -> HEitherTable
252 Right table -> HEitherTable
255− { htag = HIdentity (R IsRight)
253+ { htag = hlabel (HType (R IsRight))
256− , hleft = hlabel labeler (hnulls (const null))
254+ , hleft = hlabel (hnulls (const null))
257− , hright = hlabel labeler (hnullify nullifier (toColumns table))
255+ , hright = hlabel (hnullify nullifier (toColumns table))
260− fromColumns HEitherTable {htag, hleft, hright} = case htag of
258+ fromColumns HEitherTable {htag, hleft, hright} = case hunlabel htag of
261− HIdentity (R tag) -> case tag of
259+ HType (R tag) -> case tag of
262− IsLeft -> maybe err (Left . fromColumns) $ hunnullify unnullifier (hunlabel unlabeler hleft)
260+ IsLeft -> maybe err (Left . fromColumns) $ hunnullify unnullifier (hunlabel hleft)
263− IsRight -> maybe err (Right . fromColumns) $ hunnullify unnullifier (hunlabel unlabeler hright)
261+ IsRight -> maybe err (Right . fromColumns) $ hunnullify unnullifier (hunlabel hright)
265 err = error "Either.fromColumns: mismatch between tag and data"
263 err = error "Either.fromColumns: mismatch between tag and data"
@@ -279,17 +277,17 @@ instance Table Result a => Table Result (Maybe a) where
280 toColumns = \case
278 toColumns = \case
281 Nothing -> HMaybeTable
279 Nothing -> HMaybeTable
282− { htag = HIdentity (R Nothing)
280+ { htag = hlabel (HIdentity (R Nothing))
283− , hjust = hlabel labeler (hnulls (const null))
281+ , hjust = hlabel (hnulls (const null))
285 Just table -> HMaybeTable
283 Just table -> HMaybeTable
286− { htag = HIdentity (R (Just IsJust))
284+ { htag = hlabel (HIdentity (R (Just IsJust)))
287− , hjust = hlabel labeler (hnullify nullifier (toColumns table))
285+ , hjust = hlabel (hnullify nullifier (toColumns table))
290− fromColumns HMaybeTable {htag, hjust} = case htag of
288+ fromColumns HMaybeTable {htag, hjust} = case hunlabel htag of
291− HIdentity (R tag) -> tag $>
289+ HType (R tag) -> tag $>
292− case hunnullify unnullifier (hunlabel unlabeler hjust) of
290+ case hunnullify unnullifier (hunlabel hjust) of
293 Nothing -> error "Maybe.fromColumns: mismatch between tag and data"
291 Nothing -> error "Maybe.fromColumns: mismatch between tag and data"
294 Just just -> fromColumns just
292 Just just -> fromColumns just
@@ -307,10 +305,10 @@ instance (Table Result a, Table Result b) => Table Result (These a b) where
307 type Context (These a b) = Result
305 type Context (These a b) = Result
309 toColumns tables = HTheseTable
307 toColumns tables = HTheseTable
310− { hhereTag = relabel hhereTag
308+ { hhereTag = hrelabel hhereTag
311− , hhere = hlabel labeler (hunlabel unlabeler (toColumns hhere))
309+ , hhere = hrelabel (toColumns hhere)
312− , hthereTag = relabel hthereTag
310+ , hthereTag = hrelabel hthereTag
313− , hthere = hlabel labeler (hunlabel unlabeler (toColumns hthere))
311+ , hthere = hrelabel (toColumns hthere)
316 HMaybeTable
314 HMaybeTable
@@ -330,29 +328,27 @@ instance (Table Result a, Table Result b) => Table Result (These a b) where
330 _ -> error "These.fromColumns: mismatch between tags and data"
328 _ -> error "These.fromColumns: mismatch between tags and data"
332 mhere = HMaybeTable
330 mhere = HMaybeTable
333− { htag = relabel hhereTag
331+ { htag = hrelabel hhereTag
334− , hjust = hlabel labeler (hunlabel unlabeler hhere)
332+ , hjust = hrelabel hhere
336 mthere = HMaybeTable
334 mthere = HMaybeTable
337− { htag = relabel hthereTag
335+ { htag = hrelabel hthereTag
338− , hjust = hlabel labeler (hunlabel unlabeler hthere)
336+ , hjust = hrelabel hthere
342−instance (Table context a, Table context b, Labelable context)
340+instance (Table context a, Table context b)
343 => Table context (a, b)
341 => Table context (a, b)
347 ( Table context a, Table context b, Table context c
345 ( Table context a, Table context b, Table context c
350 => Table context (a, b, c)
347 => Table context (a, b, c)
354 ( Table context a, Table context b, Table context c, Table context d
351 ( Table context a, Table context b, Table context c, Table context d
357 => Table context (a, b, c, d)
353 => Table context (a, b, c, d)
@@ -360,7 +356,6 @@ instance
361 ( Table context a, Table context b, Table context c, Table context d
357 ( Table context a, Table context b, Table context c, Table context d
362 , Table context e
358 , Table context e
365 => Table context (a, b, c, d, e)
360 => Table context (a, b, c, d, e)
@@ -368,7 +363,6 @@ instance
369 ( Table context a, Table context b, Table context c, Table context d
364 ( Table context a, Table context b, Table context c, Table context d
370 , Table context e, Table context f
365 , Table context e, Table context f
373 => Table context (a, b, c, d, e, f)
367 => Table context (a, b, c, d, e, f)
@@ -376,7 +370,6 @@ instance
377 ( Table context a, Table context b, Table context c, Table context d
371 ( Table context a, Table context b, Table context c, Table context d
378 , Table context e, Table context f, Table context g
372 , Table context e, Table context f, Table context g
381 => Table context (a, b, c, d, e, f, g)
374 => Table context (a, b, c, d, e, f, g)