Copyright | (c) Frederick Pringle 2025 |
---|---|
License | BSD-3-Clause |
Maintainer | frederick.pringle@fpringle.com |
Safe Haskell | None |
Language | Haskell2010 |
Servant.API.Routes.Path
Description
Simple representation of URL paths.
Synopsis
- data Path
- prependPathPart :: Text -> Path -> Path
- prependCapturePart :: Typeable a => Text -> Path -> Path
- prependCaptureAllPart :: Typeable a => Text -> Path -> Path
- renderPath :: Path -> Text
- rootPath :: Path
Documentation
Simple representation of a URL path.
prependPathPart :: Text -> Path -> Path Source #
Prepend a simple text path part to an API path.
For example, prependPathPart "api"
will transform /v2/users
to /api/v2/users
.
prependCapturePart :: Typeable a => Text -> Path -> Path Source #
Prepend a capture path part of a given type to an API path.
Equivalent to
.Capture
name a :>
For example, prependCapturePart @Int "id"
will transform /detail
to /<Int>/detail
.
prependCaptureAllPart :: Typeable a => Text -> Path -> Path Source #
Prepend a capture-all path part of a given type to an API path.
Equivalent to
.CaptureAll
name a :>
For example, prependCaptureAllPart @Int "id"
will transform /detail
to /<[Int]>/detail
.
renderPath :: Path -> Text Source #
Pretty-print a path, including the leading /
.