
On Thu, 14 May 2015 16:27:46 +0530
Dananji Liyanage
Correct me if I'm doing something wrong here. Here's my code:
main = do now <- getCurrentTime diffUTCTime now bree bree = readMay "1981-06-16 04:35:25" :: UTCTime
There are several problems with that code. First what the compiler is complaining about: Last statement in a do-block must have type of the block, in this case IO () - so print it or return () For the readMay - this is expected to return Maybe UTCTime. To stuff this into diffUTCTime you need to get it out of the Maybe. For my formulation "is expected to" - it won't, as UTCTime has no Read instance (so you can't call read on it). Take a look at ParseTime and its buildTime method. cheers, max