Hoogle Search
Within LTS Haskell 24.5 (ghc-9.10.2)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
maybeToExceptT :: forall (m :: Type -> Type) e a . Functor m => e -> MaybeT m a -> ExceptT e m arelude Relude.Monad.Reexport Convert a MaybeT computation to ExceptT, with a default exception value.
-
relude Relude.Monad.Reexport The maybeToList function returns an empty list when given Nothing or a singleton list when given Just.
Examples
Basic usage:>>> maybeToList (Just 7) [7]
>>> maybeToList Nothing []
One can use maybeToList to avoid pattern matching when combined with a function that (safely) works on lists:>>> import GHC.Internal.Text.Read ( readMaybe ) >>> sum $ maybeToList (readMaybe "3") 3 >>> sum $ maybeToList (readMaybe "") 0
maybeToMonoid :: Monoid m => Maybe m -> mrelude Relude.Monoid Extracts Monoid value from Maybe returning mempty if Nothing.
>>> maybeToMonoid (Just [1,2,3] :: Maybe [Int]) [1,2,3] >>> maybeToMonoid (Nothing :: Maybe [Int]) []
maybeF :: Buildable a => Maybe a -> Builderfmt Fmt Like build for Maybe, but displays Nothing as <Nothing> instead of an empty string. build:
>>> build (Nothing :: Maybe Int) "" >>> build (Just 1 :: Maybe Int) "1"
maybeF:>>> maybeF (Nothing :: Maybe Int) "<Nothing>" >>> maybeF (Just 1 :: Maybe Int) "1"
maybeF :: Buildable a => Maybe a -> Builderfmt Fmt.Internal.Formatters Like build for Maybe, but displays Nothing as <Nothing> instead of an empty string. build:
>>> build (Nothing :: Maybe Int) "" >>> build (Just 1 :: Maybe Int) "1"
maybeF:>>> maybeF (Nothing :: Maybe Int) "<Nothing>" >>> maybeF (Just 1 :: Maybe Int) "1"
maybeRead :: Read a => String -> Maybe aghc-boot GHC.Settings.Utils No documentation available.
maybeReadFuzzy :: Read a => String -> Maybe aghc-boot GHC.Settings.Utils No documentation available.
maybe_ :: b -> (a -> b) -> Maybe a -> bsingletons-base Data.Maybe.Singletons No documentation available.
maybe_ :: b -> (a -> b) -> Maybe a -> bsingletons-base Prelude.Singletons No documentation available.
maybeMoveB :: TextUnit -> Direction -> BufferM ()yi-core Yi.Buffer.Normal As moveB, unless the point is at a unit boundary