Hoogle Search
Within LTS Haskell 24.25 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
replaceProperPrefix :: MonadThrow m => Path b Dir -> Path b' Dir -> Path b t -> m (Path b' t)path Path.Posix Change from one directory prefix to another. Throw NotAProperPrefix if the first argument is not a proper prefix of the path.
>>> replaceProperPrefix $(mkRelDir "foo") $(mkRelDir "bar") $(mkRelFile "foo/file.txt") == $(mkRelFile "bar/file.txt")
stripProperPrefix :: MonadThrow m => Path b Dir -> Path b t -> m (Path Rel t)path Path.Posix If the directory in the first argument is a proper prefix of the path in the second argument strip it from the second argument, generating a path relative to the directory. Throws NotAProperPrefix if the directory is not a proper prefix of the path. The following properties hold:
stripProperPrefix x (x </> y) = y
Cases which are proven not possible:stripProperPrefix (a :: Path Abs …) (b :: Path Rel …)
stripProperPrefix (a :: Path Rel …) (b :: Path Abs …)
In other words the bases must match.NotAProperPrefix :: FilePath -> FilePath -> PathExceptionpath Path.Windows No documentation available.
isProperPrefixOf :: Path b Dir -> Path b t -> Boolpath Path.Windows Determines if the path in the first parameter is a proper prefix of the path in the second parameter. The following properties hold:
not (x `isProperPrefixOf` x)
x `isProperPrefixOf` (x </> y)
replaceProperPrefix :: MonadThrow m => Path b Dir -> Path b' Dir -> Path b t -> m (Path b' t)path Path.Windows Change from one directory prefix to another. Throw NotAProperPrefix if the first argument is not a proper prefix of the path.
>>> replaceProperPrefix $(mkRelDir "foo") $(mkRelDir "bar") $(mkRelFile "foo/file.txt") == $(mkRelFile "bar/file.txt")
stripProperPrefix :: MonadThrow m => Path b Dir -> Path b t -> m (Path Rel t)path Path.Windows If the directory in the first argument is a proper prefix of the path in the second argument strip it from the second argument, generating a path relative to the directory. Throws NotAProperPrefix if the directory is not a proper prefix of the path. The following properties hold:
stripProperPrefix x (x </> y) = y
Cases which are proven not possible:stripProperPrefix (a :: Path Abs …) (b :: Path Rel …)
stripProperPrefix (a :: Path Rel …) (b :: Path Abs …)
In other words the bases must match.InfixCons :: Value -> [(Name, Value)] -> Valuepretty-show Text.Show.Pretty Infix data constructor chain
parseHeaderWithPrefix :: FromHttpApiData a => ByteString -> ByteString -> Either Text ahttp-api-data Web.HttpApiData Parse given bytestring then parse the rest of the input using parseHeader.
data BasicAuthToken = BasicAuthToken Text deriving (Show) instance FromHttpApiData BasicAuthToken where parseHeader h = BasicAuthToken <$> parseHeaderWithPrefix "Basic " h parseQueryParam p = BasicAuthToken <$> parseQueryParam p
>>> parseHeader "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" :: Either Text BasicAuthToken Right (BasicAuthToken "QWxhZGRpbjpvcGVuIHNlc2FtZQ==")
parseQueryParamWithPrefix :: FromHttpApiData a => Text -> Text -> Either Text ahttp-api-data Web.HttpApiData Case insensitive. Parse given text case insensitive and then parse the rest of the input using parseQueryParam.
>>> parseQueryParamWithPrefix "z" "z10" :: Either Text Int Right 10
parseUrlPieceWithPrefix :: FromHttpApiData a => Text -> Text -> Either Text ahttp-api-data Web.HttpApiData Case insensitive. Parse given text case insensitive and then parse the rest of the input using parseUrlPiece.
>>> parseUrlPieceWithPrefix "Just " "just 10" :: Either Text Int Right 10 >>> parseUrlPieceWithPrefix "Left " "left" :: Either Text Bool Left "could not parse: `left'"
This can be used to implement FromHttpApiData for single field constructors:>>> data Foo = Foo Int deriving (Show) >>> instance FromHttpApiData Foo where parseUrlPiece s = Foo <$> parseUrlPieceWithPrefix "Foo " s >>> parseUrlPiece "foo 1" :: Either Text Foo Right (Foo 1)