yesodweb / yesod

A RESTful Haskell web framework built on WAI.
http://www.yesodweb.com/
MIT License
2.64k stars 374 forks source link

Fix subsite-to-subsite dispatch #1805

Closed AriFordsham closed 1 year ago

AriFordsham commented 1 year ago

Before submitting your PR, check that you've:

After submitting your PR:

Fixes #1803 .

It is now behaving correctly on https://github.com/jezen/subsite-with-static (see https://github.com/AriFordsham/subsite-with-static/tree/ari/yesod-change).

It's a bit messier than I wuld like, as well as being a hack overall - see https://github.com/yesodweb/yesod/issues/1803#issuecomment-1605988275. The type signature to subTopDispatch makes sure this builds when mkDispatchInstance passes subHelper to it (even though subHelper is unused ☹)

AriFordsham commented 1 year ago

A fails-before, passes-after test is hard to write, because the failure is compile-time. I guess I could just include a simple test which show subsite-to-subsite dispatch working.

jezen commented 1 year ago

I think that sounds sensible 🙂

AriFordsham commented 1 year ago

Added a test case. This does not compile on master, and passes on this PR.