úÎO©N     :This data-type represents potentially-many actions in the f   / / that will result in returning a value of type a.  See  for more details. The # instance is straightforward. The  operator in the  instance - runs the left-hand side and right-hand side   each other, and afterwards < it applies the left-hand function to the right-hand value. [Acts like the given item, but when it has no more actions to take, ends the entire call to .  So this code:  4 engage $ unlimited p `alongside` endAfter (once q) Will terminate after q" occurs. In contrast, this code:  ) engage $ unlimited p `alongside` once q ?will never terminate because it can always offer to perform q. JActs like the given item, but when the current result value satisfies the 3 given function (i.e. applying the function yields ), ends the entire call  to . IOffers the given behaviour, and when it occurs, does not offer it again.  Returns Just6 the result if the behaviour happens, otherwise gives Nothing. once m is equivalent to  listToMaybe <$> upTo 1 m (and thus also  listToMaybe  <$> inOrder [m]). Like  but discards the result. MOffers the given behaviour up to the given number of times, returning a list : of the results (in chronological order, earliest first). upTo n is equivalent to inOrder . replicate n. Like , but discards the results. *Offers the given list of items, in order. Like , but discards the results. TRepeatedly offers the given behaviour. A list is returned (in chronological order, M earliest first) of the results of each occurrence of the behaviour. If you  don'*t want these results, it is better to use   to avoid a space  leak.  unlimited is equivalent to inOrder . repeat. Like  :, but discards the output. Useful if the event is likely ! to occur many times, and you don't need the results. Like  !, but allows some state (of type a) to be passed from one G subsequent call to another, as well as generating the results of type b. N To begin with the function (first parameter) will be called with the initial R state (second parameter). If chosen, it will return the new state, and a result R to be accumulated into the list. The second call to the function will be passed M the new state, to then return the even newer state and a second result, and  so on. PIf you want to use this with the StateT monad transformer from the mtl library,  you can call: 9 unlimitedRecurse (runStateT myStateAction) initialState  where # myStateAction :: StateT s m a  initialState :: s Like  -, but does not accumulate a list of results. PIf you want to use this with the StateT monad transformer from the mtl library,  you can call: : unlimitedRecurse (execStateT myStateAction) initialState  where # myStateAction :: StateT s m a  initialState :: s (Offers one behaviour alongside another. <This operation is semantically associative and commutative. Like   but merges the results with  afterwards. alongsideMerge a b is equivalent to uncurry mappend <$> (a ` alongside` b)  and liftA2 mappend a b. Like   but discards the results. POffers the given behaviour until either the finite set of actions is exhausted, @ or one of the explicit termination constructs is triggered.  For example:  . engage $ unlimited p `alongside` unlimited q will repeatedly offer p and q without ever terminating.  ( engage $ upTo 3 p `alongside` upTo 5 q will do p three times and q+ 5 times (in any mixed order) then finish.  L engage $ unlimited p `alongside` unlimited q `alongside` endAfter (once r) Pwill offer p repeatedly and q repeatedly and r, until r happens, at which point  the behaviour will end.  / engage $ once p `alongside` endAfter (once q) Lwill offer p and q; if p happens first it will wait for q, but if q happens  first it will finish.  M engage $ once p `alongside` endAfter (once q) `alongside` endAfter (once r) Opermits p to happen at most once, while either of q or r happening will finish  the call. MAll sorts of combinations are possible, but it is important to note that you  need at least one  or + event if you ever intend a call involving    (or similar) to finish. Some  laws involving - (ignoring the types and return values) are:  # engage (unlimited p) == forever p  engage (once p) == Just <$> p / engage (endAfter (once p)) == engage (once p) E engage (endAfter (once p) `alongside` endAfter (once q)) == p <|> q Most other uses of  and   do not reduce down to simple A programs, which is of course the attraction of the combinators. QOffers all the given behaviours together, and gives back a list of the outcomes.  This is roughly a shorthand for engage . foldr1 alongside, except that if you M pass the empty list, you simply get the empty list returned (rather than an  error)           !"#$%&'interleave-1.0Control.Alternative.Interleave InterleaveTendAfterendWhenonceonce_upToupTo_inOrderinOrder_ unlimited unlimited_unlimitedRecurseunlimitedRecurse_ alongsidealongsideMerge alongside_engage engageManybaseGHC.BaseMonadControl.Applicative AlternativeFunctor<*> ApplicativeContinue_restNoMore Terminateresultghc-primGHC.BoolTrue Data.Monoidmappendblank