on master help sign in
Add comment about applicative
commit57e6232abaabbeacf27792801a2fb08eff738f1e authorHarendra Kumar <harendra.kumar@gmail.com> dateTue 29 Aug 2017, 05:49 (9 years ago) parented22c1c
1 file changed+7
src/Asyncly/AsyncT.hs+7
src/Asyncly/AsyncT.hs+7
@@ -156,6 +156,13 @@ instance Monad m => Functor (AsyncT m) where
156156-- Applicative
157157------------------------------------------------------------------------------
158158
159+-- Note: We cannot have the applicative instance run the two actions in
160+-- parallel. This is because the first action can always return empty and in
161+-- case it returns empty we should not be starting the second action. Therefore
162+-- we can only start the second action after getting a result from the first.
163+-- For running applicative actions in parallel we can use the async package and
164+-- lift the result into AsyncT.
165+
159166instance Monad m => Applicative (AsyncT m) where
160167 pure = return
161168 (<*>) = ap