{-# 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 { FirstToFinish m a -> m a runFirstToFinish :: m a } deriving newtype a -> FirstToFinish m b -> FirstToFinish m a (a -> b) -> FirstToFinish m a -> FirstToFinish m b (forall a b. (a -> b) -> FirstToFinish m a -> FirstToFinish m b) -> (forall a b. a -> FirstToFinish m b -> FirstToFinish m a) -> Functor (FirstToFinish m) 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 <$ :: a -> FirstToFinish m b -> FirstToFinish m a $c<$ :: forall (m :: * -> *) a b. Functor m => a -> FirstToFinish m b -> FirstToFinish m a fmap :: (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 x. FirstToFinish m a -> Rep (FirstToFinish m a) x) -> (forall x. Rep (FirstToFinish m a) x -> FirstToFinish m a) -> Generic (FirstToFinish m a) forall x. Rep (FirstToFinish m a) x -> FirstToFinish m a forall x. FirstToFinish m a -> Rep (FirstToFinish m a) x 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 a. FirstToFinish m a -> Rep1 (FirstToFinish m) a) -> (forall a. Rep1 (FirstToFinish m) a -> FirstToFinish m a) -> Generic1 (FirstToFinish m) forall a. Rep1 (FirstToFinish m) a -> FirstToFinish m a forall a. FirstToFinish m a -> Rep1 (FirstToFinish m) a 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 , Functor (FirstToFinish m) a -> FirstToFinish m a Functor (FirstToFinish m) -> (forall a. a -> FirstToFinish m a) -> (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 a b. FirstToFinish m a -> FirstToFinish m b -> FirstToFinish m b) -> (forall a b. FirstToFinish m a -> FirstToFinish m b -> FirstToFinish m a) -> Applicative (FirstToFinish m) FirstToFinish m a -> FirstToFinish m b -> FirstToFinish m b FirstToFinish m a -> FirstToFinish m b -> FirstToFinish m a FirstToFinish m (a -> b) -> FirstToFinish m a -> FirstToFinish m b (a -> b -> c) -> FirstToFinish m a -> FirstToFinish m b -> FirstToFinish m c 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 <* :: 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 *> :: 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 :: (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 <*> :: 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 :: a -> FirstToFinish m a $cpure :: forall (m :: * -> *) a. Applicative m => a -> FirstToFinish m a $cp1Applicative :: forall (m :: * -> *). Applicative m => Functor (FirstToFinish m) Applicative , Applicative (FirstToFinish m) FirstToFinish m a Applicative (FirstToFinish m) -> (forall a. FirstToFinish m a) -> (forall a. FirstToFinish m a -> FirstToFinish m a -> FirstToFinish m a) -> (forall a. FirstToFinish m a -> FirstToFinish m [a]) -> (forall a. FirstToFinish m a -> FirstToFinish m [a]) -> Alternative (FirstToFinish m) FirstToFinish m a -> FirstToFinish m a -> FirstToFinish m a FirstToFinish m a -> FirstToFinish m [a] FirstToFinish m a -> FirstToFinish m [a] 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 :: FirstToFinish m a -> FirstToFinish m [a] $cmany :: forall (m :: * -> *) a. Alternative m => FirstToFinish m a -> FirstToFinish m [a] some :: FirstToFinish m a -> FirstToFinish m [a] $csome :: forall (m :: * -> *) a. Alternative m => 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 empty :: FirstToFinish m a $cempty :: forall (m :: * -> *) a. Alternative m => FirstToFinish m a $cp1Alternative :: forall (m :: * -> *). Alternative m => Applicative (FirstToFinish m) Alternative , Applicative (FirstToFinish m) a -> FirstToFinish m a Applicative (FirstToFinish m) -> (forall a b. FirstToFinish m a -> (a -> FirstToFinish m b) -> FirstToFinish m b) -> (forall a b. FirstToFinish m a -> FirstToFinish m b -> FirstToFinish m b) -> (forall a. a -> FirstToFinish m a) -> Monad (FirstToFinish m) FirstToFinish m a -> (a -> FirstToFinish m b) -> FirstToFinish m b FirstToFinish m a -> FirstToFinish m b -> FirstToFinish m b 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 :: a -> FirstToFinish m a $creturn :: forall (m :: * -> *) a. Monad m => a -> FirstToFinish m a >> :: 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 >>= :: 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 $cp1Monad :: forall (m :: * -> *). Monad m => Applicative (FirstToFinish m) Monad , Monad (FirstToFinish m) Alternative (FirstToFinish m) FirstToFinish m a Alternative (FirstToFinish m) -> Monad (FirstToFinish m) -> (forall a. FirstToFinish m a) -> (forall a. FirstToFinish m a -> FirstToFinish m a -> FirstToFinish m a) -> MonadPlus (FirstToFinish m) FirstToFinish m a -> FirstToFinish m a -> FirstToFinish m a forall a. FirstToFinish m a forall a. 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 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 mplus :: 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 :: FirstToFinish m a $cmzero :: forall (m :: * -> *) a. MonadPlus m => FirstToFinish m a $cp2MonadPlus :: forall (m :: * -> *). MonadPlus m => Monad (FirstToFinish m) $cp1MonadPlus :: forall (m :: * -> *). MonadPlus m => Alternative (FirstToFinish m) MonadPlus , Functor (FirstToFinish m) Foldable (FirstToFinish m) Functor (FirstToFinish m) -> Foldable (FirstToFinish m) -> (forall (f :: * -> *) a b. Applicative f => (a -> f b) -> FirstToFinish m a -> f (FirstToFinish m b)) -> (forall (f :: * -> *) a. Applicative f => FirstToFinish m (f a) -> f (FirstToFinish m a)) -> (forall (m :: * -> *) a b. Monad m => (a -> m b) -> FirstToFinish m a -> m (FirstToFinish m b)) -> (forall (m :: * -> *) a. Monad m => FirstToFinish m (m a) -> m (FirstToFinish m a)) -> Traversable (FirstToFinish m) (a -> f b) -> FirstToFinish m a -> f (FirstToFinish m b) 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 (m :: * -> *) a. Monad m => FirstToFinish m (m a) -> m (FirstToFinish m a) forall (f :: * -> *) a. Applicative f => FirstToFinish m (f a) -> f (FirstToFinish m a) forall (m :: * -> *) a b. Monad m => (a -> m b) -> FirstToFinish m a -> m (FirstToFinish m b) forall (f :: * -> *) a b. Applicative f => (a -> f b) -> FirstToFinish m a -> f (FirstToFinish m b) sequence :: 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 :: (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 :: 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 :: (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) $cp2Traversable :: forall (m :: * -> *). Traversable m => Foldable (FirstToFinish m) $cp1Traversable :: forall (m :: * -> *). Traversable m => Functor (FirstToFinish m) Traversable ) deriving b -> FirstToFinish m a -> FirstToFinish m a NonEmpty (FirstToFinish m a) -> FirstToFinish m a FirstToFinish m a -> FirstToFinish m a -> FirstToFinish m a (FirstToFinish m a -> FirstToFinish m a -> FirstToFinish m a) -> (NonEmpty (FirstToFinish m a) -> FirstToFinish m a) -> (forall b. Integral b => b -> FirstToFinish m a -> FirstToFinish m a) -> Semigroup (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 :: 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 Semigroup (FirstToFinish m a) FirstToFinish m a Semigroup (FirstToFinish m a) -> FirstToFinish m a -> (FirstToFinish m a -> FirstToFinish m a -> FirstToFinish m a) -> ([FirstToFinish m a] -> FirstToFinish m a) -> Monoid (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 $cp1Monoid :: forall (m :: * -> *) a. Alternative m => Semigroup (FirstToFinish m a) Monoid via (Alt m a) deriving a -> FirstToFinish m a -> Bool FirstToFinish m m -> m FirstToFinish m a -> [a] FirstToFinish m a -> Bool FirstToFinish m a -> Int FirstToFinish m a -> a FirstToFinish m a -> a FirstToFinish m a -> a FirstToFinish m a -> a (a -> m) -> FirstToFinish m a -> m (a -> m) -> FirstToFinish m a -> m (a -> b -> b) -> b -> FirstToFinish m a -> b (a -> b -> b) -> b -> FirstToFinish m a -> b (b -> a -> b) -> b -> FirstToFinish m a -> b (b -> a -> b) -> b -> FirstToFinish m a -> b (a -> a -> a) -> FirstToFinish m a -> a (a -> a -> a) -> FirstToFinish m a -> a (forall m. Monoid m => FirstToFinish m m -> m) -> (forall m a. Monoid m => (a -> m) -> FirstToFinish m a -> m) -> (forall m a. Monoid m => (a -> m) -> FirstToFinish m a -> m) -> (forall a b. (a -> b -> b) -> b -> FirstToFinish m a -> b) -> (forall a b. (a -> b -> b) -> b -> FirstToFinish m a -> b) -> (forall b a. (b -> a -> b) -> b -> FirstToFinish m a -> b) -> (forall b a. (b -> a -> b) -> b -> FirstToFinish m a -> b) -> (forall a. (a -> a -> a) -> FirstToFinish m a -> a) -> (forall a. (a -> a -> a) -> FirstToFinish m a -> a) -> (forall a. FirstToFinish m a -> [a]) -> (forall a. FirstToFinish m a -> Bool) -> (forall a. FirstToFinish m a -> Int) -> (forall a. Eq a => a -> FirstToFinish m a -> Bool) -> (forall a. Ord a => FirstToFinish m a -> a) -> (forall a. Ord a => FirstToFinish m a -> a) -> (forall a. Num a => FirstToFinish m a -> a) -> (forall a. Num a => FirstToFinish m a -> a) -> Foldable (FirstToFinish m) 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 :: FirstToFinish m a -> a $cproduct :: forall (m :: * -> *) a. (Foldable m, Num a) => FirstToFinish m a -> a sum :: FirstToFinish m a -> a $csum :: forall (m :: * -> *) a. (Foldable m, Num a) => FirstToFinish m a -> a minimum :: FirstToFinish m a -> a $cminimum :: forall (m :: * -> *) a. (Foldable m, Ord a) => FirstToFinish m a -> a maximum :: FirstToFinish m a -> a $cmaximum :: forall (m :: * -> *) a. (Foldable m, Ord a) => FirstToFinish m a -> a elem :: a -> FirstToFinish m a -> Bool $celem :: forall (m :: * -> *) a. (Foldable m, Eq a) => a -> FirstToFinish m a -> Bool length :: FirstToFinish m a -> Int $clength :: forall (m :: * -> *) a. Foldable m => FirstToFinish m a -> Int null :: FirstToFinish m a -> Bool $cnull :: forall (m :: * -> *) a. Foldable m => FirstToFinish m a -> Bool toList :: FirstToFinish m a -> [a] $ctoList :: forall (m :: * -> *) a. Foldable m => FirstToFinish m a -> [a] foldl1 :: (a -> a -> a) -> FirstToFinish m a -> a $cfoldl1 :: forall (m :: * -> *) a. Foldable m => (a -> a -> a) -> FirstToFinish m a -> a foldr1 :: (a -> a -> a) -> FirstToFinish m a -> a $cfoldr1 :: forall (m :: * -> *) a. Foldable m => (a -> a -> a) -> FirstToFinish m a -> a foldl' :: (b -> a -> b) -> b -> FirstToFinish m a -> b $cfoldl' :: forall (m :: * -> *) b a. Foldable m => (b -> a -> b) -> b -> FirstToFinish m a -> b foldl :: (b -> a -> b) -> b -> FirstToFinish m a -> b $cfoldl :: forall (m :: * -> *) b a. Foldable m => (b -> a -> b) -> b -> FirstToFinish m a -> b foldr' :: (a -> b -> b) -> b -> FirstToFinish m a -> b $cfoldr' :: forall (m :: * -> *) a b. Foldable m => (a -> b -> b) -> b -> FirstToFinish m a -> b foldr :: (a -> b -> b) -> b -> FirstToFinish m a -> b $cfoldr :: forall (m :: * -> *) a b. Foldable m => (a -> b -> b) -> b -> FirstToFinish m a -> b foldMap' :: (a -> m) -> FirstToFinish m a -> m $cfoldMap' :: forall (m :: * -> *) m a. (Foldable m, Monoid m) => (a -> m) -> FirstToFinish m a -> m foldMap :: (a -> m) -> FirstToFinish m a -> m $cfoldMap :: forall (m :: * -> *) m a. (Foldable m, Monoid m) => (a -> m) -> FirstToFinish m a -> m fold :: FirstToFinish m m -> m $cfold :: forall (m :: * -> *) m. (Foldable m, Monoid m) => FirstToFinish m m -> m Foldable via (Alt m) deriving b -> FirstToFinish m b -> FirstToFinish m a (a -> b) -> FirstToFinish m b -> FirstToFinish m a (forall a b. (a -> b) -> FirstToFinish m b -> FirstToFinish m a) -> (forall b a. b -> FirstToFinish m b -> FirstToFinish m a) -> Contravariant (FirstToFinish m) forall b a. b -> FirstToFinish m b -> FirstToFinish m a forall a b. (a -> b) -> FirstToFinish m b -> FirstToFinish m a forall (m :: * -> *) b a. Contravariant m => b -> FirstToFinish m b -> FirstToFinish m a forall (m :: * -> *) a b. Contravariant m => (a -> b) -> FirstToFinish m b -> FirstToFinish m a forall (f :: * -> *). (forall a b. (a -> b) -> f b -> f a) -> (forall b a. b -> f b -> f a) -> Contravariant f >$ :: b -> FirstToFinish m b -> FirstToFinish m a $c>$ :: forall (m :: * -> *) b a. Contravariant m => b -> FirstToFinish m b -> FirstToFinish m a contramap :: (a -> b) -> FirstToFinish m b -> FirstToFinish m a $ccontramap :: forall (m :: * -> *) a b. Contravariant m => (a -> b) -> FirstToFinish m b -> 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 { LastToFinish m a -> m a runLastToFinish :: m a } deriving newtype a -> LastToFinish m b -> LastToFinish m a (a -> b) -> LastToFinish m a -> LastToFinish m b (forall a b. (a -> b) -> LastToFinish m a -> LastToFinish m b) -> (forall a b. a -> LastToFinish m b -> LastToFinish m a) -> Functor (LastToFinish m) 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 <$ :: a -> LastToFinish m b -> LastToFinish m a $c<$ :: forall (m :: * -> *) a b. Functor m => a -> LastToFinish m b -> LastToFinish m a fmap :: (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 x. LastToFinish m a -> Rep (LastToFinish m a) x) -> (forall x. Rep (LastToFinish m a) x -> LastToFinish m a) -> Generic (LastToFinish m a) forall x. Rep (LastToFinish m a) x -> LastToFinish m a forall x. LastToFinish m a -> Rep (LastToFinish m a) x 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 a. LastToFinish m a -> Rep1 (LastToFinish m) a) -> (forall a. Rep1 (LastToFinish m) a -> LastToFinish m a) -> Generic1 (LastToFinish m) forall a. Rep1 (LastToFinish m) a -> LastToFinish m a forall a. LastToFinish m a -> Rep1 (LastToFinish m) a 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 , Functor (LastToFinish m) a -> LastToFinish m a Functor (LastToFinish m) -> (forall a. a -> LastToFinish m a) -> (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 a b. LastToFinish m a -> LastToFinish m b -> LastToFinish m b) -> (forall a b. LastToFinish m a -> LastToFinish m b -> LastToFinish m a) -> Applicative (LastToFinish m) LastToFinish m a -> LastToFinish m b -> LastToFinish m b LastToFinish m a -> LastToFinish m b -> LastToFinish m a LastToFinish m (a -> b) -> LastToFinish m a -> LastToFinish m b (a -> b -> c) -> LastToFinish m a -> LastToFinish m b -> LastToFinish m c 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 <* :: 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 *> :: 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 :: (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 <*> :: 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 :: a -> LastToFinish m a $cpure :: forall (m :: * -> *) a. Applicative m => a -> LastToFinish m a $cp1Applicative :: forall (m :: * -> *). Applicative m => Functor (LastToFinish m) Applicative , Applicative (LastToFinish m) LastToFinish m a Applicative (LastToFinish m) -> (forall a. LastToFinish m a) -> (forall a. LastToFinish m a -> LastToFinish m a -> LastToFinish m a) -> (forall a. LastToFinish m a -> LastToFinish m [a]) -> (forall a. LastToFinish m a -> LastToFinish m [a]) -> Alternative (LastToFinish m) LastToFinish m a -> LastToFinish m a -> LastToFinish m a LastToFinish m a -> LastToFinish m [a] LastToFinish m a -> LastToFinish m [a] 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 :: LastToFinish m a -> LastToFinish m [a] $cmany :: forall (m :: * -> *) a. Alternative m => LastToFinish m a -> LastToFinish m [a] some :: LastToFinish m a -> LastToFinish m [a] $csome :: forall (m :: * -> *) a. Alternative m => LastToFinish m a -> LastToFinish m [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 :: LastToFinish m a $cempty :: forall (m :: * -> *) a. Alternative m => LastToFinish m a $cp1Alternative :: forall (m :: * -> *). Alternative m => Applicative (LastToFinish m) Alternative , Applicative (LastToFinish m) a -> LastToFinish m a Applicative (LastToFinish m) -> (forall a b. LastToFinish m a -> (a -> LastToFinish m b) -> LastToFinish m b) -> (forall a b. LastToFinish m a -> LastToFinish m b -> LastToFinish m b) -> (forall a. a -> LastToFinish m a) -> Monad (LastToFinish m) LastToFinish m a -> (a -> LastToFinish m b) -> LastToFinish m b LastToFinish m a -> LastToFinish m b -> LastToFinish m b 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 :: a -> LastToFinish m a $creturn :: forall (m :: * -> *) a. Monad m => a -> LastToFinish m a >> :: 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 >>= :: 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 $cp1Monad :: forall (m :: * -> *). Monad m => Applicative (LastToFinish m) Monad , Monad (LastToFinish m) Alternative (LastToFinish m) LastToFinish m a Alternative (LastToFinish m) -> Monad (LastToFinish m) -> (forall a. LastToFinish m a) -> (forall a. LastToFinish m a -> LastToFinish m a -> LastToFinish m a) -> MonadPlus (LastToFinish m) LastToFinish m a -> LastToFinish m a -> LastToFinish m a forall a. LastToFinish m a forall a. 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 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 mplus :: 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 :: LastToFinish m a $cmzero :: forall (m :: * -> *) a. MonadPlus m => LastToFinish m a $cp2MonadPlus :: forall (m :: * -> *). MonadPlus m => Monad (LastToFinish m) $cp1MonadPlus :: forall (m :: * -> *). MonadPlus m => Alternative (LastToFinish m) MonadPlus , Functor (LastToFinish m) Foldable (LastToFinish m) Functor (LastToFinish m) -> Foldable (LastToFinish m) -> (forall (f :: * -> *) a b. Applicative f => (a -> f b) -> LastToFinish m a -> f (LastToFinish m b)) -> (forall (f :: * -> *) a. Applicative f => LastToFinish m (f a) -> f (LastToFinish m a)) -> (forall (m :: * -> *) a b. Monad m => (a -> m b) -> LastToFinish m a -> m (LastToFinish m b)) -> (forall (m :: * -> *) a. Monad m => LastToFinish m (m a) -> m (LastToFinish m a)) -> Traversable (LastToFinish m) (a -> f b) -> LastToFinish m a -> f (LastToFinish m b) 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 (m :: * -> *) a. Monad m => LastToFinish m (m a) -> m (LastToFinish m a) forall (f :: * -> *) a. Applicative f => LastToFinish m (f a) -> f (LastToFinish m a) forall (m :: * -> *) a b. Monad m => (a -> m b) -> LastToFinish m a -> m (LastToFinish m b) forall (f :: * -> *) a b. Applicative f => (a -> f b) -> LastToFinish m a -> f (LastToFinish m b) sequence :: 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 :: (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 :: 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 :: (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) $cp2Traversable :: forall (m :: * -> *). Traversable m => Foldable (LastToFinish m) $cp1Traversable :: forall (m :: * -> *). Traversable m => Functor (LastToFinish m) Traversable ) deriving a -> LastToFinish m a -> Bool LastToFinish m m -> m LastToFinish m a -> [a] LastToFinish m a -> Bool LastToFinish m a -> Int LastToFinish m a -> a LastToFinish m a -> a LastToFinish m a -> a LastToFinish m a -> a (a -> m) -> LastToFinish m a -> m (a -> m) -> LastToFinish m a -> m (a -> b -> b) -> b -> LastToFinish m a -> b (a -> b -> b) -> b -> LastToFinish m a -> b (b -> a -> b) -> b -> LastToFinish m a -> b (b -> a -> b) -> b -> LastToFinish m a -> b (a -> a -> a) -> LastToFinish m a -> a (a -> a -> a) -> LastToFinish m a -> a (forall m. Monoid m => LastToFinish m m -> m) -> (forall m a. Monoid m => (a -> m) -> LastToFinish m a -> m) -> (forall m a. Monoid m => (a -> m) -> LastToFinish m a -> m) -> (forall a b. (a -> b -> b) -> b -> LastToFinish m a -> b) -> (forall a b. (a -> b -> b) -> b -> LastToFinish m a -> b) -> (forall b a. (b -> a -> b) -> b -> LastToFinish m a -> b) -> (forall b a. (b -> a -> b) -> b -> LastToFinish m a -> b) -> (forall a. (a -> a -> a) -> LastToFinish m a -> a) -> (forall a. (a -> a -> a) -> LastToFinish m a -> a) -> (forall a. LastToFinish m a -> [a]) -> (forall a. LastToFinish m a -> Bool) -> (forall a. LastToFinish m a -> Int) -> (forall a. Eq a => a -> LastToFinish m a -> Bool) -> (forall a. Ord a => LastToFinish m a -> a) -> (forall a. Ord a => LastToFinish m a -> a) -> (forall a. Num a => LastToFinish m a -> a) -> (forall a. Num a => LastToFinish m a -> a) -> Foldable (LastToFinish m) 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 :: LastToFinish m a -> a $cproduct :: forall (m :: * -> *) a. (Foldable m, Num a) => LastToFinish m a -> a sum :: LastToFinish m a -> a $csum :: forall (m :: * -> *) a. (Foldable m, Num a) => LastToFinish m a -> a minimum :: LastToFinish m a -> a $cminimum :: forall (m :: * -> *) a. (Foldable m, Ord a) => LastToFinish m a -> a maximum :: LastToFinish m a -> a $cmaximum :: forall (m :: * -> *) a. (Foldable m, Ord a) => LastToFinish m a -> a elem :: a -> LastToFinish m a -> Bool $celem :: forall (m :: * -> *) a. (Foldable m, Eq a) => a -> LastToFinish m a -> Bool length :: LastToFinish m a -> Int $clength :: forall (m :: * -> *) a. Foldable m => LastToFinish m a -> Int null :: LastToFinish m a -> Bool $cnull :: forall (m :: * -> *) a. Foldable m => LastToFinish m a -> Bool toList :: LastToFinish m a -> [a] $ctoList :: forall (m :: * -> *) a. Foldable m => LastToFinish m a -> [a] foldl1 :: (a -> a -> a) -> LastToFinish m a -> a $cfoldl1 :: forall (m :: * -> *) a. Foldable m => (a -> a -> a) -> LastToFinish m a -> a foldr1 :: (a -> a -> a) -> LastToFinish m a -> a $cfoldr1 :: forall (m :: * -> *) a. Foldable m => (a -> a -> a) -> LastToFinish m a -> a foldl' :: (b -> a -> b) -> b -> LastToFinish m a -> b $cfoldl' :: forall (m :: * -> *) b a. Foldable m => (b -> a -> b) -> b -> LastToFinish m a -> b foldl :: (b -> a -> b) -> b -> LastToFinish m a -> b $cfoldl :: forall (m :: * -> *) b a. Foldable m => (b -> a -> b) -> b -> LastToFinish m a -> b foldr' :: (a -> b -> b) -> b -> LastToFinish m a -> b $cfoldr' :: forall (m :: * -> *) a b. Foldable m => (a -> b -> b) -> b -> LastToFinish m a -> b foldr :: (a -> b -> b) -> b -> LastToFinish m a -> b $cfoldr :: forall (m :: * -> *) a b. Foldable m => (a -> b -> b) -> b -> LastToFinish m a -> b foldMap' :: (a -> m) -> LastToFinish m a -> m $cfoldMap' :: forall (m :: * -> *) m a. (Foldable m, Monoid m) => (a -> m) -> LastToFinish m a -> m foldMap :: (a -> m) -> LastToFinish m a -> m $cfoldMap :: forall (m :: * -> *) m a. (Foldable m, Monoid m) => (a -> m) -> LastToFinish m a -> m fold :: 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 = m a -> LastToFinish m a forall (m :: * -> *) a. m a -> LastToFinish m a LastToFinish (m a -> LastToFinish m a) -> m a -> LastToFinish m a forall a b. (a -> b) -> a -> b $ do Either a a a <- a -> Either a a forall a b. a -> Either a b Left (a -> Either a a) -> m a -> m (Either a a) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> m a left m (Either a a) -> m (Either a a) -> m (Either a a) forall (f :: * -> *) a. Alternative f => f a -> f a -> f a <|> a -> Either a a forall a b. b -> Either a b Right (a -> Either a a) -> m a -> m (Either a a) 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 :: FirstToFinish m a -> LastToFinish m a firstToLast = FirstToFinish m a -> LastToFinish m a coerce lastToFirst :: LastToFinish m a -> FirstToFinish m a lastToFirst :: LastToFinish m a -> FirstToFinish m a lastToFirst = LastToFinish m a -> FirstToFinish m a 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 { LastToFinishM m a -> m a runLastToFinishM :: m a } deriving newtype a -> LastToFinishM m b -> LastToFinishM m a (a -> b) -> LastToFinishM m a -> LastToFinishM m b (forall a b. (a -> b) -> LastToFinishM m a -> LastToFinishM m b) -> (forall a b. a -> LastToFinishM m b -> LastToFinishM m a) -> Functor (LastToFinishM m) 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 <$ :: a -> LastToFinishM m b -> LastToFinishM m a $c<$ :: forall (m :: * -> *) a b. Functor m => a -> LastToFinishM m b -> LastToFinishM m a fmap :: (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 x. LastToFinishM m a -> Rep (LastToFinishM m a) x) -> (forall x. Rep (LastToFinishM m a) x -> LastToFinishM m a) -> Generic (LastToFinishM m a) forall x. Rep (LastToFinishM m a) x -> LastToFinishM m a forall x. LastToFinishM m a -> Rep (LastToFinishM m a) x 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 a. LastToFinishM m a -> Rep1 (LastToFinishM m) a) -> (forall a. Rep1 (LastToFinishM m) a -> LastToFinishM m a) -> Generic1 (LastToFinishM m) forall a. Rep1 (LastToFinishM m) a -> LastToFinishM m a forall a. LastToFinishM m a -> Rep1 (LastToFinishM m) a 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 , Functor (LastToFinishM m) a -> LastToFinishM m a Functor (LastToFinishM m) -> (forall a. a -> LastToFinishM m a) -> (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 a b. LastToFinishM m a -> LastToFinishM m b -> LastToFinishM m b) -> (forall a b. LastToFinishM m a -> LastToFinishM m b -> LastToFinishM m a) -> Applicative (LastToFinishM m) LastToFinishM m a -> LastToFinishM m b -> LastToFinishM m b LastToFinishM m a -> LastToFinishM m b -> LastToFinishM m a LastToFinishM m (a -> b) -> LastToFinishM m a -> LastToFinishM m b (a -> b -> c) -> LastToFinishM m a -> LastToFinishM m b -> LastToFinishM m c 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 <* :: 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 *> :: 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 :: (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 <*> :: 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 :: a -> LastToFinishM m a $cpure :: forall (m :: * -> *) a. Applicative m => a -> LastToFinishM m a $cp1Applicative :: forall (m :: * -> *). Applicative m => Functor (LastToFinishM m) Applicative , Applicative (LastToFinishM m) LastToFinishM m a Applicative (LastToFinishM m) -> (forall a. LastToFinishM m a) -> (forall a. LastToFinishM m a -> LastToFinishM m a -> LastToFinishM m a) -> (forall a. LastToFinishM m a -> LastToFinishM m [a]) -> (forall a. LastToFinishM m a -> LastToFinishM m [a]) -> Alternative (LastToFinishM m) LastToFinishM m a -> LastToFinishM m a -> LastToFinishM m a LastToFinishM m a -> LastToFinishM m [a] LastToFinishM m a -> LastToFinishM m [a] 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 :: LastToFinishM m a -> LastToFinishM m [a] $cmany :: forall (m :: * -> *) a. Alternative m => LastToFinishM m a -> LastToFinishM m [a] some :: LastToFinishM m a -> LastToFinishM m [a] $csome :: forall (m :: * -> *) a. Alternative m => LastToFinishM m a -> LastToFinishM m [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 :: LastToFinishM m a $cempty :: forall (m :: * -> *) a. Alternative m => LastToFinishM m a $cp1Alternative :: forall (m :: * -> *). Alternative m => Applicative (LastToFinishM m) Alternative , Applicative (LastToFinishM m) a -> LastToFinishM m a Applicative (LastToFinishM m) -> (forall a b. LastToFinishM m a -> (a -> LastToFinishM m b) -> LastToFinishM m b) -> (forall a b. LastToFinishM m a -> LastToFinishM m b -> LastToFinishM m b) -> (forall a. a -> LastToFinishM m a) -> Monad (LastToFinishM m) LastToFinishM m a -> (a -> LastToFinishM m b) -> LastToFinishM m b LastToFinishM m a -> LastToFinishM m b -> LastToFinishM m b 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 :: a -> LastToFinishM m a $creturn :: forall (m :: * -> *) a. Monad m => a -> LastToFinishM m a >> :: 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 >>= :: 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 $cp1Monad :: forall (m :: * -> *). Monad m => Applicative (LastToFinishM m) Monad , Monad (LastToFinishM m) Alternative (LastToFinishM m) LastToFinishM m a Alternative (LastToFinishM m) -> Monad (LastToFinishM m) -> (forall a. LastToFinishM m a) -> (forall a. LastToFinishM m a -> LastToFinishM m a -> LastToFinishM m a) -> MonadPlus (LastToFinishM m) LastToFinishM m a -> LastToFinishM m a -> LastToFinishM m a forall a. LastToFinishM m a forall a. 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 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 mplus :: 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 :: LastToFinishM m a $cmzero :: forall (m :: * -> *) a. MonadPlus m => LastToFinishM m a $cp2MonadPlus :: forall (m :: * -> *). MonadPlus m => Monad (LastToFinishM m) $cp1MonadPlus :: forall (m :: * -> *). MonadPlus m => Alternative (LastToFinishM m) MonadPlus , Functor (LastToFinishM m) Foldable (LastToFinishM m) Functor (LastToFinishM m) -> Foldable (LastToFinishM m) -> (forall (f :: * -> *) a b. Applicative f => (a -> f b) -> LastToFinishM m a -> f (LastToFinishM m b)) -> (forall (f :: * -> *) a. Applicative f => LastToFinishM m (f a) -> f (LastToFinishM m a)) -> (forall (m :: * -> *) a b. Monad m => (a -> m b) -> LastToFinishM m a -> m (LastToFinishM m b)) -> (forall (m :: * -> *) a. Monad m => LastToFinishM m (m a) -> m (LastToFinishM m a)) -> Traversable (LastToFinishM m) (a -> f b) -> LastToFinishM m a -> f (LastToFinishM m b) 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 (m :: * -> *) a. Monad m => LastToFinishM m (m a) -> m (LastToFinishM m a) forall (f :: * -> *) a. Applicative f => LastToFinishM m (f a) -> f (LastToFinishM m a) forall (m :: * -> *) a b. Monad m => (a -> m b) -> LastToFinishM m a -> m (LastToFinishM m b) forall (f :: * -> *) a b. Applicative f => (a -> f b) -> LastToFinishM m a -> f (LastToFinishM m b) sequence :: 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 :: (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 :: 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 :: (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) $cp2Traversable :: forall (m :: * -> *). Traversable m => Foldable (LastToFinishM m) $cp1Traversable :: forall (m :: * -> *). Traversable m => Functor (LastToFinishM m) Traversable ) deriving b -> LastToFinishM m a -> LastToFinishM m a NonEmpty (LastToFinishM m a) -> LastToFinishM m a LastToFinishM m a -> LastToFinishM m a -> LastToFinishM m a (LastToFinishM m a -> LastToFinishM m a -> LastToFinishM m a) -> (NonEmpty (LastToFinishM m a) -> LastToFinishM m a) -> (forall b. Integral b => b -> LastToFinishM m a -> LastToFinishM m a) -> Semigroup (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 :: 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 Semigroup (LastToFinishM m a) LastToFinishM m a Semigroup (LastToFinishM m a) -> LastToFinishM m a -> (LastToFinishM m a -> LastToFinishM m a -> LastToFinishM m a) -> ([LastToFinishM m a] -> LastToFinishM m a) -> Monoid (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 $cp1Monoid :: forall (m :: * -> *) a. (Applicative m, Monoid a) => Semigroup (LastToFinishM m a) Monoid via (Ap m a) deriving a -> LastToFinishM m a -> Bool LastToFinishM m m -> m LastToFinishM m a -> [a] LastToFinishM m a -> Bool LastToFinishM m a -> Int LastToFinishM m a -> a LastToFinishM m a -> a LastToFinishM m a -> a LastToFinishM m a -> a (a -> m) -> LastToFinishM m a -> m (a -> m) -> LastToFinishM m a -> m (a -> b -> b) -> b -> LastToFinishM m a -> b (a -> b -> b) -> b -> LastToFinishM m a -> b (b -> a -> b) -> b -> LastToFinishM m a -> b (b -> a -> b) -> b -> LastToFinishM m a -> b (a -> a -> a) -> LastToFinishM m a -> a (a -> a -> a) -> LastToFinishM m a -> a (forall m. Monoid m => LastToFinishM m m -> m) -> (forall m a. Monoid m => (a -> m) -> LastToFinishM m a -> m) -> (forall m a. Monoid m => (a -> m) -> LastToFinishM m a -> m) -> (forall a b. (a -> b -> b) -> b -> LastToFinishM m a -> b) -> (forall a b. (a -> b -> b) -> b -> LastToFinishM m a -> b) -> (forall b a. (b -> a -> b) -> b -> LastToFinishM m a -> b) -> (forall b a. (b -> a -> b) -> b -> LastToFinishM m a -> b) -> (forall a. (a -> a -> a) -> LastToFinishM m a -> a) -> (forall a. (a -> a -> a) -> LastToFinishM m a -> a) -> (forall a. LastToFinishM m a -> [a]) -> (forall a. LastToFinishM m a -> Bool) -> (forall a. LastToFinishM m a -> Int) -> (forall a. Eq a => a -> LastToFinishM m a -> Bool) -> (forall a. Ord a => LastToFinishM m a -> a) -> (forall a. Ord a => LastToFinishM m a -> a) -> (forall a. Num a => LastToFinishM m a -> a) -> (forall a. Num a => LastToFinishM m a -> a) -> Foldable (LastToFinishM m) 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 :: LastToFinishM m a -> a $cproduct :: forall (m :: * -> *) a. (Foldable m, Num a) => LastToFinishM m a -> a sum :: LastToFinishM m a -> a $csum :: forall (m :: * -> *) a. (Foldable m, Num a) => LastToFinishM m a -> a minimum :: LastToFinishM m a -> a $cminimum :: forall (m :: * -> *) a. (Foldable m, Ord a) => LastToFinishM m a -> a maximum :: LastToFinishM m a -> a $cmaximum :: forall (m :: * -> *) a. (Foldable m, Ord a) => LastToFinishM m a -> a elem :: a -> LastToFinishM m a -> Bool $celem :: forall (m :: * -> *) a. (Foldable m, Eq a) => a -> LastToFinishM m a -> Bool length :: LastToFinishM m a -> Int $clength :: forall (m :: * -> *) a. Foldable m => LastToFinishM m a -> Int null :: LastToFinishM m a -> Bool $cnull :: forall (m :: * -> *) a. Foldable m => LastToFinishM m a -> Bool toList :: LastToFinishM m a -> [a] $ctoList :: forall (m :: * -> *) a. Foldable m => LastToFinishM m a -> [a] foldl1 :: (a -> a -> a) -> LastToFinishM m a -> a $cfoldl1 :: forall (m :: * -> *) a. Foldable m => (a -> a -> a) -> LastToFinishM m a -> a foldr1 :: (a -> a -> a) -> LastToFinishM m a -> a $cfoldr1 :: forall (m :: * -> *) a. Foldable m => (a -> a -> a) -> LastToFinishM m a -> a foldl' :: (b -> a -> b) -> b -> LastToFinishM m a -> b $cfoldl' :: forall (m :: * -> *) b a. Foldable m => (b -> a -> b) -> b -> LastToFinishM m a -> b foldl :: (b -> a -> b) -> b -> LastToFinishM m a -> b $cfoldl :: forall (m :: * -> *) b a. Foldable m => (b -> a -> b) -> b -> LastToFinishM m a -> b foldr' :: (a -> b -> b) -> b -> LastToFinishM m a -> b $cfoldr' :: forall (m :: * -> *) a b. Foldable m => (a -> b -> b) -> b -> LastToFinishM m a -> b foldr :: (a -> b -> b) -> b -> LastToFinishM m a -> b $cfoldr :: forall (m :: * -> *) a b. Foldable m => (a -> b -> b) -> b -> LastToFinishM m a -> b foldMap' :: (a -> m) -> LastToFinishM m a -> m $cfoldMap' :: forall (m :: * -> *) m a. (Foldable m, Monoid m) => (a -> m) -> LastToFinishM m a -> m foldMap :: (a -> m) -> LastToFinishM m a -> m $cfoldMap :: forall (m :: * -> *) m a. (Foldable m, Monoid m) => (a -> m) -> LastToFinishM m a -> m fold :: 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 :: FirstToFinish m a -> LastToFinishM m a firstToLastM = FirstToFinish m a -> LastToFinishM m a coerce lastToFirstM :: LastToFinishM m a -> FirstToFinish m a lastToFirstM :: LastToFinishM m a -> FirstToFinish m a lastToFirstM = LastToFinishM m a -> FirstToFinish m a coerce