urlpath-0.1: Painfully simple URL writing combinators

Safe HaskellSafe-Inferred
LanguageHaskell2010

UrlPath

Synopsis

Documentation

class Url string m => UrlReader string m where Source

Overload deployment schemes with this - then, all that's needed is a type coercion to change deployment. This only works with flat (co)monads, so monad transformers are out.

Methods

runUrlReader Source

Arguments

:: Url string m 
=> m string

Monad with result string

-> string

Reader index

-> string

Final result

Instances

(Monoid a, IsString a) => UrlReader a (AbsoluteUrl a)

Hand-off host prepending to the MonadReader instance

(Monoid a, IsString a) => UrlReader a (GroundedUrl a) 
(Monoid a, IsString a) => UrlReader a (RelativeUrl a) 

class (IsString string, Monoid string, MonadReader string m) => Url string m where Source

Url is a relationship between an underlying (monomorphic) string type string, and a deployment context m. We try to make the deployment and implementation type coercible at the top level - coercing your final expression to String or T.Text will have all use-cases coerce to that type, similarly with the deployment scheme.

We chose to not force MonadReader as a superclass for m due to the monomorphic demand on functional dependencies.

Methods

url Source

Arguments

:: UrlString string

Url type

-> m string

Rendered Url in some context.

stringUrl Source

Arguments

:: string

raw string

-> m string

Rendered string in some context.

Instances

(Monoid a, IsString a) => Url a (AbsoluteUrl a) 
(Monoid a, IsString a) => Url a (GroundedUrl a) 
(Monoid a, IsString a) => Url a (RelativeUrl a) 
(Monad m, Monoid a, IsString a) => Url a (AbsoluteUrlT a m) 
(Monad m, Monoid a, IsString a) => Url a (GroundedUrlT a m) 
(Monad m, Monoid a, IsString a) => Url a (RelativeUrlT a m)