Copyright | (c) Athan L. Clark |
---|---|
License | MIT |
Maintainer | Athan L. Clark <athan.clark@gmail.com> |
Stability | experimental |
Portability | GHC |
Safe Haskell | None |
Language | Haskell2010 |
This library helps us distinguish how we present URLs - we might show them
relatively, absolutely (with the URI authority - scheme, port, hostname, etc.),
or grounded - where the path begins with /
.
We leverage Chris Done's path library to distinguish relative vs. grounded paths at compile time, and provide some additional features like a file extension and query parameters in path-extra.
- class MonadUrl base type' (m :: * -> *) where
- newtype RelativeUrlT m a = RelativeUrlT {
- runRelativeUrlT :: m a
- type RelativeUrl = RelativeUrlT Identity
- newtype GroundedUrlT m a = GroundedUrlT {
- runGroundedUrlT :: m a
- type GroundedUrl = GroundedUrlT Identity
- newtype AbsoluteUrlT m a = AbsoluteUrlT {
- runAbsoluteUrlT :: (Location Abs File -> URI) -> m a
- type AbsoluteUrl = AbsoluteUrlT Identity
- mkUriPathEmpty :: Path base type' -> URI
- mkUriLocEmpty :: Location base type' -> URI
- getPathChunks :: Path base type' -> Vector Text
- getLocationChunks :: Location base type' -> Vector Text
- packLocation :: Maybe Text -> Bool -> URIAuth -> Location base type' -> URI
Classes
class MonadUrl base type' (m :: * -> *) where Source #
Turns a Path
or Location
into a String
, where the rendering behavior
(relative, grounded and absolute) is encoded in the monad you use, much like
LoggingT
and NoLoggingT
from monad-logger.
Types
Relative Urls
newtype RelativeUrlT m a Source #
RelativeUrlT | |
|
type RelativeUrl = RelativeUrlT Identity Source #
Grounded Urls
newtype GroundedUrlT m a Source #
GroundedUrlT | |
|
type GroundedUrl = GroundedUrlT Identity Source #
Absolute Urls
newtype AbsoluteUrlT m a Source #
AbsoluteUrlT | |
|
type AbsoluteUrl = AbsoluteUrlT Identity Source #
mkUriPathEmpty :: Path base type' -> URI Source #
mkUriLocEmpty :: Location base type' -> URI Source #