Version 0.0.2-1 of urlpath is deprecated.
The latest version of urlpath is 11.0.2-0.

urlpath

Version 0.0.2 revision 1 uploaded by HerbertValerioRiedel.

Package meta

Synopsis
Painfully simple URL writing combinators
Description

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"
Author
Athan Clark <athan.clark@gmail.com>
Bug reports
n/a
Category
Web
Copyright
n/a
Homepage
n/a
Maintainer
Athan Clark <athan.clark@gmail.com>
Package URL
n/a
Stability
n/a

Components