on master help sign in
Add comment about applicative
57e6232Harendra Kumar
src/Asyncly/AsyncT.hs+7
@@ -156,6 +156,13 @@ instance Monad m => Functor (AsyncT m) where
156-- Applicative
156-- Applicative
157------------------------------------------------------------------------------
157------------------------------------------------------------------------------
158
158
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+
159instance Monad m => Applicative (AsyncT m) where
166instance Monad m => Applicative (AsyncT m) where
160 pure = return
167 pure = return
161 (<*>) = ap
168 (<*>) = ap