Hoogle Search
Within LTS Haskell 24.36 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
readMaybe :: (Read b, StringConv a String) => a -> Maybe bprotolude Protolude Parse a string using the Read instance. Succeeds if there is exactly one valid result.
>>> readMaybe ("123" :: Text) :: Maybe Int Just 123>>> readMaybe ("hello" :: Text) :: Maybe Int NothingleftToMaybe :: Either l r -> Maybe lprotolude Protolude.Either No documentation available.
rightToMaybe :: Either l r -> Maybe rprotolude Protolude.Either No documentation available.
reifyTypeWithLocals_maybe :: DsMonad q => Name -> q (Maybe Type)th-desugar Language.Haskell.TH.Desugar Like reifyWithLocals_maybe but for types and kinds. Note that a return value of Nothing might mean that the name is not in scope, or it might mean that the full type of the name cannot be determined. (Use reifyWithLocals_maybe if you really need to tell the difference.)
reifyWithLocals_maybe :: DsMonad q => Name -> q (Maybe Info)th-desugar Language.Haskell.TH.Desugar Like reify from Template Haskell, but looks also in any not-yet-typechecked declarations. To establish this list of not-yet-typechecked declarations, use withLocalDeclarations. Returns Nothing if reification fails. Note that no inferred type information is available from local declarations; bottoms may be used if necessary.
tupleNameDegree_maybe :: Name -> Maybe Intth-desugar Language.Haskell.TH.Desugar Extract the degree of a tuple Name. In addition to recognizing tuple syntax (e.g., ''(,,)), this also recognizes the following:
In recent versions of GHC, ''() is a synonym for ''Unit, ''(,) is a synonym for ''Tuple2, and so on. As a result, we must check for ''Unit and ''TupleN in tupleDegree_maybe to be thorough. (There is no special tuple syntax for ''Solo/'MkSolo, but we check them here as well for the sake of completeness.)unboxedSumNameDegree_maybe :: Name -> Maybe Intth-desugar Language.Haskell.TH.Desugar Extract the degree of an unboxed sum Name. In addition to recognizing unboxed sum syntax (e.g., ''()), this also recognizes ''SumN# (for unboxed N-ary sum type constructors). In recent versions of GHC, ''Sum2# is a synonym for ''(), ''Sum3# is a synonym for ''(), and so on. As a result, we must check for ''SumN# in unboxedSumNameDegree_maybe to be thorough.
unboxedTupleNameDegree_maybe :: Name -> Maybe Intth-desugar Language.Haskell.TH.Desugar Extract the degree of an unboxed tuple Name. In addition to recognizing unboxed tuple syntax (e.g., ''()), this also recognizes the following:
- ''Unit# (for unboxed 0-tuples)
- ''Solo#/'Solo# (for unboxed 1-tuples)
- ''TupleN# (for unboxed N-tuples)
unionMaybeSubsts :: [Maybe DSubst] -> Maybe DSubstth-desugar Language.Haskell.TH.Desugar.Subst No documentation available.
-
HaXml Text.XML.HaXml.XmlContent.Parser The catMaybes function takes a list of Maybes and returns a list of all the Just values.
Examples
Basic usage:>>> catMaybes [Just 1, Nothing, Just 3] [1,3]
When constructing a list of Maybe values, catMaybes can be used to return all of the "success" results (if the list is the result of a map, then mapMaybe would be more appropriate):>>> import GHC.Internal.Text.Read ( readMaybe ) >>> [readMaybe x :: Maybe Int | x <- ["1", "Foo", "3"] ] [Just 1,Nothing,Just 3] >>> catMaybes $ [readMaybe x :: Maybe Int | x <- ["1", "Foo", "3"] ] [1,3]