on master help sign in
Relax the constraint on bindEitherTable to just Functor
commited39571efd0969eddc0af27f60697b738f38d516 authorOllie Charles <ollie@ocharles.org.uk> dateWed 24 Mar 2021, 11:52 (6 years ago) parentcdc620d
1 file changed+4−3
src/Rel8/Query/Either.hs+4−3
src/Rel8/Query/Either.hs+4−3
@@ -9,6 +9,7 @@ module Rel8.Query.Either
99where
1010
1111-- base
12+import Data.Functor ( (<&>) )
1213import Prelude
1314
1415-- rel8
@@ -40,11 +41,11 @@ keepRightTable e@(EitherTable _ _ b) = do
4041 pure b
4142
4243
43−bindEitherTable :: (Table Expr a, Monad m)
44+bindEitherTable :: (Table Expr a, Functor m)
4445 => (i -> m (EitherTable a b)) -> EitherTable a i -> m (EitherTable a b)
4546bindEitherTable query e@(EitherTable input a i) = do
46− EitherTable output a' b <- query i
47− pure $ EitherTable (input <> output) (bool a a' (isRightTable e)) b
47+ query i <&> \(EitherTable output a' b) ->
48+ EitherTable (input <> output) (bool a a' (isRightTable e)) b
4849
4950
5051bitraverseEitherTable :: (Table Expr c, Table Expr d)