Hoogle Search
Within LTS Haskell 24.46 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
mapMaybe :: (a -> Maybe b) -> [a] -> [b]classy-prelude-yesod ClassyPrelude.Yesod 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]
-
classy-prelude-yesod ClassyPrelude.Yesod Same as mapOutput, but use a function that returns Maybe values. Since 0.5.0
-
classy-prelude-yesod ClassyPrelude.Yesod Run MaybeT in the base monad Since 1.0.11
-
ecstasy Data.Ecstasy Attempt to get the value of a component.
-
ecstasy Data.Ecstasy.Internal Attempt to get the value of a component.
class
ReifyMaybeSymbol (mstr :: Maybe Symbol)generic-data-functions Generic.Data.Function.Traverse.Constructor No documentation available.
reifyMaybeSymbol :: ReifyMaybeSymbol mstr => Maybe Stringgeneric-data-functions Generic.Data.Function.Traverse.Constructor No documentation available.
isClassOpId_maybe :: Id -> Maybe Classghc-lib GHC No documentation available.
synTyConDefn_maybe :: TyCon -> Maybe ([TyVar], Type)ghc-lib GHC Extract the TyVars bound by a vanilla type synonym and the corresponding (unsubstituted) right hand side.
synTyConRhs_maybe :: TyCon -> Maybe Typeghc-lib GHC Extract the information pertaining to the right hand side of a type synonym (type) declaration.