Repository navigation
Fix parseRoutes brace-token comment, document TH-stage split requirement - #1926
Conversation
Fixes an inaccurate comment claiming parseRoutes's `{...}` brace token
only accepts single-token subsite types; it actually accepts any
fully-applied type expression (verified against Yesod.Routes.Parse).
Documents a previously-unstated GHC TH stage-restriction constraint:
the Data/Dispatch module split becomes mandatory, not just
organizational, once a parameterized subsite mounts a different
subsite as a route-tree leaf.
Cycle decisions:
- Scope kept to comment/doc-only — no route/type changes
- Rewrote fixture comment explaining why ConcreteParamSub is now
optional but ConcreteBigSub remains required
- Documented the split requirement in both the Recipe and
Troubleshooting sections
- Written generically, with no reference to internal planning docs
Triage outcomes:
- F1 accepted (patched in-session by Claude) — corrected
mkYesodSubDispatchInstance description (generates dispatch
instances, not the datatype)
- F2 accepted (patched in-session by Claude) — added "route"
qualifier to mkYesodSubData description
- F3 accepted (patched in-session by Claude) — Test plan updated to
use sharness verify-test instead of bare stack build
Cycle: feature-subsite-th-stage-docs
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
There was a problem hiding this comment.
This seems1 entirely AI generated, but that isn't to say it isn't still legit. I think some of the details here are kind of… irrelevant? Or at least not entirely useful to an actual human reading this. Though what's written here isn't necessarily final either; we can always refine this later.
What would make this contribution better (for other humans) would be a minimal concrete example of the pattern you're describing. Subsites in general are an under-documented (and important!) part of Yesod.
Footnotes
-
Correct me if I'm wrong. ↩
|
Hi @jezen — thanks again for reviewing this. You noted this read as AI-generated (fair — I wrote it with Claude's help) While working on that example, I found the docs I added here actually got Digging further also turned up a second, previously-undocumented parser I originally hit this on my own site, jeongoon.space I'm naming the Claude-assisted authorship again on purpose — everything in |
|
This reads exactly like more Claude output. |
What
YesodCoreTest/ParameterizedSubDispatchRuntime.hsclaiming thatparseRoutes's{...}brace token only accepts single-token subsite types. It actually accepts any fully-applied type expression (e.g.{ParamSubsite ConcreteSub}), verified againstYesod.Routes.Parse.parseTypeTree.docs/split-route-compilation.md: splitting a subsite's Data module (mkYesodSubData) from its Dispatch module (mkYesodSubDispatch) into separately-compiled modules becomes mandatory — not just organizational — once a parameterized subsite mounts a different subsite as a leaf in its own route tree. Adds a matching Troubleshooting entry quoting the actual GHC error text.Why
While working with parameterized subsites, I'd been declaring
typesynonyms just so{...}would have a single identifier to point at. Discovering that brace tokens actually accept any fully-applied type expression directly was a nice simplification — turns out a synonym is only needed when the target type can't be written as a bare applied expression (e.g. it involves a unit type like()). Working through that also surfaced that the existing comment didn't reflect this, and that the related Data/Dispatch split requirement wasn't documented anywhere, even thoughyesod-core's own test suite already has a worked example of exactly this shape.Testing
No code changes — comment and documentation only. Verified via
stack build yesod-core(exit 0) that the touched files still compile cleanly.