Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
What is the good way to work with list comprehension and UTCTime?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  9 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Magicloud Magiclouds  
View profile  
 More options Sep 14 2012, 1:30 am
From: Magicloud Magiclouds <magicloud.magiclo...@gmail.com>
Date: Fri, 14 Sep 2012 13:29:52 +0800
Local: Fri, Sep 14 2012 1:29 am
Subject: [Haskell-cafe] What is the good way to work with list comprehension and UTCTime?
Hi,
  Simple usage, I could make an instance of Enum to UTCTime, so
[utcTime..] could work. But that is so stiff. How if sometimes I want
to step by 1 min, sometimes I want to step by 1 sec?
  So I think some way like [ t | addUTCTime last 60 ] could be nice.
But I cannot figure it out....
  Any idea?
--
竹密岂妨流水过
山高哪阻野云飞

And for G+, please use magiclouds#gmail.com.

_______________________________________________
Haskell-Cafe mailing list
Haskell-C...@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Karl Voelker  
View profile  
 More options Sep 14 2012, 2:06 am
From: Karl Voelker <ktvoel...@gmail.com>
Date: Thu, 13 Sep 2012 23:04:51 -0700
Local: Fri, Sep 14 2012 2:04 am
Subject: Re: [Haskell-cafe] What is the good way to work with list comprehension and UTCTime?

On Thu, Sep 13, 2012 at 10:29 PM, Magicloud Magiclouds <

magicloud.magiclo...@gmail.com> wrote:
> Hi,
>   Simple usage, I could make an instance of Enum to UTCTime, so
> [utcTime..] could work. But that is so stiff. How if sometimes I want
> to step by 1 min, sometimes I want to step by 1 sec?
>   So I think some way like [ t | addUTCTime last 60 ] could be nice.
> But I cannot figure it out....
>   Any idea?

Try using Prelude.iterate.

-Karl

_______________________________________________
Haskell-Cafe mailing list
Haskell-C...@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Roman Cheplyaka  
View profile  
 More options Sep 14 2012, 4:03 am
From: Roman Cheplyaka <r...@ro-che.info>
Date: Fri, 14 Sep 2012 10:03:01 +0200
Local: Fri, Sep 14 2012 4:03 am
Subject: Re: [Haskell-cafe] What is the good way to work with list comprehension and UTCTime?

Consider using the time-lens package.

  import Data.Time.Lens
  import Data.Lens.Common

List comprehension style:

  [modL seconds (+ fromIntegral n) t | n <- [0..]]
  [modL minutes (+ n) t | n <- [0..]]

(you need fromIntegral for seconds, because it is of fractional type in
Data.Time).

iterate style, as suggested by Karl:

  iterate (seconds ^+= 1) t
  iterate (minutes ^+= 1) t

On Fri, Sep 14, 2012 at 7:29 AM, Magicloud Magiclouds <

_______________________________________________
Haskell-Cafe mailing list
Haskell-C...@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Magicloud Magiclouds  
View profile  
 More options Sep 14 2012, 4:27 am
From: Magicloud Magiclouds <magicloud.magiclo...@gmail.com>
Date: Fri, 14 Sep 2012 16:25:58 +0800
Local: Fri, Sep 14 2012 4:25 am
Subject: Re: [Haskell-cafe] What is the good way to work with list comprehension and UTCTime?
This is nice. Thanks to all.

--
竹密岂妨流水过
山高哪阻野云飞

And for G+, please use magiclouds#gmail.com.

_______________________________________________
Haskell-Cafe mailing list
Haskell-C...@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris Heller  
View profile  
 More options Sep 14 2012, 1:16 pm
From: Chris Heller <hellert...@gmail.com>
Date: Fri, 14 Sep 2012 13:14:30 -0400
Local: Fri, Sep 14 2012 1:14 pm
Subject: Re: [Haskell-cafe] What is the good way to work with list comprehension and UTCTime?

You might want to have a look at the time-recurrence package:
http://hackage.haskell.org/package/time-recurrence

For your simple cases you would do something like:

Each second:

    starting (UTCTime ...) $ recur secondly

Each minute:

    starting (UTCTime ...) $ recur minutely

The rules can get quite a bit more complex than that.

I am the author of time-recurrence, so if you have questions feel free to
ping me.

-Chris

...

read more »

_______________________________________________
Haskell-Cafe mailing list
Haskell-C...@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Richard O'Keefe  
View profile  
 More options Sep 16 2012, 6:05 pm
From: "Richard O'Keefe" <o...@cs.otago.ac.nz>
Date: Mon, 17 Sep 2012 10:04:01 +1200
Local: Sun, Sep 16 2012 6:04 pm
Subject: Re: [Haskell-cafe] What is the good way to work with list comprehension and UTCTime?

On 15/09/2012, at 5:14 AM, Chris Heller wrote:

> You might want to have a look at the time-recurrence package: http://hackage.haskell.org/package/time-recurrence

> For your simple cases you would do something like:

> Each second:

>     starting (UTCTime ...) $ recur secondly

> Each minute:

>     starting (UTCTime ...) $ recur minutely

Ouch.  Look up "minutely" (my-NEWT-ly) in an English
dictionary.  Look up "secondly" while you're there.

_______________________________________________
Haskell-Cafe mailing list
Haskell-C...@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Antoine Latter  
View profile  
 More options Sep 16 2012, 7:16 pm
From: Antoine Latter <aslat...@gmail.com>
Date: Sun, 16 Sep 2012 18:14:06 -0500
Local: Sun, Sep 16 2012 7:14 pm
Subject: Re: [Haskell-cafe] What is the good way to work with list comprehension and UTCTime?

You can blame RFC 5545 for that one. In section 3.3.10. our frequencies are:

freq        = "SECONDLY" / "MINUTELY" / "HOURLY" / "DAILY"
                   / "WEEKLY" / "MONTHLY" / "YEARLY"

Antoine

_______________________________________________
Haskell-Cafe mailing list
Haskell-C...@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Heller Time  
View profile  
 More options Sep 16 2012, 8:35 pm
From: Heller Time <hellert...@gmail.com>
Date: Sun, 16 Sep 2012 20:34:40 -0400
Local: Sun, Sep 16 2012 8:34 pm
Subject: Re: [Haskell-cafe] What is the good way to work with list comprehension and UTCTime?
Antoine has it right, the language is lifted from the RFC.

Chris Heller
SAS - Advanced Analytics
Teragram Research & Development
phone: 1-617-576-6800 x54237
mobile: 1-617-460-3643
email: hel...@teragram.com

On Sep 16, 2012, at 7:14 PM, Antoine Latter <aslat...@gmail.com> wrote:

_______________________________________________
Haskell-Cafe mailing list
Haskell-C...@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Magicloud Magiclouds  
View profile  
 More options Sep 17 2012, 9:54 pm
From: Magicloud Magiclouds <magicloud.magiclo...@gmail.com>
Date: Tue, 18 Sep 2012 09:52:22 +0800
Local: Mon, Sep 17 2012 9:52 pm
Subject: Re: [Haskell-cafe] What is the good way to work with list comprehension and UTCTime?
Thank you. Will do.

--
竹密岂妨流水过
山高哪阻野云飞

And for G+, please use magiclouds#gmail.com.

_______________________________________________
Haskell-Cafe mailing list
Haskell-C...@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »