mirror of
https://github.com/circuithub/rel8.git
synced 2024-09-11 16:05:41 +03:00
Better documentation for bitraverseEitherTable
This commit is contained in:
parent
b0183859d0
commit
d21213d461
@ -52,8 +52,22 @@ bindEitherTable query e@(EitherTable input a i) = do
|
||||
EitherTable (input <> output) (bool a a' (isRightTable e)) b
|
||||
|
||||
|
||||
-- | Extend an 'EitherTable' with queries for both 'leftTable' and
|
||||
-- 'rightTable'.
|
||||
-- | @bitraverseEitherTable f g x@ will pass all @leftTable@s through @f@ and
|
||||
-- all @rightTable@s through @g@. The results are then lifted back into
|
||||
-- @leftTable@ and @rightTable@, respectively. This is similar to 'bitraverse'
|
||||
-- for 'Either'.
|
||||
--
|
||||
-- For example,
|
||||
--
|
||||
-- >>> :{
|
||||
-- select do
|
||||
-- x <- values (map lit [ Left True, Right (42 :: Int32) ])
|
||||
-- bitraverseEitherTable (\y -> values [y, not_ y]) (\y -> pure (y * 100)) x
|
||||
-- :}
|
||||
-- [ Left True
|
||||
-- , Left False
|
||||
-- , Right 4200
|
||||
-- ]
|
||||
bitraverseEitherTable :: ()
|
||||
=> (a -> Query c)
|
||||
-> (b -> Query d)
|
||||
|
Loading…
Reference in New Issue
Block a user