papa-prelude-semigroupoids-0.0.2: Prelude with only useful functions

Papa.Prelude.Semigroupoids.Data.Functor.Bind

Synopsis

# Documentation

concat :: Bind f => f (f a) -> f a Source #

concatMap :: Bind f => (a -> f b) -> f a -> f b Source #

(>>=) :: Bind f => f a -> (a -> f b) -> f b Source #

(=<<) :: Bind f => (a -> f b) -> f a -> f b Source #

class Apply m => Bind m #

A Monad sans return.

Minimal definition: Either join or >>-

If defining both, then the following laws (the default definitions) must hold:

join = (>>- id)
m >>- f = join (fmap f m)

Laws:

induced definition of <.>: f <.> x = f >>- (<\$> x)

Finally, there are two associativity conditions:

associativity of (>>-):    (m >>- f) >>- g == m >>- (\x -> f x >>- g)
associativity of join:     join . join = join . fmap join

These can both be seen as special cases of the constraint that

associativity of (->-): (f ->- g) ->- h = f ->- (g ->- h)

Minimal complete definition

Instances

 Bind [] Methods(>>-) :: [a] -> (a -> [b]) -> [b] #join :: [[a]] -> [a] # Methods(>>-) :: Maybe a -> (a -> Maybe b) -> Maybe b #join :: Maybe (Maybe a) -> Maybe a # Methods(>>-) :: IO a -> (a -> IO b) -> IO b #join :: IO (IO a) -> IO a # Methods(>>-) :: Identity a -> (a -> Identity b) -> Identity b #join :: Identity (Identity a) -> Identity a # Methods(>>-) :: Option a -> (a -> Option b) -> Option b #join :: Option (Option a) -> Option a # Methods(>>-) :: NonEmpty a -> (a -> NonEmpty b) -> NonEmpty b #join :: NonEmpty (NonEmpty a) -> NonEmpty a # Methods(>>-) :: Tree a -> (a -> Tree b) -> Tree b #join :: Tree (Tree a) -> Tree a # Methods(>>-) :: Seq a -> (a -> Seq b) -> Seq b #join :: Seq (Seq a) -> Seq a # An IntMap is not a Monad, but it is an instance of Bind Methods(>>-) :: IntMap a -> (a -> IntMap b) -> IntMap b #join :: IntMap (IntMap a) -> IntMap a # Bind ((->) m) Methods(>>-) :: (m -> a) -> (a -> m -> b) -> m -> b #join :: (m -> m -> a) -> m -> a # Bind (Either a) Methods(>>-) :: Either a a -> (a -> Either a b) -> Either a b #join :: Either a (Either a a) -> Either a a # Semigroup m => Bind ((,) m) Methods(>>-) :: (m, a) -> (a -> (m, b)) -> (m, b) #join :: (m, (m, a)) -> (m, a) # Monad m => Bind (WrappedMonad m) Methods(>>-) :: WrappedMonad m a -> (a -> WrappedMonad m b) -> WrappedMonad m b #join :: WrappedMonad m (WrappedMonad m a) -> WrappedMonad m a # Ord k => Bind (Map k) A Map is not a Monad, but it is an instance of Bind Methods(>>-) :: Map k a -> (a -> Map k b) -> Map k b #join :: Map k (Map k a) -> Map k a # (Functor m, Monad m) => Bind (MaybeT m) Methods(>>-) :: MaybeT m a -> (a -> MaybeT m b) -> MaybeT m b #join :: MaybeT m (MaybeT m a) -> MaybeT m a # (Apply m, Monad m) => Bind (ListT m) Methods(>>-) :: ListT m a -> (a -> ListT m b) -> ListT m b #join :: ListT m (ListT m a) -> ListT m a # Bind m => Bind (IdentityT * m) Methods(>>-) :: IdentityT * m a -> (a -> IdentityT * m b) -> IdentityT * m b #join :: IdentityT * m (IdentityT * m a) -> IdentityT * m a # (Functor m, Monad m) => Bind (ErrorT e m) Methods(>>-) :: ErrorT e m a -> (a -> ErrorT e m b) -> ErrorT e m b #join :: ErrorT e m (ErrorT e m a) -> ErrorT e m a # (Bind m, Semigroup w) => Bind (WriterT w m) Methods(>>-) :: WriterT w m a -> (a -> WriterT w m b) -> WriterT w m b #join :: WriterT w m (WriterT w m a) -> WriterT w m a # (Bind m, Semigroup w) => Bind (WriterT w m) Methods(>>-) :: WriterT w m a -> (a -> WriterT w m b) -> WriterT w m b #join :: WriterT w m (WriterT w m a) -> WriterT w m a # Bind m => Bind (StateT s m) Methods(>>-) :: StateT s m a -> (a -> StateT s m b) -> StateT s m b #join :: StateT s m (StateT s m a) -> StateT s m a # Bind m => Bind (StateT s m) Methods(>>-) :: StateT s m a -> (a -> StateT s m b) -> StateT s m b #join :: StateT s m (StateT s m a) -> StateT s m a # (Functor m, Monad m) => Bind (ExceptT e m) Methods(>>-) :: ExceptT e m a -> (a -> ExceptT e m b) -> ExceptT e m b #join :: ExceptT e m (ExceptT e m a) -> ExceptT e m a # (Bind f, Bind g) => Bind (Product * f g) Methods(>>-) :: Product * f g a -> (a -> Product * f g b) -> Product * f g b #join :: Product * f g (Product * f g a) -> Product * f g a # Bind m => Bind (ReaderT * e m) Methods(>>-) :: ReaderT * e m a -> (a -> ReaderT * e m b) -> ReaderT * e m b #join :: ReaderT * e m (ReaderT * e m a) -> ReaderT * e m a # Bind (ContT * r m) Methods(>>-) :: ContT * r m a -> (a -> ContT * r m b) -> ContT * r m b #join :: ContT * r m (ContT * r m a) -> ContT * r m a # (Bind m, Semigroup w) => Bind (RWST r w s m) Methods(>>-) :: RWST r w s m a -> (a -> RWST r w s m b) -> RWST r w s m b #join :: RWST r w s m (RWST r w s m a) -> RWST r w s m a # (Bind m, Semigroup w) => Bind (RWST r w s m) Methods(>>-) :: RWST r w s m a -> (a -> RWST r w s m b) -> RWST r w s m b #join :: RWST r w s m (RWST r w s m a) -> RWST r w s m a #