bdcs-0.2.0: Tools for managing a content store of software packages

Copyright (c) 2016-2017 Red Hat Inc. LGPL https://github.com/weldr alpha portable Safe Haskell2010

BDCS.Utils.Monad

Description

Monad related utility functions

Synopsis

Documentation

concatForM :: (Monad m, Traversable t) => t a -> (a -> m [b]) -> m [b] Source #

Like concatMap, but with its arguments reversed (the list comes first and the function comes second) and operates in a monad.

concatMapM :: (Monad m, Traversable t) => (a -> m [b]) -> t a -> m [b] Source #

Like concatMap but operates in a monad.

foldMaybeM :: Monad m => (b -> a -> m (Maybe b)) -> b -> [a] -> m b Source #

mapMaybeM :: Monad m => (a -> m (Maybe b)) -> [a] -> m [b] Source #

Like mapMaybe but operates in a monad.

(>>?) :: Monad m => m (Maybe a) -> (a -> m b) -> m (Maybe b) infixl 1 Source #

Apply a function to a monadic action. If the action is 'm Nothing', do nothing. Otherwise, apply the function and return the result as 'm (Just a)'.