Merge branch 'master' of github.com:yesodweb/yesod
This commit is contained in:
commit
b03cfb1562
2
scripts
2
scripts
@ -1 +1 @@
|
|||||||
Subproject commit 0bc3a16bcec9b7ee36c66c9dcb74041d569955f6
|
Subproject commit d4cb555ca5fd6bc67f7da484a63d1fcdb149eac9
|
||||||
@ -103,23 +103,23 @@ mkYesodSubDispatch :: String -> Cxt -> [Resource String] -> Q [Dec]
|
|||||||
mkYesodSubDispatch name clazzes = fmap snd . mkYesodGeneral name' rest clazzes True
|
mkYesodSubDispatch name clazzes = fmap snd . mkYesodGeneral name' rest clazzes True
|
||||||
where (name':rest) = words name
|
where (name':rest) = words name
|
||||||
|
|
||||||
mkYesodGeneral :: String -- ^ foundation name
|
mkYesodGeneral :: String -- ^ foundation type
|
||||||
-> [String] -- ^ parameters for foundation
|
-> [String]
|
||||||
-> Cxt -- ^ classes
|
-> Cxt -- ^ classes
|
||||||
-> Bool -- ^ is subsite?
|
-> Bool -- ^ is subsite?
|
||||||
-> [Resource String]
|
-> [Resource String]
|
||||||
-> Q ([Dec], [Dec])
|
-> Q ([Dec], [Dec])
|
||||||
mkYesodGeneral name args clazzes isSub resS = do
|
mkYesodGeneral name args clazzes isSub resS = do
|
||||||
|
let args' = map mkName args
|
||||||
|
arg = foldl AppT (ConT name') $ map VarT args'
|
||||||
let res = map (fmap parseType) resS
|
let res = map (fmap parseType) resS
|
||||||
renderRouteDec <- mkRenderRouteInstance (ConT name') res
|
renderRouteDec <- mkRenderRouteInstance arg res
|
||||||
|
|
||||||
disp <- mkDispatchClause [|yesodRunner|] [|yesodDispatch|] [|fmap chooseRep|] res
|
disp <- mkDispatchClause [|yesodRunner|] [|yesodDispatch|] [|fmap chooseRep|] res
|
||||||
let master = mkName "master"
|
let master = mkName "master"
|
||||||
let ctx = if isSub
|
let ctx = if isSub
|
||||||
then ClassP (mkName "Yesod") [VarT master] : clazzes
|
then ClassP (mkName "Yesod") [VarT master] : clazzes
|
||||||
else []
|
else []
|
||||||
let args' = map mkName args
|
|
||||||
arg = foldl AppT (ConT name') $ map VarT args'
|
|
||||||
let ytyp = if isSub
|
let ytyp = if isSub
|
||||||
then ConT ''YesodDispatch `AppT` arg `AppT` VarT master
|
then ConT ''YesodDispatch `AppT` arg `AppT` VarT master
|
||||||
else ConT ''YesodDispatch `AppT` arg `AppT` arg
|
else ConT ''YesodDispatch `AppT` arg `AppT` arg
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user