diff --git a/yesod-auth/Yesod/Auth.hs b/yesod-auth/Yesod/Auth.hs index fefc3c97..a1e5a076 100644 --- a/yesod-auth/Yesod/Auth.hs +++ b/yesod-auth/Yesod/Auth.hs @@ -9,8 +9,9 @@ module Yesod.Auth ( -- * Subsite Auth + , AuthRoute + , Route (..) , AuthPlugin (..) - , AuthRoute (..) , getAuth , YesodAuth (..) -- * Plugin interface @@ -53,6 +54,8 @@ import Yesod.Form (FormMessage) data Auth = Auth +type AuthRoute = Route Auth + type Method = Text type Piece = Text diff --git a/yesod-auth/Yesod/Auth/BrowserId.hs b/yesod-auth/Yesod/Auth/BrowserId.hs index d71b5d25..378307c3 100644 --- a/yesod-auth/Yesod/Auth/BrowserId.hs +++ b/yesod-auth/Yesod/Auth/BrowserId.hs @@ -21,7 +21,7 @@ import Data.Maybe (fromMaybe) pid :: Text pid = "browserid" -complete :: AuthRoute +complete :: Route Auth complete = PluginR pid [] authBrowserIdAudience :: YesodAuth m diff --git a/yesod-form/Yesod/Form/Jquery.hs b/yesod-form/Yesod/Form/Jquery.hs index 3347b14d..51d1cef4 100644 --- a/yesod-form/Yesod/Form/Jquery.hs +++ b/yesod-form/Yesod/Form/Jquery.hs @@ -16,6 +16,7 @@ module Yesod.Form.Jquery ) where import Yesod.Handler +import Yesod.Core (Route) import Yesod.Form import Yesod.Widget import Data.Time (UTCTime (..), Day, TimeOfDay (..), timeOfDayToTime, diff --git a/yesod-form/Yesod/Form/Nic.hs b/yesod-form/Yesod/Form/Nic.hs index 19e0ef7d..299008ea 100644 --- a/yesod-form/Yesod/Form/Nic.hs +++ b/yesod-form/Yesod/Form/Nic.hs @@ -11,6 +11,7 @@ module Yesod.Form.Nic ) where import Yesod.Handler +import Yesod.Core (Route) import Yesod.Form import Yesod.Widget import Text.HTML.SanitizeXSS (sanitizeBalance) diff --git a/yesod-newsfeed/Yesod/AtomFeed.hs b/yesod-newsfeed/Yesod/AtomFeed.hs index 5a33841c..dd347e4c 100644 --- a/yesod-newsfeed/Yesod/AtomFeed.hs +++ b/yesod-newsfeed/Yesod/AtomFeed.hs @@ -22,9 +22,7 @@ module Yesod.AtomFeed , module Yesod.FeedTypes ) where -import Yesod.Content -import Yesod.Handler -import Yesod.Widget +import Yesod.Core import Yesod.FeedTypes import Text.Hamlet (HtmlUrl, xhamlet, hamlet) import qualified Data.ByteString.Char8 as S8 diff --git a/yesod-newsfeed/Yesod/Feed.hs b/yesod-newsfeed/Yesod/Feed.hs index fa2c552e..58673f8d 100644 --- a/yesod-newsfeed/Yesod/Feed.hs +++ b/yesod-newsfeed/Yesod/Feed.hs @@ -25,7 +25,7 @@ import Yesod.FeedTypes import Yesod.AtomFeed import Yesod.RssFeed import Yesod.Content (HasReps (chooseRep), typeAtom, typeRss) -import Yesod.Handler (Route, GHandler) +import Yesod.Core (Route, GHandler) data RepAtomRss = RepAtomRss RepAtom RepRss instance HasReps RepAtomRss where diff --git a/yesod-newsfeed/Yesod/RssFeed.hs b/yesod-newsfeed/Yesod/RssFeed.hs index 83a56064..124e06ff 100644 --- a/yesod-newsfeed/Yesod/RssFeed.hs +++ b/yesod-newsfeed/Yesod/RssFeed.hs @@ -18,9 +18,7 @@ module Yesod.RssFeed , module Yesod.FeedTypes ) where -import Yesod.Handler -import Yesod.Content -import Yesod.Widget +import Yesod.Core import Yesod.FeedTypes import Text.Hamlet (HtmlUrl, xhamlet, hamlet) import qualified Data.ByteString.Char8 as S8 diff --git a/yesod-routes/yesod-routes.cabal b/yesod-routes/yesod-routes.cabal index 4b399d59..f8d9a83a 100644 --- a/yesod-routes/yesod-routes.cabal +++ b/yesod-routes/yesod-routes.cabal @@ -5,6 +5,7 @@ license-file: LICENSE author: Michael Snoyman maintainer: Michael Snoyman synopsis: Efficient routing for Yesod. +description: Provides an efficient routing system, a parser and TH code generation. category: Web, Yesod stability: Stable cabal-version: >= 1.8 diff --git a/yesod-sitemap/Yesod/Sitemap.hs b/yesod-sitemap/Yesod/Sitemap.hs index 348e3e71..75f5b095 100644 --- a/yesod-sitemap/Yesod/Sitemap.hs +++ b/yesod-sitemap/Yesod/Sitemap.hs @@ -26,7 +26,7 @@ module Yesod.Sitemap ) where import Yesod.Content (RepXml (..), RepPlain (..), toContent, formatW3) -import Yesod.Handler (Route, GHandler, getUrlRender) +import Yesod.Core (Route, GHandler, getUrlRender) import Yesod.Handler (hamletToContent) import Text.Hamlet (HtmlUrl, xhamlet) import Data.Time (UTCTime) diff --git a/yesod-static/Yesod/Static.hs b/yesod-static/Yesod/Static.hs index e7c2f662..6d3fae35 100644 --- a/yesod-static/Yesod/Static.hs +++ b/yesod-static/Yesod/Static.hs @@ -29,7 +29,7 @@ module Yesod.Static ( -- * Subsite Static (..) - , StaticRoute (..) + , Route (..) -- * Smart constructor , static , staticDevel @@ -120,36 +120,32 @@ embed fp = { ssFolder = embeddedLookup (toEmbedded $(embedDir fp)) })|] - --- | A route on the static subsite (see also 'staticFiles'). --- --- You may use this constructor directly to manually link to a --- static file. The first argument is the sub-path to the file --- being served whereas the second argument is the key-value --- pairs in the query string. For example, --- --- > StaticRoute $ StaticR [\"thumb001.jpg\"] [(\"foo\", \"5\"), (\"bar\", \"choc\")] --- --- would generate a url such as --- @http://www.example.com/static/thumb001.jpg?foo=5&bar=choc@ --- The StaticRoute constructor can be used when the URL cannot be --- statically generated at compile-time (e.g. when generating --- image galleries). -data StaticRoute = StaticRoute [Text] [(Text, Text)] - deriving (Eq, Show, Read) - -type instance Route Static = StaticRoute - -instance RenderRoute StaticRoute where +instance RenderRoute Static where + -- | A route on the static subsite (see also 'staticFiles'). + -- + -- You may use this constructor directly to manually link to a + -- static file. The first argument is the sub-path to the file + -- being served whereas the second argument is the key-value + -- pairs in the query string. For example, + -- + -- > StaticRoute $ StaticR [\"thumb001.jpg\"] [(\"foo\", \"5\"), (\"bar\", \"choc\")] + -- + -- would generate a url such as + -- @http://www.example.com/static/thumb001.jpg?foo=5&bar=choc@ + -- The StaticRoute constructor can be used when the URL cannot be + -- statically generated at compile-time (e.g. when generating + -- image galleries). + data Route Static = StaticRoute [Text] [(Text, Text)] + deriving (Eq, Show, Read) renderRoute (StaticRoute x y) = (x, y) instance Yesod master => YesodDispatch Static master where -- Need to append trailing slash to make relative links work - yesodDispatch _ _ [] _ _ = Just $ - \req -> return $ responseLBS status301 [("Location", rawPathInfo req `S.append` "/")] "" + yesodDispatch _ _ _ _ _ _ [] _ req = + return $ responseLBS status301 [("Location", rawPathInfo req `S.append` "/")] "" - yesodDispatch (Static set) _ textPieces _ _ = Just $ - \req -> staticApp set req { pathInfo = textPieces } + yesodDispatch _ (Static set) _ _ _ _ textPieces _ req = + staticApp set req { pathInfo = textPieces } notHidden :: Prelude.FilePath -> Bool notHidden "tmp" = False diff --git a/yesod-static/yesod-static.cabal b/yesod-static/yesod-static.cabal index 1867fc8b..bcc3998c 100644 --- a/yesod-static/yesod-static.cabal +++ b/yesod-static/yesod-static.cabal @@ -13,7 +13,7 @@ homepage: http://www.yesodweb.com/ description: Static file serving subsite for Yesod Web Framework. extra-source-files: test/YesodStaticTest.hs - tests.hs + test/tests.hs flag test description: Build for use with running tests