Hoogle Search
Within LTS Haskell 24.38 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
mapMaybe :: (a -> Maybe b) -> NEIntMap a -> IntMap bnonempty-containers Data.IntMap.NonEmpty O(n). Map values and collect the Just results. Returns a potentially empty map (IntMap), because the function could potentially return Nothing on all items in the NEIntMap.
let f x = if x == "a" then Just "new a" else Nothing mapMaybe f (fromList ((5,"a") :| [(3,"b")])) == Data.IntMap.singleton 5 "new a"
mapMaybeWithKey :: (Key -> a -> Maybe b) -> NEIntMap a -> IntMap bnonempty-containers Data.IntMap.NonEmpty O(n). Map keys/values and collect the Just results. Returns a potentially empty map (IntMap), because the function could potentially return Nothing on all items in the NEIntMap.
let f k _ = if k < 5 then Just ("key : " ++ (show k)) else Nothing mapMaybeWithKey f (fromList ((5,"a") :| [(3,"b")])) == Data.IntMap.singleton 3 "key : 3"mapMaybe :: (a -> Maybe b) -> NEMap k a -> Map k bnonempty-containers Data.Map.NonEmpty O(n). Map values and collect the Just results. Returns a potentially empty map (Map), because the function could potentially return Nothing on all items in the NEMap.
let f x = if x == "a" then Just "new a" else Nothing mapMaybe f (fromList ((5,"a") :| [(3,"b")])) == Data.Map.singleton 5 "new a"
mapMaybeWithKey :: (k -> a -> Maybe b) -> NEMap k a -> Map k bnonempty-containers Data.Map.NonEmpty O(n). Map keys/values and collect the Just results. Returns a potentially empty map (Map), because the function could potentially return Nothing on all items in the NEMap.
let f k _ = if k < 5 then Just ("key : " ++ (show k)) else Nothing mapMaybeWithKey f (fromList ((5,"a") :| [(3,"b")])) == Data.Map.singleton 3 "key : 3"traverseMaybeWithKey :: Applicative t => (k -> a -> t (Maybe b)) -> NEMap k a -> t (Map k b)nonempty-containers Data.Map.NonEmpty O(n). Traverse keys/values and collect the Just results. Returns a potentially empty map (Map), our function might return Nothing on every item in the NEMap. Use traverseMaybeWithKey1 whenever possible (if your Applicative also has Apply instance). This version is provided only for types that do not have Apply instance, since Apply is not at the moment (and might not ever be) an official superclass of Applicative.
traverseMaybeWithKey1 :: Apply t => (k -> a -> t (Maybe b)) -> NEMap k a -> t (Map k b)nonempty-containers Data.Map.NonEmpty O(n). Traverse keys/values and collect the Just results. Returns a potentially empty map (Map), our function might return Nothing on every item in the NEMap. Is more general than traverseWithKey, since works with all Apply, and not just Applicative.
newtype
ComposeMaybe (f :: k -> Type) (a :: k)patch Data.Functor.Misc We can't use Compose Maybe instead of ComposeMaybe, because that would make the f parameter have a nominal type role. We need f to be representational so that we can use safe coerce.
ComposeMaybe :: Maybe (f a) -> ComposeMaybe (f :: k -> Type) (a :: k)patch Data.Functor.Misc No documentation available.
getComposeMaybe :: ComposeMaybe (f :: k -> Type) (a :: k) -> Maybe (f a)patch Data.Functor.Misc No documentation available.
catMaybes :: Vector (Maybe a) -> Vector arebase Rebase.Data.Vector No documentation available.