distinct1 :: Query (Wire a) -> Query (Wire a)
distinct1 q = simpleQueryArr $ \((), t0) ->
  let (Wire oldCol, primQ, t1) = runSimpleQueryArr q ((), t0)
-- vv We used to do
--    newCol = tagWith t1 oldCol
--    t2 = next t1
-- but now we just do
      newCol = oldCol
      t2 = t1
-- and HaskellDB seems happier with that.  Note that 'tagWith t1
-- oldCol' adds an *additional* tag to a column name that presumably
-- already has one.  I wasn't sure if that was a good idea anyway.
  in (Wire newCol, Group [(newCol, AttrExpr oldCol)] primQ, t2)
distinct1 :: Query (Wire a) -> Query (Wire a)
distinct1 q = simpleQueryArr $ \((), t0) ->
  let (Wire oldCol, primQ, t1) = runSimpleQueryArr q ((), t0)
-- vv We used to do
--    newCol = tagWith t1 oldCol
--    t2 = next t1
-- but now we just do
      newCol = oldCol
      t2 = t1
-- and HaskellDB seems happier with that.  Note that 'tagWith t1
-- oldCol' adds an *additional* tag to a column name that presumably
-- already has one.  I wasn't sure if that was a good idea anyway.
  in (Wire newCol, Group [(newCol, AttrExpr oldCol)] primQ, t2)
distinct1 q = simpleQueryArr $ \((), t0) ->
  let (Wire oldCol, primQ, t1) = runSimpleQueryArr q ((), t0)
-- vv We used to do
--    newCol = tagWith t1 oldCol
--    t2 = next t1
-- but now we just do
      newCol = oldCol
      t2 = t1
-- and HaskellDB seems happier with that.  Note that 'tagWith t1
-- oldCol' adds an *additional* tag to a column name that presumably
-- already has one.  I wasn't sure if that was a good idea anyway.
  in (Wire newCol, Group [(newCol, AttrExpr oldCol)] primQ, t2)