Im not sure what you mean exactly by &quot;run the scaffolder&quot;, (just to be clear, I am not exactly sure what technically scaffolding is apart from it being referenced once or twice in your documentation)<div><br></div>
<div>I assume you are talking about setting up the handlers for a specific route, and then creating that single route on its own (instead of all at once with mkYesod)?<br><br><div class="gmail_quote">On Mon, May 2, 2011 at 11:30 PM, Michael Snoyman <span dir="ltr">&lt;<a href="mailto:michael@snoyman.com">michael@snoyman.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">My best advice is to just run the scaffolder. Any other examples I can<br>
point you to (like the Haskellers source code) will contain a lot of<br>
extra information that won&#39;t necessarily apply to your case.<br>
<font color="#888888"><br>
Michael<br>
</font><div><div></div><div class="h5"><br>
On Mon, May 2, 2011 at 4:28 PM, Mathew de Detrich &lt;<a href="mailto:deteego@gmail.com">deteego@gmail.com</a>&gt; wrote:<br>
&gt; ......<br>
&gt; You tell me this now ;)<br>
&gt; I was actually wanting to look at scaffolding, but the section for it in the<br>
&gt; Yesod book is not completed yet (<a href="http://www.yesodweb.com/book/scaffold" target="_blank">http://www.yesodweb.com/book/scaffold</a>)<br>
&gt; Well that was like 4 hours wasted<br>
&gt; Do you have a quick example of how scaffolding is done with mkYesodData and<br>
&gt; mkYesodDispatch (I only need something trivial)?<br>
&gt; On Mon, May 2, 2011 at 11:18 PM, Michael Snoyman &lt;<a href="mailto:michael@snoyman.com">michael@snoyman.com</a>&gt;<br>
&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; Actually, there&#39;s a much simpler solution already implemented in the<br>
&gt;&gt; scaffolded site: instead of using mkYesod, use mkYesodData and<br>
&gt;&gt; mkYesodDispatch. mkYesod is really just a combination of the two. The<br>
&gt;&gt; former defines your route datatype, and the latter creates the<br>
&gt;&gt; YesodDispatch instance. This allows you to create your route in one<br>
&gt;&gt; module, put your handlers in their own modules, and then import those<br>
&gt;&gt; handlers in the final module that calls mkYesodDispatch.<br>
&gt;&gt;<br>
&gt;&gt; HTH,<br>
&gt;&gt; Michael<br>
&gt;&gt;<br>
&gt;&gt; On Mon, May 2, 2011 at 4:14 PM, Mathew de Detrich &lt;<a href="mailto:deteego@gmail.com">deteego@gmail.com</a>&gt;<br>
&gt;&gt; wrote:<br>
&gt;&gt; &gt; Ok I have found the source issue, in my case it was an issue that ended<br>
&gt;&gt; &gt; up<br>
&gt;&gt; &gt; turning into how the modules for my Webserver is organized, and that<br>
&gt;&gt; &gt; compiler error (about an ambiguous type) occurred because my main<br>
&gt;&gt; &gt; webserver<br>
&gt;&gt; &gt; datatype was not instantiated yet in that module (using where aproot).<br>
&gt;&gt; &gt; In essence there were 2 issues<br>
&gt;&gt; &gt; The original problem (with the ambigous type error) was fixed by just<br>
&gt;&gt; &gt; simply<br>
&gt;&gt; &gt; providing a type (in this case RepHtml) to the function definition<br>
&gt;&gt; &gt; Once this was done, the second problem occured due to using splicing<br>
&gt;&gt; &gt; with<br>
&gt;&gt; &gt; Template Haskell (from mkYesod). What I was attempting to do is to<br>
&gt;&gt; &gt; seperate<br>
&gt;&gt; &gt; the handlers (of the form get/post****R) from the routes created with<br>
&gt;&gt; &gt; mkYesod. This wasn&#39;t originally an issue until I tried to create<br>
&gt;&gt; &gt; widgets,<br>
&gt;&gt; &gt; and it was due to the use of defaultLayout.<br>
&gt;&gt; &gt; Handlers using defaultLayout needs to be placed *after* the<br>
&gt;&gt; &gt; instantiation of<br>
&gt;&gt; &gt; yesod (where you do instance yesod *** where aproot *****) however, the<br>
&gt;&gt; &gt; mkYesod requires the handlers (of the form get/post****R) to be placed<br>
&gt;&gt; &gt; before the routes. Handlers without a defaultLayout do not require the<br>
&gt;&gt; &gt; Yesod<br>
&gt;&gt; &gt; instantiation to compile (which is why the error never came up before, I<br>
&gt;&gt; &gt; never used defaultLayout prior to attempting to use widgets). This<br>
&gt;&gt; &gt; created<br>
&gt;&gt; &gt; some horrific cyclic module dependably, where I was forced to use<br>
&gt;&gt; &gt; hs-boot<br>
&gt;&gt; &gt; files along with creating a dummy module which just contains the<br>
&gt;&gt; &gt; instance<br>
&gt;&gt; &gt; Yesod ** where ****** by itself. Splitting off that instantiation into<br>
&gt;&gt; &gt; a separate module was required since hs-boot files don&#39;t work with<br>
&gt;&gt; &gt; functions<br>
&gt;&gt; &gt; that do splicing due to template haskell<br>
&gt;&gt; &gt; Of course if GHC supported cyclic module dependencies out of the box<br>
&gt;&gt; &gt; (and<br>
&gt;&gt; &gt; support for function splices with template haskell in those hs-boot<br>
&gt;&gt; &gt; files<br>
&gt;&gt; &gt; are added) then this would have been much less painful, is there any<br>
&gt;&gt; &gt; plan to<br>
&gt;&gt; &gt; support automatic creating of hs-boot files to GHC anytime soon?<br>
&gt;&gt; &gt; On Sun, May 1, 2011 at 11:00 PM, Michael Snoyman &lt;<a href="mailto:michael@snoyman.com">michael@snoyman.com</a>&gt;<br>
&gt;&gt; &gt; wrote:<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Without seeing the actual code that&#39;s causing the breakage, there&#39;s<br>
&gt;&gt; &gt;&gt; not much I can tell you. (If you&#39;d like me to take a look off-list,<br>
&gt;&gt; &gt;&gt; feel free to send me a private email.) My best recommendation is to<br>
&gt;&gt; &gt;&gt; try putting a type signature on getRootR.<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; As a general issue: polymorphic Hamlet is a very convenient feature,<br>
&gt;&gt; &gt;&gt; but I think it leads to too much complexity in the type system. I&#39;ve<br>
&gt;&gt; &gt;&gt; added some code for non-polymorphic Hamlet to the Github repo and will<br>
&gt;&gt; &gt;&gt; be releasing it as its own module (Text.Hamlet.NonPoly) in the next<br>
&gt;&gt; &gt;&gt; release. Assuming all goes well, it will be replacing the current<br>
&gt;&gt; &gt;&gt; Hamlet. That essentially means that you&#39;ll need to replace your code<br>
&gt;&gt; &gt;&gt; with something like:<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; getRootR = defaultLayout $ do<br>
&gt;&gt; &gt;&gt;    setTitle &quot;Polymorphic Hamlet&quot;<br>
&gt;&gt; &gt;&gt;    addHtml [$html|&lt;p&gt;I was added with addHtml|]<br>
&gt;&gt; &gt;&gt;    addHamlet [$hamlet|&lt;p&gt;I was added with addHamlet|]<br>
&gt;&gt; &gt;&gt;    addWidget [$whamlet|&lt;p&gt;I was added with addWidget|]<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; And just to make everyone curious: I&#39;ve also added i18n support to<br>
&gt;&gt; &gt;&gt; non-poly Hamlet. I&#39;ve got a long train ride on Tuesday, and I&#39;m<br>
&gt;&gt; &gt;&gt; planning on documenting it then.<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Michael<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; On Sun, May 1, 2011 at 6:50 AM, Mathew de Detrich &lt;<a href="mailto:deteego@gmail.com">deteego@gmail.com</a>&gt;<br>
&gt;&gt; &gt;&gt; wrote:<br>
&gt;&gt; &gt;&gt; &gt; Ok so I have a problem that was described here<br>
&gt;&gt; &gt;&gt; &gt; (<a href="http://permalink.gmane.org/gmane.comp.lang.haskell.web/1431" target="_blank">http://permalink.gmane.org/gmane.comp.lang.haskell.web/1431</a>) in<br>
&gt;&gt; &gt;&gt; &gt; regards<br>
&gt;&gt; &gt;&gt; &gt; to<br>
&gt;&gt; &gt;&gt; &gt; returning a  &quot;Ambiguous type variable `a0&#39; in the constraint error&quot;<br>
&gt;&gt; &gt;&gt; &gt; when<br>
&gt;&gt; &gt;&gt; &gt; compiling. Originally I thought it was due to the way I was coding<br>
&gt;&gt; &gt;&gt; &gt; that<br>
&gt;&gt; &gt;&gt; &gt; part<br>
&gt;&gt; &gt;&gt; &gt; of the code (or to be more accurate the code specifically for<br>
&gt;&gt; &gt;&gt; &gt; creating<br>
&gt;&gt; &gt;&gt; &gt; the<br>
&gt;&gt; &gt;&gt; &gt; so called widgets with addHTML/addWidget,addHamlet). So I copied the<br>
&gt;&gt; &gt;&gt; &gt; example<br>
&gt;&gt; &gt;&gt; &gt; code given here exactly<br>
&gt;&gt; &gt;&gt; &gt; (<a href="http://www.yesodweb.com/book/example-widgets" target="_blank">http://www.yesodweb.com/book/example-widgets</a>).<br>
&gt;&gt; &gt;&gt; &gt; Compiling this worked fine, so at the next point I changed the<br>
&gt;&gt; &gt;&gt; &gt; definition<br>
&gt;&gt; &gt;&gt; &gt; of getRootR to<br>
&gt;&gt; &gt;&gt; &gt; getRootR = defaultLayout $ wrapper $ do<br>
&gt;&gt; &gt;&gt; &gt;     setTitle &quot;Polymorphic Hamlet&quot;<br>
&gt;&gt; &gt;&gt; &gt;     addHtml [$hamlet|&lt;p&gt;I was added with addHtml|]<br>
&gt;&gt; &gt;&gt; &gt;     addHamlet [$hamlet|&lt;p&gt;I was added with addHamlet|]<br>
&gt;&gt; &gt;&gt; &gt;     addWidget [$hamlet|&lt;p&gt;I was added with addWidget|]<br>
&gt;&gt; &gt;&gt; &gt; and then to<br>
&gt;&gt; &gt;&gt; &gt; getRootR = defaultLayout $ do<br>
&gt;&gt; &gt;&gt; &gt;     setTitle &quot;Polymorphic Hamlet&quot;<br>
&gt;&gt; &gt;&gt; &gt;     addHtml [$hamlet|&lt;p&gt;I was added with addHtml|]<br>
&gt;&gt; &gt;&gt; &gt;     addHamlet [$hamlet|&lt;p&gt;I was added with addHamlet|]<br>
&gt;&gt; &gt;&gt; &gt;     addWidget [$hamlet|&lt;p&gt;I was added with addWidget|]<br>
&gt;&gt; &gt;&gt; &gt; Both times compiled fine, so the issue wasn&#39;t what I originally<br>
&gt;&gt; &gt;&gt; &gt; thought<br>
&gt;&gt; &gt;&gt; &gt; that<br>
&gt;&gt; &gt;&gt; &gt; it was (as described<br>
&gt;&gt; &gt;&gt; &gt; in <a href="http://permalink.gmane.org/gmane.comp.lang.haskell.web/1431" target="_blank">http://permalink.gmane.org/gmane.comp.lang.haskell.web/1431</a>). The<br>
&gt;&gt; &gt;&gt; &gt; problem<br>
&gt;&gt; &gt;&gt; &gt; is, that when I use the above example code in my WebServer, I get<br>
&gt;&gt; &gt;&gt; &gt; this<br>
&gt;&gt; &gt;&gt; &gt; Ambigious type error when compiling (even though I have set up the<br>
&gt;&gt; &gt;&gt; &gt; route<br>
&gt;&gt; &gt;&gt; &gt; the<br>
&gt;&gt; &gt;&gt; &gt; exact same way). Unfortunatley I can&#39;t provide the code for my<br>
&gt;&gt; &gt;&gt; &gt; webserver,<br>
&gt;&gt; &gt;&gt; &gt; since its commercially owned (and it would be pointless because its<br>
&gt;&gt; &gt;&gt; &gt; just<br>
&gt;&gt; &gt;&gt; &gt; renamed variables, but otherwise its the same), so does anyone have<br>
&gt;&gt; &gt;&gt; &gt; any<br>
&gt;&gt; &gt;&gt; &gt; ideas what could possibly cause such an error (such as a<br>
&gt;&gt; &gt;&gt; &gt; missing/extra<br>
&gt;&gt; &gt;&gt; &gt; import or some package or something), or possibly some missing<br>
&gt;&gt; &gt;&gt; &gt; instances?<br>
&gt;&gt; &gt;&gt; &gt; Also sorry for creating another mailing list, but its a different<br>
&gt;&gt; &gt;&gt; &gt; issue<br>
&gt;&gt; &gt;&gt; &gt; then<br>
&gt;&gt; &gt;&gt; &gt; what I thought it was originally (and I also wanted to put it on<br>
&gt;&gt; &gt;&gt; &gt; haskell-cafe since its a more general issue)<br>
&gt;&gt; &gt;&gt; &gt; _______________________________________________<br>
&gt;&gt; &gt;&gt; &gt; web-devel mailing list<br>
&gt;&gt; &gt;&gt; &gt; <a href="mailto:web-devel@haskell.org">web-devel@haskell.org</a><br>
&gt;&gt; &gt;&gt; &gt; <a href="http://www.haskell.org/mailman/listinfo/web-devel" target="_blank">http://www.haskell.org/mailman/listinfo/web-devel</a><br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; web-devel mailing list<br>
&gt; <a href="mailto:web-devel@haskell.org">web-devel@haskell.org</a><br>
&gt; <a href="http://www.haskell.org/mailman/listinfo/web-devel" target="_blank">http://www.haskell.org/mailman/listinfo/web-devel</a><br>
&gt;<br>
&gt;<br>
</div></div></blockquote></div><br></div>