<font size="4"><font face="times new roman,serif"><font size="4" style="font-family:arial;font-size:small"><font face="times new roman,serif">Hi </font></font><div style="font-family:arial;font-size:small">
<font size="4"><font face="times new roman,serif"><br></font></font></div><div style="font-family:arial;font-size:small"><font size="4"><font face="times new roman,serif">I tried <a href="http://www.yesodweb.com/five-minutes" target="_blank">yesod in five minutes</a> and I'm having a problem trying to add a date and time string that would update on refresh. </font></font></div>
<div style="font-family:arial;font-size:small"><font size="4"><font face="times new roman,serif"><br></font></font></div><div style="font-family:arial;font-size:small"><font size="4"><font face="times new roman,serif">I just want to add it to the simple page you get with yesod in 5 minutes. I can embed a date and time string that is the value of a Haskell variable but that won't refresh on update to the current date and time. My simplistic approach was to put a line in Handler/root.hs:</font></font></div>
<div style="font-family:arial;font-size:small"><span style="font-family:'times new roman', serif;font-size:large"><br></span></div></font></font><blockquote style="margin:0 0 0 40px;border:none;padding:0px">
<font size="4"><font face="times new roman,serif"><div style="font-family:arial;font-size:small"><span style="font-family:'times new roman', serif;font-size:large">currTimeAndDate = getClockTime</span></div>
<div style="font-family:arial;font-size:small"><span style="font-family:'times new roman', serif;font-size:large"><br></span></div></font></font></blockquote><font face="'times new roman', serif" size="4">but that won't compile:</font><div>
<font face="'times new roman', serif" size="4"><br></font></div><div><font face="'times new roman', serif" size="4"><div><br></div></font></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px">
<div><font face="'times new roman', serif" size="4"><div>Handler/Root.hs:22:21:</div></font></div><div><font face="'times new roman', serif" size="4"><div>
No instance for (blaze-html-0.4.1.1:Text.Blaze.ToHtml</div></font></div><div><font face="'times new roman', serif" size="4"><div> (IO ClockTime))</div></font></div>
<div><font face="'times new roman', serif" size="4"><div> arising from a use of `toHtml'</div></font></div><div><font face="'times new roman', serif" size="4"><div>
Possible fix:</div></font></div><div><font face="'times new roman', serif" size="4"><div> add an instance declaration for</div></font></div><div><font face="'times new roman', serif" size="4"><div>
(blaze-html-0.4.1.1:Text.Blaze.ToHtml (IO ClockTime))</div></font></div><div><font face="'times new roman', serif" size="4"><div> In the second argument of `(.)', namely `toHtml'</div>
</font></div><div><font face="'times new roman', serif" size="4"><div> In the expression:</div></font></div><div><font face="'times new roman', serif" size="4"><div>
hamlet-0.8.2:Text.Hamlet.Quasi.htmlToHamletMonad . toHtml</div></font></div><div><font face="'times new roman', serif" size="4"><div> In a stmt of a 'do' expression:</div>
</font></div><div><font face="'times new roman', serif" size="4"><div> (hamlet-0.8.2:Text.Hamlet.Quasi.htmlToHamletMonad . toHtml)</div></font></div><div><font face="'times new roman', serif" size="4"><div>
currTimeAndDate</div></font></div></blockquote><div><font size="4"><font face="times new roman,serif"><div><br></div><div>I'm sure it would compile if I wrapped getClockTime with unsafePerformIO to get a String but then refresh of the page wouldn't give me the current time. In addition it doesn't seem like the right way to do this. </div>
<div><br></div><div>I'm sure my problem is due to my lack of knowledge of Haskell IO and monads which I do plan to learn thoroughly but right now I'd just like to get this to work. It seems like I could do it with a form in Yesod but that seems like overkill and wouldn't have the look I want.</div>
<div><br></div><div>I'm very impressed with the software, the book and the source code for the <a href="http://www.haskellers.com">www.haskellers.com</a>. It is a testimony to the quality of all three that I have got this far, particularly considering how little I know. Any help would be greatly appreciated.</div>
<div><br></div><div>Sincerely</div><div>George</div><div><br></div>
<div style="font-family:arial;font-size:small">
<ol></ol></div></font></font>
</div>