Allow subsites within hierarchical routes

This commit is contained in:
Anupam Jain 2016-01-13 10:47:50 +05:30
parent d4a907d4e8
commit a1df470d01

View File

@ -176,11 +176,12 @@ mkDispatchClause MkDispatchSettings {..} resources = do
subDispatcherE <- mdsSubDispatcher
runHandlerE <- mdsRunHandler
sub <- newName "sub"
sroute <- newName "sroute"
let sub2 = LamE [VarP sub]
(foldl' (\a b -> a `AppE` b) (VarE (mkName getSub) `AppE` VarE sub) dyns)
let reqExp' = setPathInfoE `AppE` VarE restPath `AppE` reqExp
route' = foldl' AppE (ConE (mkName name)) dyns
route = foldr AppE route' extraCons
route = LamE [VarP sroute] $ foldr AppE (AppE route' $ VarE sroute) extraCons
exp = subDispatcherE
`AppE` runHandlerE
`AppE` sub2