Send Beginners mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1. Re:  Date Time in Haskell (Dananji Liyanage)


----------------------------------------------------------------------

Message: 1
Date: Thu, 14 May 2015 17:24:26 +0530
From: Dananji Liyanage <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Date Time in Haskell
Message-ID:
        <caapsy8yqz5vhbpevgokmwfioaorhc5k7wnp7y-cnreqjy-t...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Thanks Max!!

On Thu, May 14, 2015 at 4:57 PM, Max Voit <[email protected]>
wrote:

> On Thu, 14 May 2015 16:27:46 +0530
> Dananji Liyanage <[email protected]> wrote:
>
> > 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
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>



-- 
Regards,
Dananji Liyanage
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20150514/829ebbb5/attachment-0001.html>

------------------------------

Subject: Digest Footer

_______________________________________________
Beginners mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners


------------------------------

End of Beginners Digest, Vol 83, Issue 38
*****************************************

Reply via email to