Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
- data QueryString a where
- QueryString :: TextualMonoid a => a -> [(a, a)] -> Maybe a -> QueryString a
- showUrlString :: QueryString a -> a
- (<?>) :: TextualMonoid a => a -> (a, a) -> QueryString a
- (<&>) :: TextualMonoid a => QueryString a -> (a, a) -> QueryString a
- (<#>) :: TextualMonoid a => QueryString a -> a -> QueryString a
- fromRoute :: TextualMonoid a => ([a], [(a, a)]) -> QueryString a
- expandRelative :: TextualMonoid plain => QueryString plain -> plain
- expandGrounded :: TextualMonoid plain => QueryString plain -> plain
- expandAbsolute :: (MonadReader plain m, TextualMonoid plain) => QueryString plain -> m plain
- expandAbsoluteWith :: (MonadReader a m, TextualMonoid plain) => QueryString plain -> (a -> plain) -> m plain
- newtype RelativeUrlT h m b = RelativeUrlT {
- runRelativeUrlT :: h -> m b
- type RelativeUrl h b = RelativeUrlT h Identity b
- newtype GroundedUrlT h m b = GroundedUrlT {
- runGroundedUrlT :: h -> m b
- type GroundedUrl h b = GroundedUrlT h Identity b
- newtype AbsoluteUrlT h m b = AbsoluteUrlT {
- runAbsoluteUrlT :: h -> m b
- type AbsoluteUrl h b = AbsoluteUrlT h Identity b
Documentation
data QueryString a where Source
Abstract data type for a Url - a "target" and GET parameters. We require IsString
and Monoid
for generic construction, but rendering will require a monomorphic type.
The type constructor is parameterized over it's underlying IsString
&
Monoid
instance.
QueryString :: TextualMonoid a => a -> [(a, a)] -> Maybe a -> QueryString a |
showUrlString :: QueryString a -> a Source
We can't provide a Show
instance for QueryString
because that would force
us to use String
.
:: TextualMonoid a | |
=> a | Target string |
-> (a, a) | GET Parameter |
-> QueryString a |
Makes a QueryString
out of a raw target path and a GET parameter pair.
:: TextualMonoid a | |
=> QueryString a | Old Url |
-> (a, a) | Additional GET Parameter |
-> QueryString a |
Adds another GET parameter pair to a QueryString
.
(<#>) :: TextualMonoid a => QueryString a -> a -> QueryString a Source
Adds a hash parameter to a QueryString
.
fromRoute :: TextualMonoid a => ([a], [(a, a)]) -> QueryString a Source
expandRelative :: TextualMonoid plain => QueryString plain -> plain Source
Render the Url String flatly - without anything prepended to the target.
expandGrounded :: TextualMonoid plain => QueryString plain -> plain Source
Render the Url String as grounded - prepended with a "root" //
character.
expandAbsolute :: (MonadReader plain m, TextualMonoid plain) => QueryString plain -> m plain Source
Render the Url String as absolute - getting the root from a MonadReader
context.
expandAbsoluteWith :: (MonadReader a m, TextualMonoid plain) => QueryString plain -> (a -> plain) -> m plain Source
Render the Url String as absolute, but with your own configuration type.
data SiteConfig = SiteConfig { host :: T.Text , cdnHost :: T.Text } deriving (Show, Eq) foo :: HtmlT (Reader SiteConfig) () foo = do url <- lift $ expandAbsoluteWith ("foo.php" <?> ("bar","baz")) host script_ [src_ url] "" bar :: LT.Text bar = (runReader (runTextT foo)) $ SiteConfig "example.com" "cdn.example.com"
newtype RelativeUrlT h m b Source
RelativeUrlT | |
|
(Monad m, IsString h) => MonadReader h (RelativeUrlT h m) Source | |
(Monad m, TextualMonoid plain) => UrlReader plain (RelativeUrlT plain m) Source | |
(Monad m, TextualMonoid plain) => Url plain (RelativeUrlT plain m) Source | |
MonadTrans (RelativeUrlT h) Source | |
Monad m => Monad (RelativeUrlT h m) Source | |
Functor m => Functor (RelativeUrlT h m) Source | |
Applicative f => Applicative (RelativeUrlT h f) Source | |
MonadIO m => MonadIO (RelativeUrlT h m) Source | |
type Result (RelativeUrlT plain m) = m Source |
type RelativeUrl h b = RelativeUrlT h Identity b Source
newtype GroundedUrlT h m b Source
GroundedUrlT | |
|
(Monad m, IsString h) => MonadReader h (GroundedUrlT h m) Source | |
(Monad m, TextualMonoid plain) => UrlReader plain (GroundedUrlT plain m) Source | |
(Monad m, TextualMonoid plain) => Url plain (GroundedUrlT plain m) Source | |
MonadTrans (GroundedUrlT h) Source | |
Monad m => Monad (GroundedUrlT h m) Source | |
Functor m => Functor (GroundedUrlT h m) Source | |
Applicative f => Applicative (GroundedUrlT h f) Source | |
MonadIO m => MonadIO (GroundedUrlT h m) Source | |
type Result (GroundedUrlT plain m) = m Source |
type GroundedUrl h b = GroundedUrlT h Identity b Source
newtype AbsoluteUrlT h m b Source
AbsoluteUrlT | |
|
(Monad m, IsString h) => MonadReader h (AbsoluteUrlT h m) Source | |
(Monad m, TextualMonoid plain) => UrlReader plain (AbsoluteUrlT plain m) Source | |
(Monad m, TextualMonoid plain) => Url plain (AbsoluteUrlT plain m) Source | |
MonadTrans (AbsoluteUrlT h) Source | |
Monad m => Monad (AbsoluteUrlT h m) Source | |
Functor m => Functor (AbsoluteUrlT h m) Source | |
Applicative f => Applicative (AbsoluteUrlT h f) Source | |
MonadIO m => MonadIO (AbsoluteUrlT h m) Source | |
type Result (AbsoluteUrlT plain m) = m Source |
type AbsoluteUrl h b = AbsoluteUrlT h Identity b Source