urlpath: Painfully simple URL writing combinators
This version is deprecated.
Simple URL DSL for Haskell.
Use raw combinators (kinda useless) ...
render $ "foo.php" <?> ("key1","bar") <&> ("key2","baz")
↪ "foo.php?key1=bar&key2=baz"... or use the MonadReader instance for a configurable root ...
let url = runReader $ expandAbsolute $ "foo.php" <?> ("key1","bar") <&> ("key2","baz")
url "example.com"
↪ "example.com/foo.php?key1=bar&key2=baz"... in Lucid ...
(runReader $ renderTextT $
(\a -> do
foo <- lift $ expandAbsolute a
script_ [src_ foo] "" )
("foo" <?> ("bar","baz"))
) "example.com"
↪ "<script src=\"example.com/foo?bar=baz\"></script>"... and in Scotty ...
main :: IO ()
main = scottyT 3000
rootConf
rootConf
run
where
rootConf = flip runReaderT "http://example.com"
run :: ( MonadIO m
, MonadReader T.Text m ) =>
ScottyT LT.Text m ()
run = get "/" $ do
path <- lift $ expandAbsolute $ "foo" <?> ("bar","baz")
text $ LT.fromStrict path
λ> curl localhost:3000/
↪ "http://example.com/foo?bar=baz"
Downloads
- urlpath-0.0.2.tar.gz [browse] (Cabal source package)
- Package description (revised from the package)
Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
| Versions [RSS] | 0.0.1, 0.0.2, 0.0.3, 0.0.4, 0.0.5, 0.0.6, 0.1, 0.1.0.1, 0.2, 1.0.0, 1.1.0, 2.0.0, 2.1.0, 3.0.0, 3.1.0, 3.1.1, 3.2.0, 3.2.1, 3.2.1.1, 3.3.0, 4.0.0, 4.0.0.1, 4.1.0, 4.2.0, 5.0.0, 5.0.0.1, 6.0.0, 6.0.1, 6.0.2, 6.0.3, 6.0.4, 7.0.0, 7.0.1, 7.0.2, 7.1.0, 8.0.0, 8.0.1, 8.1.0, 8.2.0, 9.0.0, 9.0.0.1, 9.0.1, 10.0.0, 11.0.0, 11.0.1, 11.0.2 (info) |
|---|---|
| Dependencies | base (>=4 && <5), mtl, text, transformers [details] |
| License | BSD-3-Clause |
| Author | Athan Clark <athan.clark@gmail.com> |
| Maintainer | Athan Clark <athan.clark@gmail.com> |
| Uploaded | by athanclark at 2014-12-09T19:37:34Z |
| Revised | Revision 1 made by HerbertValerioRiedel at 2018-04-13T11:41:48Z |
| Category | Web |
| Source repo | head: git clone https://github.com/athanclark/urlpath.git |
| Distributions | LTSHaskell:11.0.2, NixOS:11.0.2, Stackage:11.0.2 |
| Reverse Dependencies | 4 direct, 1 indirect [details] |
| Downloads | 22514 total (192 in the last 30 days) |
| Rating | (no votes yet) [estimated by Bayesian average] |
| Your Rating | |
| Status | Docs uploaded by user Build status unknown [no reports yet] |