<div dir="ltr"><div><div><div><div><div><div><div>Adding to Francesco's reply, UTCTime is not a String either. Luckily, it does have a Show instance however, which means you probably want something like:<br><br></div> getDateString = do<br></div> date <- getCurrentTime<br></div> return $ show date<br><br></div>Or, more simply: getDateString = fmap show getCurrentTime<br><br></div>You will still need to use bind, fmap, or do to get at the actual date string however.<br><br></div>Thanks,<br></div>Arjun<br></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Nov 10, 2016 at 1:58 PM Francesco Ariis <<a href="mailto:fa-ml@ariis.it">fa-ml@ariis.it</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Thu, Nov 10, 2016 at 07:44:17PM +0100, sasa bogicevic wrote:<br class="gmail_msg">
> Hi All,<br class="gmail_msg">
><br class="gmail_msg">
> This is a small program<br class="gmail_msg">
><br class="gmail_msg">
> [...]<br class="gmail_msg">
<br class="gmail_msg">
Hey Sasa,<br class="gmail_msg">
If we put this into ghci<br class="gmail_msg">
<br class="gmail_msg">
λ> :t formatDateString $ timeFromString _<br class="gmail_msg">
<br class="gmail_msg">
the "hole" tells us we need something of type String, but `getDateString`<br class="gmail_msg">
is not!<br class="gmail_msg">
<br class="gmail_msg">
λ> :t getDateString<br class="gmail_msg">
getDateString :: IO UTCTime<br class="gmail_msg">
<br class="gmail_msg">
That means you have to bind it inside a `do` block (or use >>=).<br class="gmail_msg">
Ask for more if I was not clear!<br class="gmail_msg">
_______________________________________________<br class="gmail_msg">
Beginners mailing list<br class="gmail_msg">
<a href="mailto:Beginners@haskell.org" class="gmail_msg" target="_blank">Beginners@haskell.org</a><br class="gmail_msg">
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer" class="gmail_msg" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br class="gmail_msg">
</blockquote></div>