@@ -41,11 +41,10 @@ import Rel8.Generic.Table
4141 )
4242import Rel8.Generic.Record ( Record(..) )
4343import Rel8.Generic.Reify ( ARep )
44−import Rel8.Schema.Context.Label ( Labelable, labeler, unlabeler )
4544import Rel8.Schema.HTable ( HTable )
4645import Rel8.Schema.HTable.Either ( HEitherTable(..) )
4746import Rel8.Schema.HTable.Identity ( HIdentity(..), HType )
48−import Rel8.Schema.HTable.Label ( hlabel, hunlabel )
47+import Rel8.Schema.HTable.Label ( hlabel, hrelabel, hunlabel )
4948import Rel8.Schema.HTable.List ( HListTable )
5049import Rel8.Schema.HTable.Maybe ( HMaybeTable(..) )
5150import Rel8.Schema.HTable.NonEmpty ( HNonEmptyTable )
@@ -61,7 +60,6 @@ import Rel8.Schema.Reify
6160 )
6261import Rel8.Schema.Result
6362 ( Col( R ), Result
64− , relabel
6563 , null, nullifier, unnullifier
6664 , vectorizer, unvectorizer
6765 )
@@ -247,20 +245,20 @@ instance (Table Result a, Table Result b) => Table Result (Either a b) where
247245
248246 toColumns = \case
249247 Left table -> HEitherTable
250− { htag = HIdentity (R IsLeft)
251− , hleft = hlabel labeler (hnullify nullifier (toColumns table))
252− , hright = hlabel labeler (hnulls (const null))
248+ { htag = hlabel (HType (R IsLeft))
249+ , hleft = hlabel (hnullify nullifier (toColumns table))
250+ , hright = hlabel (hnulls (const null))
253251 }
254252 Right table -> HEitherTable
255− { htag = HIdentity (R IsRight)
256− , hleft = hlabel labeler (hnulls (const null))
257− , hright = hlabel labeler (hnullify nullifier (toColumns table))
253+ { htag = hlabel (HType (R IsRight))
254+ , hleft = hlabel (hnulls (const null))
255+ , hright = hlabel (hnullify nullifier (toColumns table))
258256 }
259257
260− fromColumns HEitherTable {htag, hleft, hright} = case htag of
261− HIdentity (R tag) -> case tag of
262− IsLeft -> maybe err (Left . fromColumns) $ hunnullify unnullifier (hunlabel unlabeler hleft)
263− IsRight -> maybe err (Right . fromColumns) $ hunnullify unnullifier (hunlabel unlabeler hright)
258+ fromColumns HEitherTable {htag, hleft, hright} = case hunlabel htag of
259+ HType (R tag) -> case tag of
260+ IsLeft -> maybe err (Left . fromColumns) $ hunnullify unnullifier (hunlabel hleft)
261+ IsRight -> maybe err (Right . fromColumns) $ hunnullify unnullifier (hunlabel hright)
264262 where
265263 err = error "Either.fromColumns: mismatch between tag and data"
266264
@@ -279,17 +277,17 @@ instance Table Result a => Table Result (Maybe a) where
279277
280278 toColumns = \case
281279 Nothing -> HMaybeTable
282− { htag = HIdentity (R Nothing)
283− , hjust = hlabel labeler (hnulls (const null))
280+ { htag = hlabel (HIdentity (R Nothing))
281+ , hjust = hlabel (hnulls (const null))
284282 }
285283 Just table -> HMaybeTable
286− { htag = HIdentity (R (Just IsJust))
287− , hjust = hlabel labeler (hnullify nullifier (toColumns table))
284+ { htag = hlabel (HIdentity (R (Just IsJust)))
285+ , hjust = hlabel (hnullify nullifier (toColumns table))
288286 }
289287
290− fromColumns HMaybeTable {htag, hjust} = case htag of
291− HIdentity (R tag) -> tag $>
292− case hunnullify unnullifier (hunlabel unlabeler hjust) of
288+ fromColumns HMaybeTable {htag, hjust} = case hunlabel htag of
289+ HType (R tag) -> tag $>
290+ case hunnullify unnullifier (hunlabel hjust) of
293291 Nothing -> error "Maybe.fromColumns: mismatch between tag and data"
294292 Just just -> fromColumns just
295293
@@ -307,10 +305,10 @@ instance (Table Result a, Table Result b) => Table Result (These a b) where
307305 type Context (These a b) = Result
308306
309307 toColumns tables = HTheseTable
310− { hhereTag = relabel hhereTag
311− , hhere = hlabel labeler (hunlabel unlabeler (toColumns hhere))
312− , hthereTag = relabel hthereTag
313− , hthere = hlabel labeler (hunlabel unlabeler (toColumns hthere))
308+ { hhereTag = hrelabel hhereTag
309+ , hhere = hrelabel (toColumns hhere)
310+ , hthereTag = hrelabel hthereTag
311+ , hthere = hrelabel (toColumns hthere)
314312 }
315313 where
316314 HMaybeTable
@@ -330,29 +328,27 @@ instance (Table Result a, Table Result b) => Table Result (These a b) where
330328 _ -> error "These.fromColumns: mismatch between tags and data"
331329 where
332330 mhere = HMaybeTable
333− { htag = relabel hhereTag
334− , hjust = hlabel labeler (hunlabel unlabeler hhere)
331+ { htag = hrelabel hhereTag
332+ , hjust = hrelabel hhere
335333 }
336334 mthere = HMaybeTable
337− { htag = relabel hthereTag
338− , hjust = hlabel labeler (hunlabel unlabeler hthere)
335+ { htag = hrelabel hthereTag
336+ , hjust = hrelabel hthere
339337 }
340338
341339
342−instance (Table context a, Table context b, Labelable context)
340+instance (Table context a, Table context b)
343341 => Table context (a, b)
344342
345343
346344instance
347345 ( Table context a, Table context b, Table context c
348− , Labelable context
349346 )
350347 => Table context (a, b, c)
351348
352349
353350instance
354351 ( Table context a, Table context b, Table context c, Table context d
355− , Labelable context
356352 )
357353 => Table context (a, b, c, d)
358354
@@ -360,7 +356,6 @@ instance
360356instance
361357 ( Table context a, Table context b, Table context c, Table context d
362358 , Table context e
363− , Labelable context
364359 )
365360 => Table context (a, b, c, d, e)
366361
@@ -368,7 +363,6 @@ instance
368363instance
369364 ( Table context a, Table context b, Table context c, Table context d
370365 , Table context e, Table context f
371− , Labelable context
372366 )
373367 => Table context (a, b, c, d, e, f)
374368
@@ -376,7 +370,6 @@ instance
376370instance
377371 ( Table context a, Table context b, Table context c, Table context d
378372 , Table context e, Table context f, Table context g
379− , Labelable context
380373 )
381374 => Table context (a, b, c, d, e, f, g)
382375