Hoogle Search
Within LTS Haskell 24.6 (ghc-9.10.2)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
mapMaybe :: (v1 -> Maybe v2) -> HashMap k v1 -> HashMap k v2unordered-containers Data.HashMap.Internal Transform this map by applying a function to every value and retaining only some of them.
mapMaybe :: (v1 -> Maybe v2) -> HashMap k v1 -> HashMap k v2unordered-containers Data.HashMap.Internal.Strict Transform this map by applying a function to every value and retaining only some of them.
mapMaybe :: (v1 -> Maybe v2) -> HashMap k v1 -> HashMap k v2unordered-containers Data.HashMap.Lazy Transform this map by applying a function to every value and retaining only some of them.
mapMaybe :: (v1 -> Maybe v2) -> HashMap k v1 -> HashMap k v2unordered-containers Data.HashMap.Strict Transform this map by applying a function to every value and retaining only some of them.
mapMaybe :: forall (m :: Type -> Type) a b . Monad m => (a -> Maybe b) -> ConduitT a b m ()conduit Data.Conduit.List Apply a transformation that may fail to all values in a stream, discarding the failures. Subject to fusion Since 0.5.1
mapMaybe :: (MonadGen m, GenBase m ~ Identity) => (a -> Maybe b) -> m a -> m bhedgehog Hedgehog.Gen Generates a value which is the result of the given function returning a Just. The original generator's shrink tree will be retained, with values returning Nothing removed. Subsequent shrinks of those values will be retained. Compared to mapMaybeT, shrinking may be slower but will be optimal. It's possible that the function will never return Just, or will only do so a larger size than we're currently running at. To avoid looping forever, we limit the number of retries, and grow the size with each retry. If we retry too many times then the whole generator is discarded.
mapMaybe :: (MonadGen m, GenBase m ~ Identity) => (a -> Maybe b) -> m a -> m bhedgehog Hedgehog.Internal.Gen Generates a value which is the result of the given function returning a Just. The original generator's shrink tree will be retained, with values returning Nothing removed. Subsequent shrinks of those values will be retained. Compared to mapMaybeT, shrinking may be slower but will be optimal. It's possible that the function will never return Just, or will only do so a larger size than we're currently running at. To avoid looping forever, we limit the number of retries, and grow the size with each retry. If we retry too many times then the whole generator is discarded.
mapMaybe :: (a -> Maybe b) -> Tree a -> Maybe (Tree b)hedgehog Hedgehog.Internal.Tree No documentation available.
-
servant Servant.Types.SourceT Filter values.
>>> toList $ mapMaybe (\x -> if odd x then Just x else Nothing) (source [0..10]) :: [Int] [1,3,5,7,9]
>>> mapMaybe (\x -> if odd x then Just x else Nothing) (source [0..2]) :: SourceT Identity Int fromStepT (Effect (Identity (Skip (Yield 1 (Skip Stop)))))
Illustrates why we need Skip. mapMaybe :: (a -> Maybe b) -> Word64Map a -> Word64Map bghc GHC.Data.Word64Map.Internal Map values and collect the Just results.
let f x = if x == "a" then Just "new a" else Nothing mapMaybe f (fromList [(5,"a"), (3,"b")]) == singleton 5 "new a"