diff --git a/Yesod/Dispatch.hs b/Yesod/Dispatch.hs index 74eaee8d..4afa3f3b 100644 --- a/Yesod/Dispatch.hs +++ b/Yesod/Dispatch.hs @@ -58,13 +58,13 @@ explodeHandler a b c d e f _ _ = runHandler a b (Just c) d e f mkYesodGeneral :: String -> [Name] -> Bool -> [Resource] -> Q [Dec] mkYesodGeneral name clazzes isSub res = do let name' = mkName name - let tySyn = TySynInstD ''Routes [ConT $ name'] (ConT $ mkName $ name ++ "Routes") + let tySyn = TySynInstD ''Routes [ConT name'] (ConT $ mkName $ name ++ "Routes") let site = mkName $ "site" ++ name let gsbod = NormalB $ VarE site let yes' = FunD (mkName "getSite") [Clause [] gsbod []] let yes = InstanceD [] (ConT ''YesodSite `AppT` ConT name') [yes'] explode <- [|explodeHandler|] - CreateRoutesResult x _ z <- createRoutes $ CreateRoutesSettings + CreateRoutesResult x _ z <- createRoutes CreateRoutesSettings { crRoutes = mkName $ name ++ "Routes" , crApplication = ConT ''YesodApp , crArgument = ConT $ mkName name @@ -85,11 +85,11 @@ mkYesodGeneral name clazzes isSub res = do `AppT` murl `AppT` master let ctx = if isSub - then map (\c -> ClassP c [master]) clazzes + then map (flip ClassP [master]) clazzes else [] - tvs = if isSub then [PlainTV $ mkName "master"] else [] + tvs = [PlainTV $ mkName "master" | isSub] let y' = SigD site $ ForallT tvs ctx yType - return $ (if isSub then id else (:) yes) $ [y', z, tySyn, x] + return $ (if isSub then id else (:) yes) [y', z, tySyn, x] toWaiApp :: Yesod y => y -> IO W.Application toWaiApp a = do diff --git a/Yesod/Form.hs b/Yesod/Form.hs index 0b7a80cf..cc0a3e0b 100644 --- a/Yesod/Form.hs +++ b/Yesod/Form.hs @@ -45,7 +45,7 @@ instance Functor Form where instance Applicative Form where pure x = Form $ \_ -> Right (Nothing, x) (Form f') <*> (Form x') = Form $ \l -> case (f' l, x' l) of - (Right (_, f), Right (_, x)) -> Right $ (Nothing, f x) + (Right (_, f), Right (_, x)) -> Right (Nothing, f x) (Left e1, Left e2) -> Left $ e1 ++ e2 (Left e, _) -> Left e (_, Left e) -> Left e @@ -75,7 +75,7 @@ runFormGet f = do runFormGeneric (getParams rr) f input :: ParamName -> Form [ParamValue] -input pn = Form $ \l -> Right $ (Just pn, l pn) +input pn = Form $ \l -> Right (Just pn, l pn) applyForm :: (x -> Either FormError y) -> Form x -> Form y applyForm f (Form x') = diff --git a/Yesod/Handler.hs b/Yesod/Handler.hs index ead83da9..17e16413 100644 --- a/Yesod/Handler.hs +++ b/Yesod/Handler.hs @@ -155,7 +155,7 @@ runHandler handler mrender sroute tomr ma tosa = YesodApp $ \eh rr cts -> do InternalError . (show :: Control.Exception.SomeException -> String) (headers, contents) <- Control.Exception.catch - (unHandler handler $ HandlerData + (unHandler handler HandlerData { handlerRequest = rr , handlerSub = tosa ma , handlerMaster = ma diff --git a/Yesod/Helpers/Auth.hs b/Yesod/Helpers/Auth.hs index 195c2d59..c9e9c10f 100644 --- a/Yesod/Helpers/Auth.hs +++ b/Yesod/Helpers/Auth.hs @@ -160,9 +160,7 @@ getDisplayName :: Rpxnow.Identifier -> String getDisplayName (Rpxnow.Identifier ident extra) = helper choices where choices = ["verifiedEmail", "email", "displayName", "preferredUsername"] helper [] = ident - helper (x:xs) = case lookup x extra of - Nothing -> helper xs - Just y -> y + helper (x:xs) = fromMaybe (helper xs) $ lookup x extra getCheck :: Yesod master => GHandler Auth master RepHtmlJson getCheck = do