Fixed type signature in some functions in Yesod typeclass

This commit is contained in:
Michael Snoyman 2010-06-30 20:46:47 +03:00
parent ac8d0fb800
commit 729751f742
3 changed files with 13 additions and 13 deletions

View File

@ -246,14 +246,14 @@ toWaiApp' y segments env = do
eurl = parsePathSegments site pathSegments eurl = parsePathSegments site pathSegments
render u = fromMaybe render u = fromMaybe
(fullRender (approot y) (formatPathSegments site) u) (fullRender (approot y) (formatPathSegments site) u)
(urlRenderOverride y u) (urlRenderOverride u)
rr <- parseWaiRequest env session' rr <- parseWaiRequest env session'
onRequest y rr let h = do
let h = onRequest
case eurl of case eurl of
Left _ -> errorHandler NotFound Left _ -> errorHandler NotFound
Right url -> do Right url -> do
-- FIXME auth <- isAuthorized y url isAuthorized url >>= maybe (return ()) permissionDenied
case handleSite site render url method of case handleSite site render url method of
Nothing -> errorHandler $ BadMethod method Nothing -> errorHandler $ BadMethod method
Just h' -> h' Just h' -> h'

View File

@ -364,8 +364,8 @@ badMethod = do
failure $ BadMethod $ toString $ W.methodToBS $ W.requestMethod w failure $ BadMethod $ toString $ W.methodToBS $ W.requestMethod w
-- | Return a 403 permission denied page. -- | Return a 403 permission denied page.
permissionDenied :: Failure ErrorResponse m => m a permissionDenied :: Failure ErrorResponse m => String -> m a
permissionDenied = failure $ PermissionDenied "Permission denied" permissionDenied = failure . PermissionDenied
-- | Return a 400 invalid arguments page. -- | Return a 400 invalid arguments page.
invalidArgs :: Failure ErrorResponse m => [(ParamName, String)] -> m a invalidArgs :: Failure ErrorResponse m => [(ParamName, String)] -> m a

View File

@ -85,22 +85,22 @@ class Yesod a where
|] |]
-- | Gets called at the beginning of each request. Useful for logging. -- | Gets called at the beginning of each request. Useful for logging.
onRequest :: a -> Request -> IO () onRequest :: GHandler sub a ()
onRequest _ _ = return () onRequest = return ()
-- | Override the rendering function for a particular URL. One use case for -- | Override the rendering function for a particular URL. One use case for
-- this is to offload static hosting to a different domain name to avoid -- this is to offload static hosting to a different domain name to avoid
-- sending cookies. -- sending cookies.
urlRenderOverride :: a -> Routes a -> Maybe String urlRenderOverride :: Routes a -> Maybe String
urlRenderOverride _ _ = Nothing urlRenderOverride _ = Nothing
-- | Determine is a request is authorized or not. -- | Determine if a request is authorized or not.
-- --
-- Return 'Nothing' is the request is authorized, 'Just' a message if -- Return 'Nothing' is the request is authorized, 'Just' a message if
-- unauthorized. If authentication is required, you should use a redirect; -- unauthorized. If authentication is required, you should use a redirect;
-- the Auth helper provides this functionality automatically. -- the Auth helper provides this functionality automatically.
isAuthorized :: a -> Routes a -> IO (Maybe String) isAuthorized :: Routes a -> Handler a (Maybe String)
isAuthorized _ _ = return Nothing isAuthorized _ = return Nothing
-- | A type-safe, concise method of creating breadcrumbs for pages. For each -- | A type-safe, concise method of creating breadcrumbs for pages. For each
-- resource, you declare the title of the page and the parent resource (if -- resource, you declare the title of the page and the parent resource (if