-
Notifications
You must be signed in to change notification settings - Fork 381
Open
Description
In #1366, contexts and type arguments were added and are now possible for sites. However, these type arguments are not included in the subroutes, which means the flexibility that was granted from them is somewhat lost.
Here is a motivating example:
mkYesodSubData "(SiteClass master) => SiteBuilder master" [parseRoutes|
!/#{ItemId master} HomeR:
/edit EditR:
/for/#{Key (PersistUser master)} ForR GET
|]
Here we want to mention the master argument in the same way that we can use it in "top level" routes.
The code generated includes (approximately):
instance SiteClass master =>
RenderRoute (SiteBuilder master) where
data Route (SiteBuilder master)
= HomeR (ItemId master) EditR
deriving ()
...
data EditR
= ForR (Key (PersistUser master))
Which fails to compile because master is not in scope for the top level definition of EditR.
I suggest that the type arguments which are already collected for the top level routes are also passed down to the subroutes, meaning that instead of data EditR = ... we'd have data EditR master = ....
This would be a breaking change unfortunately.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels