{-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DerivingStrategies #-} {-# LANGUAGE DerivingVia #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE DeriveTraversable #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE StandaloneDeriving #-} module Data.Monoid.Synchronisation ( FirstToFinish (..) , LastToFinish (..) , firstToLast , lastToFirst , LastToFinishM (..) , firstToLastM , lastToFirstM ) where import Data.Coerce (coerce) import Data.Functor.Contravariant (Contravariant) import Data.Monoid (Alt (..), Ap (..)) import GHC.Generics (Generic, Generic1) import Control.Applicative (Alternative (..)) import Control.Monad (MonadPlus (..)) -- | First-to-finish synchronisation. Like 'Alt' it is a monoid under '<|>'. -- First-to-finish is the additive monoid of -- [near-semiring](https://www.wikiwand.com/en/Near-semiring) for which -- multiplication is given by 'LastToFinish'. -- -- > -- | Return first available value. -- > -- -- > readFirstMVar :: [TMVar a] -> STM a -- > readFirstMVar = runFirstToFinish -- > . foldMap (FirstToFinish . readTMVar) -- -- newtype FirstToFinish m a = FirstToFinish { forall (m :: * -> *) a. FirstToFinish m a -> m a runFirstToFinish :: m a } deriving newtype forall a b. a -> FirstToFinish m b -> FirstToFinish m a forall a b. (a -> b) -> FirstToFinish m a -> FirstToFinish m b forall (m :: * -> *) a b. Functor m => a -> FirstToFinish m b -> FirstToFinish m a forall (m :: * -> *) a b. Functor m => (a -> b) -> FirstToFinish m a -> FirstToFinish m b forall (f :: * -> *). (forall a b. (a -> b) -> f a -> f b) -> (forall a b. a -> f b -> f a) -> Functor f <$ :: forall a b. a -> FirstToFinish m b -> FirstToFinish m a $c<$ :: forall (m :: * -> *) a b. Functor m => a -> FirstToFinish m b -> FirstToFinish m a fmap :: forall a b. (a -> b) -> FirstToFinish m a -> FirstToFinish m b $cfmap :: forall (m :: * -> *) a b. Functor m => (a -> b) -> FirstToFinish m a -> FirstToFinish m b Functor deriving ( forall a. (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a forall (m :: * -> *) a x. Rep (FirstToFinish m a) x -> FirstToFinish m a forall (m :: * -> *) a x. FirstToFinish m a -> Rep (FirstToFinish m a) x $cto :: forall (m :: * -> *) a x. Rep (FirstToFinish m a) x -> FirstToFinish m a $cfrom :: forall (m :: * -> *) a x. FirstToFinish m a -> Rep (FirstToFinish m a) x Generic , forall k (f :: k -> *). (forall (a :: k). f a -> Rep1 f a) -> (forall (a :: k). Rep1 f a -> f a) -> Generic1 f forall (m :: * -> *) a. Rep1 (FirstToFinish m) a -> FirstToFinish m a forall (m :: * -> *) a. FirstToFinish m a -> Rep1 (FirstToFinish m) a $cto1 :: forall (m :: * -> *) a. Rep1 (FirstToFinish m) a -> FirstToFinish m a $cfrom1 :: forall (m :: * -> *) a. FirstToFinish m a -> Rep1 (FirstToFinish m) a Generic1 , forall a. a -> FirstToFinish m a forall a b. FirstToFinish m a -> FirstToFinish m b -> FirstToFinish m a forall a b. FirstToFinish m a -> FirstToFinish m b -> FirstToFinish m b forall a b. FirstToFinish m (a -> b) -> FirstToFinish m a -> FirstToFinish m b forall a b c. (a -> b -> c) -> FirstToFinish m a -> FirstToFinish m b -> FirstToFinish m c forall (f :: * -> *). Functor f -> (forall a. a -> f a) -> (forall a b. f (a -> b) -> f a -> f b) -> (forall a b c. (a -> b -> c) -> f a -> f b -> f c) -> (forall a b. f a -> f b -> f b) -> (forall a b. f a -> f b -> f a) -> Applicative f forall {m :: * -> *}. Applicative m => Functor (FirstToFinish m) forall (m :: * -> *) a. Applicative m => a -> FirstToFinish m a forall (m :: * -> *) a b. Applicative m => FirstToFinish m a -> FirstToFinish m b -> FirstToFinish m a forall (m :: * -> *) a b. Applicative m => FirstToFinish m a -> FirstToFinish m b -> FirstToFinish m b forall (m :: * -> *) a b. Applicative m => FirstToFinish m (a -> b) -> FirstToFinish m a -> FirstToFinish m b forall (m :: * -> *) a b c. Applicative m => (a -> b -> c) -> FirstToFinish m a -> FirstToFinish m b -> FirstToFinish m c <* :: forall a b. FirstToFinish m a -> FirstToFinish m b -> FirstToFinish m a $c<* :: forall (m :: * -> *) a b. Applicative m => FirstToFinish m a -> FirstToFinish m b -> FirstToFinish m a *> :: forall a b. FirstToFinish m a -> FirstToFinish m b -> FirstToFinish m b $c*> :: forall (m :: * -> *) a b. Applicative m => FirstToFinish m a -> FirstToFinish m b -> FirstToFinish m b liftA2 :: forall a b c. (a -> b -> c) -> FirstToFinish m a -> FirstToFinish m b -> FirstToFinish m c $cliftA2 :: forall (m :: * -> *) a b c. Applicative m => (a -> b -> c) -> FirstToFinish m a -> FirstToFinish m b -> FirstToFinish m c <*> :: forall a b. FirstToFinish m (a -> b) -> FirstToFinish m a -> FirstToFinish m b $c<*> :: forall (m :: * -> *) a b. Applicative m => FirstToFinish m (a -> b) -> FirstToFinish m a -> FirstToFinish m b pure :: forall a. a -> FirstToFinish m a $cpure :: forall (m :: * -> *) a. Applicative m => a -> FirstToFinish m a Applicative , forall a. FirstToFinish m a forall a. FirstToFinish m a -> FirstToFinish m [a] forall a. FirstToFinish m a -> FirstToFinish m a -> FirstToFinish m a forall (f :: * -> *). Applicative f -> (forall a. f a) -> (forall a. f a -> f a -> f a) -> (forall a. f a -> f [a]) -> (forall a. f a -> f [a]) -> Alternative f forall {m :: * -> *}. Alternative m => Applicative (FirstToFinish m) forall (m :: * -> *) a. Alternative m => FirstToFinish m a forall (m :: * -> *) a. Alternative m => FirstToFinish m a -> FirstToFinish m [a] forall (m :: * -> *) a. Alternative m => FirstToFinish m a -> FirstToFinish m a -> FirstToFinish m a many :: forall a. FirstToFinish m a -> FirstToFinish m [a] $cmany :: forall (m :: * -> *) a. Alternative m => FirstToFinish m a -> FirstToFinish m [a] some :: forall a. FirstToFinish m a -> FirstToFinish m [a] $csome :: forall (m :: * -> *) a. Alternative m => FirstToFinish m a -> FirstToFinish m [a] <|> :: forall a. FirstToFinish m a -> FirstToFinish m a -> FirstToFinish m a $c<|> :: forall (m :: * -> *) a. Alternative m => FirstToFinish m a -> FirstToFinish m a -> FirstToFinish m a empty :: forall a. FirstToFinish m a $cempty :: forall (m :: * -> *) a. Alternative m => FirstToFinish m a Alternative , forall a. a -> FirstToFinish m a forall a b. FirstToFinish m a -> FirstToFinish m b -> FirstToFinish m b forall a b. FirstToFinish m a -> (a -> FirstToFinish m b) -> FirstToFinish m b forall {m :: * -> *}. Monad m => Applicative (FirstToFinish m) forall (m :: * -> *) a. Monad m => a -> FirstToFinish m a forall (m :: * -> *) a b. Monad m => FirstToFinish m a -> FirstToFinish m b -> FirstToFinish m b forall (m :: * -> *) a b. Monad m => FirstToFinish m a -> (a -> FirstToFinish m b) -> FirstToFinish m b forall (m :: * -> *). Applicative m -> (forall a b. m a -> (a -> m b) -> m b) -> (forall a b. m a -> m b -> m b) -> (forall a. a -> m a) -> Monad m return :: forall a. a -> FirstToFinish m a $creturn :: forall (m :: * -> *) a. Monad m => a -> FirstToFinish m a >> :: forall a b. FirstToFinish m a -> FirstToFinish m b -> FirstToFinish m b $c>> :: forall (m :: * -> *) a b. Monad m => FirstToFinish m a -> FirstToFinish m b -> FirstToFinish m b >>= :: forall a b. FirstToFinish m a -> (a -> FirstToFinish m b) -> FirstToFinish m b $c>>= :: forall (m :: * -> *) a b. Monad m => FirstToFinish m a -> (a -> FirstToFinish m b) -> FirstToFinish m b Monad , forall a. FirstToFinish m a forall a. FirstToFinish m a -> FirstToFinish m a -> FirstToFinish m a forall {m :: * -> *}. MonadPlus m => Monad (FirstToFinish m) forall {m :: * -> *}. MonadPlus m => Alternative (FirstToFinish m) forall (m :: * -> *) a. MonadPlus m => FirstToFinish m a forall (m :: * -> *) a. MonadPlus m => FirstToFinish m a -> FirstToFinish m a -> FirstToFinish m a forall (m :: * -> *). Alternative m -> Monad m -> (forall a. m a) -> (forall a. m a -> m a -> m a) -> MonadPlus m mplus :: forall a. FirstToFinish m a -> FirstToFinish m a -> FirstToFinish m a $cmplus :: forall (m :: * -> *) a. MonadPlus m => FirstToFinish m a -> FirstToFinish m a -> FirstToFinish m a mzero :: forall a. FirstToFinish m a $cmzero :: forall (m :: * -> *) a. MonadPlus m => FirstToFinish m a MonadPlus , forall (t :: * -> *). Functor t -> Foldable t -> (forall (f :: * -> *) a b. Applicative f => (a -> f b) -> t a -> f (t b)) -> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a)) -> (forall (m :: * -> *) a b. Monad m => (a -> m b) -> t a -> m (t b)) -> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a)) -> Traversable t forall {m :: * -> *}. Traversable m => Functor (FirstToFinish m) forall {m :: * -> *}. Traversable m => Foldable (FirstToFinish m) forall (m :: * -> *) (m :: * -> *) a. (Traversable m, Monad m) => FirstToFinish m (m a) -> m (FirstToFinish m a) forall (m :: * -> *) (f :: * -> *) a. (Traversable m, Applicative f) => FirstToFinish m (f a) -> f (FirstToFinish m a) forall (m :: * -> *) (m :: * -> *) a b. (Traversable m, Monad m) => (a -> m b) -> FirstToFinish m a -> m (FirstToFinish m b) forall (m :: * -> *) (f :: * -> *) a b. (Traversable m, Applicative f) => (a -> f b) -> FirstToFinish m a -> f (FirstToFinish m b) forall (f :: * -> *) a b. Applicative f => (a -> f b) -> FirstToFinish m a -> f (FirstToFinish m b) sequence :: forall (m :: * -> *) a. Monad m => FirstToFinish m (m a) -> m (FirstToFinish m a) $csequence :: forall (m :: * -> *) (m :: * -> *) a. (Traversable m, Monad m) => FirstToFinish m (m a) -> m (FirstToFinish m a) mapM :: forall (m :: * -> *) a b. Monad m => (a -> m b) -> FirstToFinish m a -> m (FirstToFinish m b) $cmapM :: forall (m :: * -> *) (m :: * -> *) a b. (Traversable m, Monad m) => (a -> m b) -> FirstToFinish m a -> m (FirstToFinish m b) sequenceA :: forall (f :: * -> *) a. Applicative f => FirstToFinish m (f a) -> f (FirstToFinish m a) $csequenceA :: forall (m :: * -> *) (f :: * -> *) a. (Traversable m, Applicative f) => FirstToFinish m (f a) -> f (FirstToFinish m a) traverse :: forall (f :: * -> *) a b. Applicative f => (a -> f b) -> FirstToFinish m a -> f (FirstToFinish m b) $ctraverse :: forall (m :: * -> *) (f :: * -> *) a b. (Traversable m, Applicative f) => (a -> f b) -> FirstToFinish m a -> f (FirstToFinish m b) Traversable ) deriving NonEmpty (FirstToFinish m a) -> FirstToFinish m a FirstToFinish m a -> FirstToFinish m a -> FirstToFinish m a forall b. Integral b => b -> FirstToFinish m a -> FirstToFinish m a forall a. (a -> a -> a) -> (NonEmpty a -> a) -> (forall b. Integral b => b -> a -> a) -> Semigroup a forall (m :: * -> *) a. Alternative m => NonEmpty (FirstToFinish m a) -> FirstToFinish m a forall (m :: * -> *) a. Alternative m => FirstToFinish m a -> FirstToFinish m a -> FirstToFinish m a forall (m :: * -> *) a b. (Alternative m, Integral b) => b -> FirstToFinish m a -> FirstToFinish m a stimes :: forall b. Integral b => b -> FirstToFinish m a -> FirstToFinish m a $cstimes :: forall (m :: * -> *) a b. (Alternative m, Integral b) => b -> FirstToFinish m a -> FirstToFinish m a sconcat :: NonEmpty (FirstToFinish m a) -> FirstToFinish m a $csconcat :: forall (m :: * -> *) a. Alternative m => NonEmpty (FirstToFinish m a) -> FirstToFinish m a <> :: FirstToFinish m a -> FirstToFinish m a -> FirstToFinish m a $c<> :: forall (m :: * -> *) a. Alternative m => FirstToFinish m a -> FirstToFinish m a -> FirstToFinish m a Semigroup via (Alt m a) deriving FirstToFinish m a [FirstToFinish m a] -> FirstToFinish m a FirstToFinish m a -> FirstToFinish m a -> FirstToFinish m a forall a. Semigroup a -> a -> (a -> a -> a) -> ([a] -> a) -> Monoid a forall (m :: * -> *) a. Alternative m => Semigroup (FirstToFinish m a) forall (m :: * -> *) a. Alternative m => FirstToFinish m a forall (m :: * -> *) a. Alternative m => [FirstToFinish m a] -> FirstToFinish m a forall (m :: * -> *) a. Alternative m => FirstToFinish m a -> FirstToFinish m a -> FirstToFinish m a mconcat :: [FirstToFinish m a] -> FirstToFinish m a $cmconcat :: forall (m :: * -> *) a. Alternative m => [FirstToFinish m a] -> FirstToFinish m a mappend :: FirstToFinish m a -> FirstToFinish m a -> FirstToFinish m a $cmappend :: forall (m :: * -> *) a. Alternative m => FirstToFinish m a -> FirstToFinish m a -> FirstToFinish m a mempty :: FirstToFinish m a $cmempty :: forall (m :: * -> *) a. Alternative m => FirstToFinish m a Monoid via (Alt m a) deriving forall a. Eq a => a -> FirstToFinish m a -> Bool forall a. Num a => FirstToFinish m a -> a forall a. Ord a => FirstToFinish m a -> a forall m. Monoid m => FirstToFinish m m -> m forall a. FirstToFinish m a -> Bool forall a. FirstToFinish m a -> Int forall a. FirstToFinish m a -> [a] forall a. (a -> a -> a) -> FirstToFinish m a -> a forall m a. Monoid m => (a -> m) -> FirstToFinish m a -> m forall b a. (b -> a -> b) -> b -> FirstToFinish m a -> b forall a b. (a -> b -> b) -> b -> FirstToFinish m a -> b forall (m :: * -> *) a. (Foldable m, Eq a) => a -> FirstToFinish m a -> Bool forall (m :: * -> *) a. (Foldable m, Num a) => FirstToFinish m a -> a forall (m :: * -> *) a. (Foldable m, Ord a) => FirstToFinish m a -> a forall (m :: * -> *) m. (Foldable m, Monoid m) => FirstToFinish m m -> m forall (m :: * -> *) a. Foldable m => FirstToFinish m a -> Bool forall (m :: * -> *) a. Foldable m => FirstToFinish m a -> Int forall (m :: * -> *) a. Foldable m => FirstToFinish m a -> [a] forall (m :: * -> *) a. Foldable m => (a -> a -> a) -> FirstToFinish m a -> a forall (m :: * -> *) m a. (Foldable m, Monoid m) => (a -> m) -> FirstToFinish m a -> m forall (m :: * -> *) b a. Foldable m => (b -> a -> b) -> b -> FirstToFinish m a -> b forall (m :: * -> *) a b. Foldable m => (a -> b -> b) -> b -> FirstToFinish m a -> b forall (t :: * -> *). (forall m. Monoid m => t m -> m) -> (forall m a. Monoid m => (a -> m) -> t a -> m) -> (forall m a. Monoid m => (a -> m) -> t a -> m) -> (forall a b. (a -> b -> b) -> b -> t a -> b) -> (forall a b. (a -> b -> b) -> b -> t a -> b) -> (forall b a. (b -> a -> b) -> b -> t a -> b) -> (forall b a. (b -> a -> b) -> b -> t a -> b) -> (forall a. (a -> a -> a) -> t a -> a) -> (forall a. (a -> a -> a) -> t a -> a) -> (forall a. t a -> [a]) -> (forall a. t a -> Bool) -> (forall a. t a -> Int) -> (forall a. Eq a => a -> t a -> Bool) -> (forall a. Ord a => t a -> a) -> (forall a. Ord a => t a -> a) -> (forall a. Num a => t a -> a) -> (forall a. Num a => t a -> a) -> Foldable t product :: forall a. Num a => FirstToFinish m a -> a $cproduct :: forall (m :: * -> *) a. (Foldable m, Num a) => FirstToFinish m a -> a sum :: forall a. Num a => FirstToFinish m a -> a $csum :: forall (m :: * -> *) a. (Foldable m, Num a) => FirstToFinish m a -> a minimum :: forall a. Ord a => FirstToFinish m a -> a $cminimum :: forall (m :: * -> *) a. (Foldable m, Ord a) => FirstToFinish m a -> a maximum :: forall a. Ord a => FirstToFinish m a -> a $cmaximum :: forall (m :: * -> *) a. (Foldable m, Ord a) => FirstToFinish m a -> a elem :: forall a. Eq a => a -> FirstToFinish m a -> Bool $celem :: forall (m :: * -> *) a. (Foldable m, Eq a) => a -> FirstToFinish m a -> Bool length :: forall a. FirstToFinish m a -> Int $clength :: forall (m :: * -> *) a. Foldable m => FirstToFinish m a -> Int null :: forall a. FirstToFinish m a -> Bool $cnull :: forall (m :: * -> *) a. Foldable m => FirstToFinish m a -> Bool toList :: forall a. FirstToFinish m a -> [a] $ctoList :: forall (m :: * -> *) a. Foldable m => FirstToFinish m a -> [a] foldl1 :: forall a. (a -> a -> a) -> FirstToFinish m a -> a $cfoldl1 :: forall (m :: * -> *) a. Foldable m => (a -> a -> a) -> FirstToFinish m a -> a foldr1 :: forall a. (a -> a -> a) -> FirstToFinish m a -> a $cfoldr1 :: forall (m :: * -> *) a. Foldable m => (a -> a -> a) -> FirstToFinish m a -> a foldl' :: forall b a. (b -> a -> b) -> b -> FirstToFinish m a -> b $cfoldl' :: forall (m :: * -> *) b a. Foldable m => (b -> a -> b) -> b -> FirstToFinish m a -> b foldl :: forall b a. (b -> a -> b) -> b -> FirstToFinish m a -> b $cfoldl :: forall (m :: * -> *) b a. Foldable m => (b -> a -> b) -> b -> FirstToFinish m a -> b foldr' :: forall a b. (a -> b -> b) -> b -> FirstToFinish m a -> b $cfoldr' :: forall (m :: * -> *) a b. Foldable m => (a -> b -> b) -> b -> FirstToFinish m a -> b foldr :: forall a b. (a -> b -> b) -> b -> FirstToFinish m a -> b $cfoldr :: forall (m :: * -> *) a b. Foldable m => (a -> b -> b) -> b -> FirstToFinish m a -> b foldMap' :: forall m a. Monoid m => (a -> m) -> FirstToFinish m a -> m $cfoldMap' :: forall (m :: * -> *) m a. (Foldable m, Monoid m) => (a -> m) -> FirstToFinish m a -> m foldMap :: forall m a. Monoid m => (a -> m) -> FirstToFinish m a -> m $cfoldMap :: forall (m :: * -> *) m a. (Foldable m, Monoid m) => (a -> m) -> FirstToFinish m a -> m fold :: forall m. Monoid m => FirstToFinish m m -> m $cfold :: forall (m :: * -> *) m. (Foldable m, Monoid m) => FirstToFinish m m -> m Foldable via (Alt m) deriving forall b a. b -> FirstToFinish m b -> FirstToFinish m a forall a' a. (a' -> a) -> FirstToFinish m a -> FirstToFinish m a' forall (m :: * -> *) b a. Contravariant m => b -> FirstToFinish m b -> FirstToFinish m a forall (m :: * -> *) a' a. Contravariant m => (a' -> a) -> FirstToFinish m a -> FirstToFinish m a' forall (f :: * -> *). (forall a' a. (a' -> a) -> f a -> f a') -> (forall b a. b -> f b -> f a) -> Contravariant f >$ :: forall b a. b -> FirstToFinish m b -> FirstToFinish m a $c>$ :: forall (m :: * -> *) b a. Contravariant m => b -> FirstToFinish m b -> FirstToFinish m a contramap :: forall a' a. (a' -> a) -> FirstToFinish m a -> FirstToFinish m a' $ccontramap :: forall (m :: * -> *) a' a. Contravariant m => (a' -> a) -> FirstToFinish m a -> FirstToFinish m a' Contravariant via (Alt m) -- | Last-to-finish synchronisation. It is the multiplicative semigroup of -- the [near-semiring](https://www.wikiwand.com/en/Near-semiring) for which addition is -- given by 'FirstToFinish'. -- -- This is similar to 'Ap' (see 'LastToFinishM') in the sense that it will wait -- for all monadic effects, but unlike 'Ap' it will not combine all results -- using a monoid instance, but rather it will return the last one. Also unlike -- 'Ap' it does not have a monoidal unit. -- -- > -- | Read all 'TMVar's and return the one that was filled last. -- > -- -- > readAllTMVars :: Monoid a => NonEmpty (TMVar a) -> STM a -- > readAllTMVars = runLastToFinish -- > . foldMap1 (LastToFinish . readTMVar) -- > -- from 'semigroupoids' package or use 'foldr1' and 'fmap' -- > -- from 'base' -- newtype LastToFinish m a = LastToFinish { forall (m :: * -> *) a. LastToFinish m a -> m a runLastToFinish :: m a } deriving newtype forall a b. a -> LastToFinish m b -> LastToFinish m a forall a b. (a -> b) -> LastToFinish m a -> LastToFinish m b forall (m :: * -> *) a b. Functor m => a -> LastToFinish m b -> LastToFinish m a forall (m :: * -> *) a b. Functor m => (a -> b) -> LastToFinish m a -> LastToFinish m b forall (f :: * -> *). (forall a b. (a -> b) -> f a -> f b) -> (forall a b. a -> f b -> f a) -> Functor f <$ :: forall a b. a -> LastToFinish m b -> LastToFinish m a $c<$ :: forall (m :: * -> *) a b. Functor m => a -> LastToFinish m b -> LastToFinish m a fmap :: forall a b. (a -> b) -> LastToFinish m a -> LastToFinish m b $cfmap :: forall (m :: * -> *) a b. Functor m => (a -> b) -> LastToFinish m a -> LastToFinish m b Functor deriving ( forall a. (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a forall (m :: * -> *) a x. Rep (LastToFinish m a) x -> LastToFinish m a forall (m :: * -> *) a x. LastToFinish m a -> Rep (LastToFinish m a) x $cto :: forall (m :: * -> *) a x. Rep (LastToFinish m a) x -> LastToFinish m a $cfrom :: forall (m :: * -> *) a x. LastToFinish m a -> Rep (LastToFinish m a) x Generic , forall k (f :: k -> *). (forall (a :: k). f a -> Rep1 f a) -> (forall (a :: k). Rep1 f a -> f a) -> Generic1 f forall (m :: * -> *) a. Rep1 (LastToFinish m) a -> LastToFinish m a forall (m :: * -> *) a. LastToFinish m a -> Rep1 (LastToFinish m) a $cto1 :: forall (m :: * -> *) a. Rep1 (LastToFinish m) a -> LastToFinish m a $cfrom1 :: forall (m :: * -> *) a. LastToFinish m a -> Rep1 (LastToFinish m) a Generic1 , forall a. a -> LastToFinish m a forall a b. LastToFinish m a -> LastToFinish m b -> LastToFinish m a forall a b. LastToFinish m a -> LastToFinish m b -> LastToFinish m b forall a b. LastToFinish m (a -> b) -> LastToFinish m a -> LastToFinish m b forall a b c. (a -> b -> c) -> LastToFinish m a -> LastToFinish m b -> LastToFinish m c forall (f :: * -> *). Functor f -> (forall a. a -> f a) -> (forall a b. f (a -> b) -> f a -> f b) -> (forall a b c. (a -> b -> c) -> f a -> f b -> f c) -> (forall a b. f a -> f b -> f b) -> (forall a b. f a -> f b -> f a) -> Applicative f forall {m :: * -> *}. Applicative m => Functor (LastToFinish m) forall (m :: * -> *) a. Applicative m => a -> LastToFinish m a forall (m :: * -> *) a b. Applicative m => LastToFinish m a -> LastToFinish m b -> LastToFinish m a forall (m :: * -> *) a b. Applicative m => LastToFinish m a -> LastToFinish m b -> LastToFinish m b forall (m :: * -> *) a b. Applicative m => LastToFinish m (a -> b) -> LastToFinish m a -> LastToFinish m b forall (m :: * -> *) a b c. Applicative m => (a -> b -> c) -> LastToFinish m a -> LastToFinish m b -> LastToFinish m c <* :: forall a b. LastToFinish m a -> LastToFinish m b -> LastToFinish m a $c<* :: forall (m :: * -> *) a b. Applicative m => LastToFinish m a -> LastToFinish m b -> LastToFinish m a *> :: forall a b. LastToFinish m a -> LastToFinish m b -> LastToFinish m b $c*> :: forall (m :: * -> *) a b. Applicative m => LastToFinish m a -> LastToFinish m b -> LastToFinish m b liftA2 :: forall a b c. (a -> b -> c) -> LastToFinish m a -> LastToFinish m b -> LastToFinish m c $cliftA2 :: forall (m :: * -> *) a b c. Applicative m => (a -> b -> c) -> LastToFinish m a -> LastToFinish m b -> LastToFinish m c <*> :: forall a b. LastToFinish m (a -> b) -> LastToFinish m a -> LastToFinish m b $c<*> :: forall (m :: * -> *) a b. Applicative m => LastToFinish m (a -> b) -> LastToFinish m a -> LastToFinish m b pure :: forall a. a -> LastToFinish m a $cpure :: forall (m :: * -> *) a. Applicative m => a -> LastToFinish m a Applicative , forall a. LastToFinish m a forall a. LastToFinish m a -> LastToFinish m [a] forall a. LastToFinish m a -> LastToFinish m a -> LastToFinish m a forall (f :: * -> *). Applicative f -> (forall a. f a) -> (forall a. f a -> f a -> f a) -> (forall a. f a -> f [a]) -> (forall a. f a -> f [a]) -> Alternative f forall {m :: * -> *}. Alternative m => Applicative (LastToFinish m) forall (m :: * -> *) a. Alternative m => LastToFinish m a forall (m :: * -> *) a. Alternative m => LastToFinish m a -> LastToFinish m [a] forall (m :: * -> *) a. Alternative m => LastToFinish m a -> LastToFinish m a -> LastToFinish m a many :: forall a. LastToFinish m a -> LastToFinish m [a] $cmany :: forall (m :: * -> *) a. Alternative m => LastToFinish m a -> LastToFinish m [a] some :: forall a. LastToFinish m a -> LastToFinish m [a] $csome :: forall (m :: * -> *) a. Alternative m => LastToFinish m a -> LastToFinish m [a] <|> :: forall a. LastToFinish m a -> LastToFinish m a -> LastToFinish m a $c<|> :: forall (m :: * -> *) a. Alternative m => LastToFinish m a -> LastToFinish m a -> LastToFinish m a empty :: forall a. LastToFinish m a $cempty :: forall (m :: * -> *) a. Alternative m => LastToFinish m a Alternative , forall a. a -> LastToFinish m a forall a b. LastToFinish m a -> LastToFinish m b -> LastToFinish m b forall a b. LastToFinish m a -> (a -> LastToFinish m b) -> LastToFinish m b forall {m :: * -> *}. Monad m => Applicative (LastToFinish m) forall (m :: * -> *) a. Monad m => a -> LastToFinish m a forall (m :: * -> *) a b. Monad m => LastToFinish m a -> LastToFinish m b -> LastToFinish m b forall (m :: * -> *) a b. Monad m => LastToFinish m a -> (a -> LastToFinish m b) -> LastToFinish m b forall (m :: * -> *). Applicative m -> (forall a b. m a -> (a -> m b) -> m b) -> (forall a b. m a -> m b -> m b) -> (forall a. a -> m a) -> Monad m return :: forall a. a -> LastToFinish m a $creturn :: forall (m :: * -> *) a. Monad m => a -> LastToFinish m a >> :: forall a b. LastToFinish m a -> LastToFinish m b -> LastToFinish m b $c>> :: forall (m :: * -> *) a b. Monad m => LastToFinish m a -> LastToFinish m b -> LastToFinish m b >>= :: forall a b. LastToFinish m a -> (a -> LastToFinish m b) -> LastToFinish m b $c>>= :: forall (m :: * -> *) a b. Monad m => LastToFinish m a -> (a -> LastToFinish m b) -> LastToFinish m b Monad , forall a. LastToFinish m a forall a. LastToFinish m a -> LastToFinish m a -> LastToFinish m a forall {m :: * -> *}. MonadPlus m => Monad (LastToFinish m) forall {m :: * -> *}. MonadPlus m => Alternative (LastToFinish m) forall (m :: * -> *) a. MonadPlus m => LastToFinish m a forall (m :: * -> *) a. MonadPlus m => LastToFinish m a -> LastToFinish m a -> LastToFinish m a forall (m :: * -> *). Alternative m -> Monad m -> (forall a. m a) -> (forall a. m a -> m a -> m a) -> MonadPlus m mplus :: forall a. LastToFinish m a -> LastToFinish m a -> LastToFinish m a $cmplus :: forall (m :: * -> *) a. MonadPlus m => LastToFinish m a -> LastToFinish m a -> LastToFinish m a mzero :: forall a. LastToFinish m a $cmzero :: forall (m :: * -> *) a. MonadPlus m => LastToFinish m a MonadPlus , forall (t :: * -> *). Functor t -> Foldable t -> (forall (f :: * -> *) a b. Applicative f => (a -> f b) -> t a -> f (t b)) -> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a)) -> (forall (m :: * -> *) a b. Monad m => (a -> m b) -> t a -> m (t b)) -> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a)) -> Traversable t forall {m :: * -> *}. Traversable m => Functor (LastToFinish m) forall {m :: * -> *}. Traversable m => Foldable (LastToFinish m) forall (m :: * -> *) (m :: * -> *) a. (Traversable m, Monad m) => LastToFinish m (m a) -> m (LastToFinish m a) forall (m :: * -> *) (f :: * -> *) a. (Traversable m, Applicative f) => LastToFinish m (f a) -> f (LastToFinish m a) forall (m :: * -> *) (m :: * -> *) a b. (Traversable m, Monad m) => (a -> m b) -> LastToFinish m a -> m (LastToFinish m b) forall (m :: * -> *) (f :: * -> *) a b. (Traversable m, Applicative f) => (a -> f b) -> LastToFinish m a -> f (LastToFinish m b) forall (f :: * -> *) a b. Applicative f => (a -> f b) -> LastToFinish m a -> f (LastToFinish m b) sequence :: forall (m :: * -> *) a. Monad m => LastToFinish m (m a) -> m (LastToFinish m a) $csequence :: forall (m :: * -> *) (m :: * -> *) a. (Traversable m, Monad m) => LastToFinish m (m a) -> m (LastToFinish m a) mapM :: forall (m :: * -> *) a b. Monad m => (a -> m b) -> LastToFinish m a -> m (LastToFinish m b) $cmapM :: forall (m :: * -> *) (m :: * -> *) a b. (Traversable m, Monad m) => (a -> m b) -> LastToFinish m a -> m (LastToFinish m b) sequenceA :: forall (f :: * -> *) a. Applicative f => LastToFinish m (f a) -> f (LastToFinish m a) $csequenceA :: forall (m :: * -> *) (f :: * -> *) a. (Traversable m, Applicative f) => LastToFinish m (f a) -> f (LastToFinish m a) traverse :: forall (f :: * -> *) a b. Applicative f => (a -> f b) -> LastToFinish m a -> f (LastToFinish m b) $ctraverse :: forall (m :: * -> *) (f :: * -> *) a b. (Traversable m, Applicative f) => (a -> f b) -> LastToFinish m a -> f (LastToFinish m b) Traversable ) deriving forall a. Eq a => a -> LastToFinish m a -> Bool forall a. Num a => LastToFinish m a -> a forall a. Ord a => LastToFinish m a -> a forall m. Monoid m => LastToFinish m m -> m forall a. LastToFinish m a -> Bool forall a. LastToFinish m a -> Int forall a. LastToFinish m a -> [a] forall a. (a -> a -> a) -> LastToFinish m a -> a forall m a. Monoid m => (a -> m) -> LastToFinish m a -> m forall b a. (b -> a -> b) -> b -> LastToFinish m a -> b forall a b. (a -> b -> b) -> b -> LastToFinish m a -> b forall (m :: * -> *) a. (Foldable m, Eq a) => a -> LastToFinish m a -> Bool forall (m :: * -> *) a. (Foldable m, Num a) => LastToFinish m a -> a forall (m :: * -> *) a. (Foldable m, Ord a) => LastToFinish m a -> a forall (m :: * -> *) m. (Foldable m, Monoid m) => LastToFinish m m -> m forall (m :: * -> *) a. Foldable m => LastToFinish m a -> Bool forall (m :: * -> *) a. Foldable m => LastToFinish m a -> Int forall (m :: * -> *) a. Foldable m => LastToFinish m a -> [a] forall (m :: * -> *) a. Foldable m => (a -> a -> a) -> LastToFinish m a -> a forall (m :: * -> *) m a. (Foldable m, Monoid m) => (a -> m) -> LastToFinish m a -> m forall (m :: * -> *) b a. Foldable m => (b -> a -> b) -> b -> LastToFinish m a -> b forall (m :: * -> *) a b. Foldable m => (a -> b -> b) -> b -> LastToFinish m a -> b forall (t :: * -> *). (forall m. Monoid m => t m -> m) -> (forall m a. Monoid m => (a -> m) -> t a -> m) -> (forall m a. Monoid m => (a -> m) -> t a -> m) -> (forall a b. (a -> b -> b) -> b -> t a -> b) -> (forall a b. (a -> b -> b) -> b -> t a -> b) -> (forall b a. (b -> a -> b) -> b -> t a -> b) -> (forall b a. (b -> a -> b) -> b -> t a -> b) -> (forall a. (a -> a -> a) -> t a -> a) -> (forall a. (a -> a -> a) -> t a -> a) -> (forall a. t a -> [a]) -> (forall a. t a -> Bool) -> (forall a. t a -> Int) -> (forall a. Eq a => a -> t a -> Bool) -> (forall a. Ord a => t a -> a) -> (forall a. Ord a => t a -> a) -> (forall a. Num a => t a -> a) -> (forall a. Num a => t a -> a) -> Foldable t product :: forall a. Num a => LastToFinish m a -> a $cproduct :: forall (m :: * -> *) a. (Foldable m, Num a) => LastToFinish m a -> a sum :: forall a. Num a => LastToFinish m a -> a $csum :: forall (m :: * -> *) a. (Foldable m, Num a) => LastToFinish m a -> a minimum :: forall a. Ord a => LastToFinish m a -> a $cminimum :: forall (m :: * -> *) a. (Foldable m, Ord a) => LastToFinish m a -> a maximum :: forall a. Ord a => LastToFinish m a -> a $cmaximum :: forall (m :: * -> *) a. (Foldable m, Ord a) => LastToFinish m a -> a elem :: forall a. Eq a => a -> LastToFinish m a -> Bool $celem :: forall (m :: * -> *) a. (Foldable m, Eq a) => a -> LastToFinish m a -> Bool length :: forall a. LastToFinish m a -> Int $clength :: forall (m :: * -> *) a. Foldable m => LastToFinish m a -> Int null :: forall a. LastToFinish m a -> Bool $cnull :: forall (m :: * -> *) a. Foldable m => LastToFinish m a -> Bool toList :: forall a. LastToFinish m a -> [a] $ctoList :: forall (m :: * -> *) a. Foldable m => LastToFinish m a -> [a] foldl1 :: forall a. (a -> a -> a) -> LastToFinish m a -> a $cfoldl1 :: forall (m :: * -> *) a. Foldable m => (a -> a -> a) -> LastToFinish m a -> a foldr1 :: forall a. (a -> a -> a) -> LastToFinish m a -> a $cfoldr1 :: forall (m :: * -> *) a. Foldable m => (a -> a -> a) -> LastToFinish m a -> a foldl' :: forall b a. (b -> a -> b) -> b -> LastToFinish m a -> b $cfoldl' :: forall (m :: * -> *) b a. Foldable m => (b -> a -> b) -> b -> LastToFinish m a -> b foldl :: forall b a. (b -> a -> b) -> b -> LastToFinish m a -> b $cfoldl :: forall (m :: * -> *) b a. Foldable m => (b -> a -> b) -> b -> LastToFinish m a -> b foldr' :: forall a b. (a -> b -> b) -> b -> LastToFinish m a -> b $cfoldr' :: forall (m :: * -> *) a b. Foldable m => (a -> b -> b) -> b -> LastToFinish m a -> b foldr :: forall a b. (a -> b -> b) -> b -> LastToFinish m a -> b $cfoldr :: forall (m :: * -> *) a b. Foldable m => (a -> b -> b) -> b -> LastToFinish m a -> b foldMap' :: forall m a. Monoid m => (a -> m) -> LastToFinish m a -> m $cfoldMap' :: forall (m :: * -> *) m a. (Foldable m, Monoid m) => (a -> m) -> LastToFinish m a -> m foldMap :: forall m a. Monoid m => (a -> m) -> LastToFinish m a -> m $cfoldMap :: forall (m :: * -> *) m a. (Foldable m, Monoid m) => (a -> m) -> LastToFinish m a -> m fold :: forall m. Monoid m => LastToFinish m m -> m $cfold :: forall (m :: * -> *) m. (Foldable m, Monoid m) => LastToFinish m m -> m Foldable via (Ap m) instance MonadPlus m => Semigroup (LastToFinish m a) where LastToFinish m a left <> :: LastToFinish m a -> LastToFinish m a -> LastToFinish m a <> LastToFinish m a right = forall (m :: * -> *) a. m a -> LastToFinish m a LastToFinish forall a b. (a -> b) -> a -> b $ do Either a a a <- forall a b. a -> Either a b Left forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> m a left forall (f :: * -> *) a. Alternative f => f a -> f a -> f a <|> forall a b. b -> Either a b Right forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> m a right case Either a a a of Left {} -> m a right Right {} -> m a left firstToLast :: FirstToFinish m a -> LastToFinish m a firstToLast :: forall (m :: * -> *) a. FirstToFinish m a -> LastToFinish m a firstToLast = coerce :: forall a b. Coercible a b => a -> b coerce lastToFirst :: LastToFinish m a -> FirstToFinish m a lastToFirst :: forall (m :: * -> *) a. LastToFinish m a -> FirstToFinish m a lastToFirst = coerce :: forall a b. Coercible a b => a -> b coerce -- | Last-to-finish synchronisation. Like 'Ap' it is a monoid under '<*>'. -- The advantage over 'LastToFinish' is that it has a 'Monoid' instance, but -- 'a' must be a 'Monoid' as well. 'LastToFinishM' and 'FirstToFinish' form -- a unitial near-ring when @m ~ STM@. -- -- > -- | Read all 'TMVar's and combine the result using 'Monoid' instance. -- > -- -- > readAllTMVars :: Monoid a => [TMVar a] -> STM a -- > readAllTMVars = runLastToFinish -- > . foldMap (LastToFinish . readTMVar) -- newtype LastToFinishM m a = LastToFinishM { forall (m :: * -> *) a. LastToFinishM m a -> m a runLastToFinishM :: m a } deriving newtype forall a b. a -> LastToFinishM m b -> LastToFinishM m a forall a b. (a -> b) -> LastToFinishM m a -> LastToFinishM m b forall (m :: * -> *) a b. Functor m => a -> LastToFinishM m b -> LastToFinishM m a forall (m :: * -> *) a b. Functor m => (a -> b) -> LastToFinishM m a -> LastToFinishM m b forall (f :: * -> *). (forall a b. (a -> b) -> f a -> f b) -> (forall a b. a -> f b -> f a) -> Functor f <$ :: forall a b. a -> LastToFinishM m b -> LastToFinishM m a $c<$ :: forall (m :: * -> *) a b. Functor m => a -> LastToFinishM m b -> LastToFinishM m a fmap :: forall a b. (a -> b) -> LastToFinishM m a -> LastToFinishM m b $cfmap :: forall (m :: * -> *) a b. Functor m => (a -> b) -> LastToFinishM m a -> LastToFinishM m b Functor deriving ( forall a. (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a forall (m :: * -> *) a x. Rep (LastToFinishM m a) x -> LastToFinishM m a forall (m :: * -> *) a x. LastToFinishM m a -> Rep (LastToFinishM m a) x $cto :: forall (m :: * -> *) a x. Rep (LastToFinishM m a) x -> LastToFinishM m a $cfrom :: forall (m :: * -> *) a x. LastToFinishM m a -> Rep (LastToFinishM m a) x Generic , forall k (f :: k -> *). (forall (a :: k). f a -> Rep1 f a) -> (forall (a :: k). Rep1 f a -> f a) -> Generic1 f forall (m :: * -> *) a. Rep1 (LastToFinishM m) a -> LastToFinishM m a forall (m :: * -> *) a. LastToFinishM m a -> Rep1 (LastToFinishM m) a $cto1 :: forall (m :: * -> *) a. Rep1 (LastToFinishM m) a -> LastToFinishM m a $cfrom1 :: forall (m :: * -> *) a. LastToFinishM m a -> Rep1 (LastToFinishM m) a Generic1 , forall a. a -> LastToFinishM m a forall a b. LastToFinishM m a -> LastToFinishM m b -> LastToFinishM m a forall a b. LastToFinishM m a -> LastToFinishM m b -> LastToFinishM m b forall a b. LastToFinishM m (a -> b) -> LastToFinishM m a -> LastToFinishM m b forall a b c. (a -> b -> c) -> LastToFinishM m a -> LastToFinishM m b -> LastToFinishM m c forall (f :: * -> *). Functor f -> (forall a. a -> f a) -> (forall a b. f (a -> b) -> f a -> f b) -> (forall a b c. (a -> b -> c) -> f a -> f b -> f c) -> (forall a b. f a -> f b -> f b) -> (forall a b. f a -> f b -> f a) -> Applicative f forall {m :: * -> *}. Applicative m => Functor (LastToFinishM m) forall (m :: * -> *) a. Applicative m => a -> LastToFinishM m a forall (m :: * -> *) a b. Applicative m => LastToFinishM m a -> LastToFinishM m b -> LastToFinishM m a forall (m :: * -> *) a b. Applicative m => LastToFinishM m a -> LastToFinishM m b -> LastToFinishM m b forall (m :: * -> *) a b. Applicative m => LastToFinishM m (a -> b) -> LastToFinishM m a -> LastToFinishM m b forall (m :: * -> *) a b c. Applicative m => (a -> b -> c) -> LastToFinishM m a -> LastToFinishM m b -> LastToFinishM m c <* :: forall a b. LastToFinishM m a -> LastToFinishM m b -> LastToFinishM m a $c<* :: forall (m :: * -> *) a b. Applicative m => LastToFinishM m a -> LastToFinishM m b -> LastToFinishM m a *> :: forall a b. LastToFinishM m a -> LastToFinishM m b -> LastToFinishM m b $c*> :: forall (m :: * -> *) a b. Applicative m => LastToFinishM m a -> LastToFinishM m b -> LastToFinishM m b liftA2 :: forall a b c. (a -> b -> c) -> LastToFinishM m a -> LastToFinishM m b -> LastToFinishM m c $cliftA2 :: forall (m :: * -> *) a b c. Applicative m => (a -> b -> c) -> LastToFinishM m a -> LastToFinishM m b -> LastToFinishM m c <*> :: forall a b. LastToFinishM m (a -> b) -> LastToFinishM m a -> LastToFinishM m b $c<*> :: forall (m :: * -> *) a b. Applicative m => LastToFinishM m (a -> b) -> LastToFinishM m a -> LastToFinishM m b pure :: forall a. a -> LastToFinishM m a $cpure :: forall (m :: * -> *) a. Applicative m => a -> LastToFinishM m a Applicative , forall a. LastToFinishM m a forall a. LastToFinishM m a -> LastToFinishM m [a] forall a. LastToFinishM m a -> LastToFinishM m a -> LastToFinishM m a forall (f :: * -> *). Applicative f -> (forall a. f a) -> (forall a. f a -> f a -> f a) -> (forall a. f a -> f [a]) -> (forall a. f a -> f [a]) -> Alternative f forall {m :: * -> *}. Alternative m => Applicative (LastToFinishM m) forall (m :: * -> *) a. Alternative m => LastToFinishM m a forall (m :: * -> *) a. Alternative m => LastToFinishM m a -> LastToFinishM m [a] forall (m :: * -> *) a. Alternative m => LastToFinishM m a -> LastToFinishM m a -> LastToFinishM m a many :: forall a. LastToFinishM m a -> LastToFinishM m [a] $cmany :: forall (m :: * -> *) a. Alternative m => LastToFinishM m a -> LastToFinishM m [a] some :: forall a. LastToFinishM m a -> LastToFinishM m [a] $csome :: forall (m :: * -> *) a. Alternative m => LastToFinishM m a -> LastToFinishM m [a] <|> :: forall a. LastToFinishM m a -> LastToFinishM m a -> LastToFinishM m a $c<|> :: forall (m :: * -> *) a. Alternative m => LastToFinishM m a -> LastToFinishM m a -> LastToFinishM m a empty :: forall a. LastToFinishM m a $cempty :: forall (m :: * -> *) a. Alternative m => LastToFinishM m a Alternative , forall a. a -> LastToFinishM m a forall a b. LastToFinishM m a -> LastToFinishM m b -> LastToFinishM m b forall a b. LastToFinishM m a -> (a -> LastToFinishM m b) -> LastToFinishM m b forall {m :: * -> *}. Monad m => Applicative (LastToFinishM m) forall (m :: * -> *) a. Monad m => a -> LastToFinishM m a forall (m :: * -> *) a b. Monad m => LastToFinishM m a -> LastToFinishM m b -> LastToFinishM m b forall (m :: * -> *) a b. Monad m => LastToFinishM m a -> (a -> LastToFinishM m b) -> LastToFinishM m b forall (m :: * -> *). Applicative m -> (forall a b. m a -> (a -> m b) -> m b) -> (forall a b. m a -> m b -> m b) -> (forall a. a -> m a) -> Monad m return :: forall a. a -> LastToFinishM m a $creturn :: forall (m :: * -> *) a. Monad m => a -> LastToFinishM m a >> :: forall a b. LastToFinishM m a -> LastToFinishM m b -> LastToFinishM m b $c>> :: forall (m :: * -> *) a b. Monad m => LastToFinishM m a -> LastToFinishM m b -> LastToFinishM m b >>= :: forall a b. LastToFinishM m a -> (a -> LastToFinishM m b) -> LastToFinishM m b $c>>= :: forall (m :: * -> *) a b. Monad m => LastToFinishM m a -> (a -> LastToFinishM m b) -> LastToFinishM m b Monad , forall a. LastToFinishM m a forall a. LastToFinishM m a -> LastToFinishM m a -> LastToFinishM m a forall {m :: * -> *}. MonadPlus m => Monad (LastToFinishM m) forall {m :: * -> *}. MonadPlus m => Alternative (LastToFinishM m) forall (m :: * -> *) a. MonadPlus m => LastToFinishM m a forall (m :: * -> *) a. MonadPlus m => LastToFinishM m a -> LastToFinishM m a -> LastToFinishM m a forall (m :: * -> *). Alternative m -> Monad m -> (forall a. m a) -> (forall a. m a -> m a -> m a) -> MonadPlus m mplus :: forall a. LastToFinishM m a -> LastToFinishM m a -> LastToFinishM m a $cmplus :: forall (m :: * -> *) a. MonadPlus m => LastToFinishM m a -> LastToFinishM m a -> LastToFinishM m a mzero :: forall a. LastToFinishM m a $cmzero :: forall (m :: * -> *) a. MonadPlus m => LastToFinishM m a MonadPlus , forall (t :: * -> *). Functor t -> Foldable t -> (forall (f :: * -> *) a b. Applicative f => (a -> f b) -> t a -> f (t b)) -> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a)) -> (forall (m :: * -> *) a b. Monad m => (a -> m b) -> t a -> m (t b)) -> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a)) -> Traversable t forall {m :: * -> *}. Traversable m => Functor (LastToFinishM m) forall {m :: * -> *}. Traversable m => Foldable (LastToFinishM m) forall (m :: * -> *) (m :: * -> *) a. (Traversable m, Monad m) => LastToFinishM m (m a) -> m (LastToFinishM m a) forall (m :: * -> *) (f :: * -> *) a. (Traversable m, Applicative f) => LastToFinishM m (f a) -> f (LastToFinishM m a) forall (m :: * -> *) (m :: * -> *) a b. (Traversable m, Monad m) => (a -> m b) -> LastToFinishM m a -> m (LastToFinishM m b) forall (m :: * -> *) (f :: * -> *) a b. (Traversable m, Applicative f) => (a -> f b) -> LastToFinishM m a -> f (LastToFinishM m b) forall (f :: * -> *) a b. Applicative f => (a -> f b) -> LastToFinishM m a -> f (LastToFinishM m b) sequence :: forall (m :: * -> *) a. Monad m => LastToFinishM m (m a) -> m (LastToFinishM m a) $csequence :: forall (m :: * -> *) (m :: * -> *) a. (Traversable m, Monad m) => LastToFinishM m (m a) -> m (LastToFinishM m a) mapM :: forall (m :: * -> *) a b. Monad m => (a -> m b) -> LastToFinishM m a -> m (LastToFinishM m b) $cmapM :: forall (m :: * -> *) (m :: * -> *) a b. (Traversable m, Monad m) => (a -> m b) -> LastToFinishM m a -> m (LastToFinishM m b) sequenceA :: forall (f :: * -> *) a. Applicative f => LastToFinishM m (f a) -> f (LastToFinishM m a) $csequenceA :: forall (m :: * -> *) (f :: * -> *) a. (Traversable m, Applicative f) => LastToFinishM m (f a) -> f (LastToFinishM m a) traverse :: forall (f :: * -> *) a b. Applicative f => (a -> f b) -> LastToFinishM m a -> f (LastToFinishM m b) $ctraverse :: forall (m :: * -> *) (f :: * -> *) a b. (Traversable m, Applicative f) => (a -> f b) -> LastToFinishM m a -> f (LastToFinishM m b) Traversable ) deriving NonEmpty (LastToFinishM m a) -> LastToFinishM m a LastToFinishM m a -> LastToFinishM m a -> LastToFinishM m a forall b. Integral b => b -> LastToFinishM m a -> LastToFinishM m a forall a. (a -> a -> a) -> (NonEmpty a -> a) -> (forall b. Integral b => b -> a -> a) -> Semigroup a forall (m :: * -> *) a. (Applicative m, Semigroup a) => NonEmpty (LastToFinishM m a) -> LastToFinishM m a forall (m :: * -> *) a. (Applicative m, Semigroup a) => LastToFinishM m a -> LastToFinishM m a -> LastToFinishM m a forall (m :: * -> *) a b. (Applicative m, Semigroup a, Integral b) => b -> LastToFinishM m a -> LastToFinishM m a stimes :: forall b. Integral b => b -> LastToFinishM m a -> LastToFinishM m a $cstimes :: forall (m :: * -> *) a b. (Applicative m, Semigroup a, Integral b) => b -> LastToFinishM m a -> LastToFinishM m a sconcat :: NonEmpty (LastToFinishM m a) -> LastToFinishM m a $csconcat :: forall (m :: * -> *) a. (Applicative m, Semigroup a) => NonEmpty (LastToFinishM m a) -> LastToFinishM m a <> :: LastToFinishM m a -> LastToFinishM m a -> LastToFinishM m a $c<> :: forall (m :: * -> *) a. (Applicative m, Semigroup a) => LastToFinishM m a -> LastToFinishM m a -> LastToFinishM m a Semigroup via (Ap m a) deriving LastToFinishM m a [LastToFinishM m a] -> LastToFinishM m a LastToFinishM m a -> LastToFinishM m a -> LastToFinishM m a forall a. Semigroup a -> a -> (a -> a -> a) -> ([a] -> a) -> Monoid a forall {m :: * -> *} {a}. (Applicative m, Monoid a) => Semigroup (LastToFinishM m a) forall (m :: * -> *) a. (Applicative m, Monoid a) => LastToFinishM m a forall (m :: * -> *) a. (Applicative m, Monoid a) => [LastToFinishM m a] -> LastToFinishM m a forall (m :: * -> *) a. (Applicative m, Monoid a) => LastToFinishM m a -> LastToFinishM m a -> LastToFinishM m a mconcat :: [LastToFinishM m a] -> LastToFinishM m a $cmconcat :: forall (m :: * -> *) a. (Applicative m, Monoid a) => [LastToFinishM m a] -> LastToFinishM m a mappend :: LastToFinishM m a -> LastToFinishM m a -> LastToFinishM m a $cmappend :: forall (m :: * -> *) a. (Applicative m, Monoid a) => LastToFinishM m a -> LastToFinishM m a -> LastToFinishM m a mempty :: LastToFinishM m a $cmempty :: forall (m :: * -> *) a. (Applicative m, Monoid a) => LastToFinishM m a Monoid via (Ap m a) deriving forall a. Eq a => a -> LastToFinishM m a -> Bool forall a. Num a => LastToFinishM m a -> a forall a. Ord a => LastToFinishM m a -> a forall m. Monoid m => LastToFinishM m m -> m forall a. LastToFinishM m a -> Bool forall a. LastToFinishM m a -> Int forall a. LastToFinishM m a -> [a] forall a. (a -> a -> a) -> LastToFinishM m a -> a forall m a. Monoid m => (a -> m) -> LastToFinishM m a -> m forall b a. (b -> a -> b) -> b -> LastToFinishM m a -> b forall a b. (a -> b -> b) -> b -> LastToFinishM m a -> b forall (m :: * -> *) a. (Foldable m, Eq a) => a -> LastToFinishM m a -> Bool forall (m :: * -> *) a. (Foldable m, Num a) => LastToFinishM m a -> a forall (m :: * -> *) a. (Foldable m, Ord a) => LastToFinishM m a -> a forall (m :: * -> *) m. (Foldable m, Monoid m) => LastToFinishM m m -> m forall (m :: * -> *) a. Foldable m => LastToFinishM m a -> Bool forall (m :: * -> *) a. Foldable m => LastToFinishM m a -> Int forall (m :: * -> *) a. Foldable m => LastToFinishM m a -> [a] forall (m :: * -> *) a. Foldable m => (a -> a -> a) -> LastToFinishM m a -> a forall (m :: * -> *) m a. (Foldable m, Monoid m) => (a -> m) -> LastToFinishM m a -> m forall (m :: * -> *) b a. Foldable m => (b -> a -> b) -> b -> LastToFinishM m a -> b forall (m :: * -> *) a b. Foldable m => (a -> b -> b) -> b -> LastToFinishM m a -> b forall (t :: * -> *). (forall m. Monoid m => t m -> m) -> (forall m a. Monoid m => (a -> m) -> t a -> m) -> (forall m a. Monoid m => (a -> m) -> t a -> m) -> (forall a b. (a -> b -> b) -> b -> t a -> b) -> (forall a b. (a -> b -> b) -> b -> t a -> b) -> (forall b a. (b -> a -> b) -> b -> t a -> b) -> (forall b a. (b -> a -> b) -> b -> t a -> b) -> (forall a. (a -> a -> a) -> t a -> a) -> (forall a. (a -> a -> a) -> t a -> a) -> (forall a. t a -> [a]) -> (forall a. t a -> Bool) -> (forall a. t a -> Int) -> (forall a. Eq a => a -> t a -> Bool) -> (forall a. Ord a => t a -> a) -> (forall a. Ord a => t a -> a) -> (forall a. Num a => t a -> a) -> (forall a. Num a => t a -> a) -> Foldable t product :: forall a. Num a => LastToFinishM m a -> a $cproduct :: forall (m :: * -> *) a. (Foldable m, Num a) => LastToFinishM m a -> a sum :: forall a. Num a => LastToFinishM m a -> a $csum :: forall (m :: * -> *) a. (Foldable m, Num a) => LastToFinishM m a -> a minimum :: forall a. Ord a => LastToFinishM m a -> a $cminimum :: forall (m :: * -> *) a. (Foldable m, Ord a) => LastToFinishM m a -> a maximum :: forall a. Ord a => LastToFinishM m a -> a $cmaximum :: forall (m :: * -> *) a. (Foldable m, Ord a) => LastToFinishM m a -> a elem :: forall a. Eq a => a -> LastToFinishM m a -> Bool $celem :: forall (m :: * -> *) a. (Foldable m, Eq a) => a -> LastToFinishM m a -> Bool length :: forall a. LastToFinishM m a -> Int $clength :: forall (m :: * -> *) a. Foldable m => LastToFinishM m a -> Int null :: forall a. LastToFinishM m a -> Bool $cnull :: forall (m :: * -> *) a. Foldable m => LastToFinishM m a -> Bool toList :: forall a. LastToFinishM m a -> [a] $ctoList :: forall (m :: * -> *) a. Foldable m => LastToFinishM m a -> [a] foldl1 :: forall a. (a -> a -> a) -> LastToFinishM m a -> a $cfoldl1 :: forall (m :: * -> *) a. Foldable m => (a -> a -> a) -> LastToFinishM m a -> a foldr1 :: forall a. (a -> a -> a) -> LastToFinishM m a -> a $cfoldr1 :: forall (m :: * -> *) a. Foldable m => (a -> a -> a) -> LastToFinishM m a -> a foldl' :: forall b a. (b -> a -> b) -> b -> LastToFinishM m a -> b $cfoldl' :: forall (m :: * -> *) b a. Foldable m => (b -> a -> b) -> b -> LastToFinishM m a -> b foldl :: forall b a. (b -> a -> b) -> b -> LastToFinishM m a -> b $cfoldl :: forall (m :: * -> *) b a. Foldable m => (b -> a -> b) -> b -> LastToFinishM m a -> b foldr' :: forall a b. (a -> b -> b) -> b -> LastToFinishM m a -> b $cfoldr' :: forall (m :: * -> *) a b. Foldable m => (a -> b -> b) -> b -> LastToFinishM m a -> b foldr :: forall a b. (a -> b -> b) -> b -> LastToFinishM m a -> b $cfoldr :: forall (m :: * -> *) a b. Foldable m => (a -> b -> b) -> b -> LastToFinishM m a -> b foldMap' :: forall m a. Monoid m => (a -> m) -> LastToFinishM m a -> m $cfoldMap' :: forall (m :: * -> *) m a. (Foldable m, Monoid m) => (a -> m) -> LastToFinishM m a -> m foldMap :: forall m a. Monoid m => (a -> m) -> LastToFinishM m a -> m $cfoldMap :: forall (m :: * -> *) m a. (Foldable m, Monoid m) => (a -> m) -> LastToFinishM m a -> m fold :: forall m. Monoid m => LastToFinishM m m -> m $cfold :: forall (m :: * -> *) m. (Foldable m, Monoid m) => LastToFinishM m m -> m Foldable via (Ap m) firstToLastM :: FirstToFinish m a -> LastToFinishM m a firstToLastM :: forall (m :: * -> *) a. FirstToFinish m a -> LastToFinishM m a firstToLastM = coerce :: forall a b. Coercible a b => a -> b coerce lastToFirstM :: LastToFinishM m a -> FirstToFinish m a lastToFirstM :: forall (m :: * -> *) a. LastToFinishM m a -> FirstToFinish m a lastToFirstM = coerce :: forall a b. Coercible a b => a -> b coerce