<div dir="ltr">Hi all,<div><br></div><div>There&#39;s an inherent difference in how Yesod handles routing, by default, and how Happstack/Snap handle routing, by default. (Apologies if I am mistaken in my understanding of the latter.) Yesod is built in with the concept of type-safe URLs. This forms the basis of routing in Yesod: the list of path segments is first converted to a type-safe URL value, and then the appropriate handler is chosen from that. On the other hand, Happstack/Snap both allow you to perform routing directly on the path segments.</div>

<div><br></div><div>What many people don&#39;t realize is that it&#39;s entirely possible to do segment-based routing in Yesod. I don&#39;t recommend the practice in general, since it defeats a lot of the type safety Yesod gives you. However, in some situations it&#39;s a necessity. For example, yesod-auth allows arbitrary authentication plugins, which would not mesh up well with type-safe URLs.</div>

<div><br></div><div>The trick to bypassing the type safety is to use multi-pieces. Instead of describing how this is possible, I will merely point to an example: <a href="https://gist.github.com/884802">https://gist.github.com/884802</a></div>

<div><br></div><div>The Yesod.Dynamic module defined there is really a general way to allow Yesod routing based on path segments. Since the question has come up a number of times in the past, I&#39;m curious if people would want this available on hackage. I&#39;m sure a nice set of routing operators would be useful here as well.</div>

<div><br></div><div>Michael</div></div>