Hoogle Search
Within LTS Haskell 24.65 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
mapMonotonic :: (a -> b) -> Set a -> Set brio RIO.Set.Unchecked The mapMonotonic f s == map f s, but works only when f is strictly increasing. The precondition is not checked. Semi-formally, we have:
and [x < y ==> f x < f y | x <- ls, y <- ls] ==> mapMonotonic f s == map f s where ls = toList s
mapM_ :: (Monad m, Vector v a) => (a -> m b) -> v a -> m ()rio RIO.Vector No documentation available.
mapMaybe :: (Vector v a, Vector v b) => (a -> Maybe b) -> v a -> v brio RIO.Vector No documentation available.
mapM_ :: Monad m => (a -> m b) -> Vector a -> m ()rio RIO.Vector.Boxed No documentation available.
mapMaybe :: (a -> Maybe b) -> Vector a -> Vector brio RIO.Vector.Boxed No documentation available.
mapM_ :: (Monad m, Storable a) => (a -> m b) -> Vector a -> m ()rio RIO.Vector.Storable No documentation available.
mapMaybe :: (Storable a, Storable b) => (a -> Maybe b) -> Vector a -> Vector brio RIO.Vector.Storable No documentation available.
mapM_ :: (Monad m, Unbox a) => (a -> m b) -> Vector a -> m ()rio RIO.Vector.Unboxed No documentation available.
mapMaybe :: (Unbox a, Unbox b) => (a -> Maybe b) -> Vector a -> Vector brio RIO.Vector.Unboxed No documentation available.
mapMaybe :: (a -> Maybe b) -> [a] -> [b]errors Control.Error The mapMaybe function is a version of map which can throw out elements. In particular, the functional argument returns something of type Maybe b. If this is Nothing, no element is added on to the result list. If it is Just b, then b is included in the result list.
Examples
Using mapMaybe f x is a shortcut for catMaybes $ map f x in most cases:>>> import GHC.Internal.Text.Read ( readMaybe ) >>> let readMaybeInt = readMaybe :: String -> Maybe Int >>> mapMaybe readMaybeInt ["1", "Foo", "3"] [1,3] >>> catMaybes $ map readMaybeInt ["1", "Foo", "3"] [1,3]
If we map the Just constructor, the entire list should be returned:>>> mapMaybe Just [1,2,3] [1,2,3]