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.

  1. parseUrlPieceMaybe :: FromHttpApiData a => Text -> Maybe a

    http-api-data Web.HttpApiData

    Parse URL path piece in a Maybe.

    >>> parseUrlPieceMaybe "12" :: Maybe Int
    Just 12
    

  2. lookupMaybe :: Text -> Form -> Either Text (Maybe Text)

    http-api-data Web.Internal.FormUrlEncoded

    Lookup an optional value for a key. Fail if there is more than one value.

    >>> lookupMaybe "name" []
    Right Nothing
    
    >>> lookupMaybe "name" [("name", "Oleg")]
    Right (Just "Oleg")
    
    >>> lookupMaybe "name" [("name", "Oleg"), ("name", "David")]
    Left "Duplicate key \"name\""
    

  3. parseMaybe :: FromHttpApiData v => Text -> Form -> Either Text (Maybe v)

    http-api-data Web.Internal.FormUrlEncoded

    Lookup an optional value for a given key and parse it with parseQueryParam. Fail if there is more than one value for the key.

    >>> parseMaybe "age" [] :: Either Text (Maybe Word8)
    Right Nothing
    
    >>> parseMaybe "age" [("age", "12"), ("age", "25")] :: Either Text (Maybe Word8)
    Left "Duplicate key \"age\""
    
    >>> parseMaybe "age" [("age", "seven")] :: Either Text (Maybe Word8)
    Left "could not parse: `seven' (input does not start with a digit)"
    
    >>> parseMaybe "age" [("age", "777")] :: Either Text (Maybe Word8)
    Left "out of bounds: `777' (should be between 0 and 255)"
    
    >>> parseMaybe "age" [("age", "7")] :: Either Text (Maybe Word8)
    Right (Just 7)
    

  4. parseHeaderMaybe :: FromHttpApiData a => ByteString -> Maybe a

    http-api-data Web.Internal.HttpApiData

    Parse HTTP header value in a Maybe.

    >>> parseHeaderMaybe "hello" :: Maybe Text
    Just "hello"
    

  5. parseMaybeTextData :: (Text -> Maybe a) -> Text -> Either Text a

    http-api-data Web.Internal.HttpApiData

    Convert Maybe parser into Either Text parser with default error message.

  6. parseQueryParamMaybe :: FromHttpApiData a => Text -> Maybe a

    http-api-data Web.Internal.HttpApiData

    Parse query param value in a Maybe.

    >>> parseQueryParamMaybe "true" :: Maybe Bool
    Just True
    

  7. parseUrlPieceMaybe :: FromHttpApiData a => Text -> Maybe a

    http-api-data Web.Internal.HttpApiData

    Parse URL path piece in a Maybe.

    >>> parseUrlPieceMaybe "12" :: Maybe Int
    Just 12
    

  8. contentMaybe :: forall (m :: Type -> Type) o . MonadThrow m => ConduitT Event o m (Maybe Text)

    xml-conduit Text.XML.Stream.Parse

    Grabs the next piece of content if available. This function skips over any comments, instructions or entities, and concatenates all content until the next start or end tag.

  9. runMaybeP :: forall (m :: Type -> Type) a' a b' b r . Monad m => Proxy a' a b' b (MaybeT m) r -> Proxy a' a b' b m (Maybe r)

    pipes Pipes.Lift

    Run MaybeT in the base monad

  10. mapMaybe :: forall (m :: Type -> Type) a b r . Functor m => (a -> Maybe b) -> Pipe a b m r

    pipes Pipes.Prelude

    (mapMaybe f) yields Just results of f. Basic laws:

    mapMaybe (f >=> g) = mapMaybe f >-> mapMaybe g
    
    mapMaybe (pure @Maybe . f) = mapMaybe (Just . f) = map f
    
    mapMaybe (const Nothing) = drain
    
    As a result of the second law,
    mapMaybe return = mapMaybe Just = cat
    

Page 153 of many | Previous | Next