You might want to have a look at the time-recurrence package: http://hackage.haskell.org/package/time-recurrence
Send Haskell-Cafe mailing list submissions to
haskell-cafe@haskell.org
To subscribe or unsubscribe via the World Wide Web, visit
http://www.haskell.org/mailman/listinfo/haskell-cafe
or, via email, send a message with subject or body 'help' to
haskell-cafe-request@haskell.org
You can reach the person managing the list at
haskell-cafe-owner@haskell.org
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Haskell-Cafe digest..."
Today's Topics:
1. Fwd: How Type inference work in presence of Functional
Dependencies (Dan Doel)
2. Re: [ANN] Cumino 0.2 - Now supports pretty indentation
through stylish-haskell (Brandon Allbery)
3. Re: [ANN] Cumino 0.2 - Now supports pretty indentation
through stylish-haskell (Alfredo Di Napoli)
4. ANNOUNCE: Groundhog 0.1.0.1 - high-level database library
(Boris Lykah)
5. Re: ANNOUNCE: Groundhog 0.1.0.1 - high-level database library
(Tom Murphy)
6. Re: Either Monad and Laziness (wren ng thornton)
7. How do I generate random numbers using random-fu, with
platform-agnostic code? (Andrew Pennebaker)
8. Is Hackage down? (C K Kashyap)
9. Re: Is Hackage down? (damodar kulkarni)
10. What is the good way to work with list comprehension and
UTCTime? (Magicloud Magiclouds)
11. Re: What is the good way to work with list comprehension and
UTCTime? (Karl Voelker)
12. Re: [ANN] Cumino 0.2 - Now supports pretty indentation
through stylish-haskell (Alfredo Di Napoli)
13. Re: Is Hackage down? (John Wiegley)
14. Re: [ANN] Cumino 0.2 - Now supports pretty indentation
through stylish-haskell (Alfredo Di Napoli)
15. Re: What is the good way to work with list comprehension and
UTCTime? (Roman Cheplyaka)
16. Re: What is the good way to work with list comprehension and
UTCTime? (Magicloud Magiclouds)
----------------------------------------------------------------------
Message: 1
Date: Thu, 13 Sep 2012 10:44:17 -0400
From: Dan Doel <dan.doel@gmail.com>
Subject: [Haskell-cafe] Fwd: How Type inference work in presence of
Functional Dependencies
To: Haskell Caf? List <haskell-cafe@haskell.org>
Message-ID:
<CAHEA9tPsGTUX4Ke9eGCpA+-f_b_Ky9--y6RZkHPAmN9LW8MxHA@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
Copying the mailing list, because I forgot.
On Thu, Sep 13, 2012 at 5:18 AM, satvik chauhan <mystic.satvik@gmail.com> wrote:
> Consider the code below :
>
> {-# LANGUAGE
> MultiParamTypeClasses,FlexibleInstances,FunctionalDependencies,UndecidableInstances,FlexibleContexts
> #-}
> class Foo a c | a -> c
> instance Foo Int Float
> f :: (Foo Int a) => Int -> a
> f = undefined
>
> Now when I see the inferred type of f in ghci
>
>> :t f
>
>> f :: Int -> Float
>
> Now If I add the following code
>
> g :: Int -> Float
> g = undefined
>
> h :: (Foo Int a) => Int -> a
> h = g
>
>
> I get the error
>
> Could not deduce (a ~ Float)
>
>
> I am not able to understand what has happened here ? The restriction "Foo
> Int a" should have restricted the type of h to "Int -> Float" as shown in
> the inferred type of f.
The answer, I believe, is that the difference between the fundep
implementation and type families is local constraint information.
Fundeps do no local propagation.
So in your first definition, you've locally provided 'Int -> a', which
is acceptable to GHC. Then it figures out externally to the function
that '(Foo Int a) => Int -> a' is actually Int -> Float.
In the second definition, you're trying to give 'Int -> Float', but
GHC only knows locally that you need to provide 'Int -> a' with a
constraint 'Foo Int a' which it _won't_ use to determine that a ~
Float.
This is not inherent to fundeps. One could make a version of fundeps
that has the local constraint rules (easily so by translating to the
new type families stuff). But, the difference is also the reason that
overlapping instances are supported for fundeps and not type families.
But I won't get into that right now.
-- Dan
------------------------------
Message: 2
Date: Thu, 13 Sep 2012 11:20:51 -0400
From: Brandon Allbery <allbery.b@gmail.com>
Subject: Re: [Haskell-cafe] [ANN] Cumino 0.2 - Now supports pretty
indentation through stylish-haskell
To: Alfredo Di Napoli <alfredo.dinapoli@gmail.com>
Cc: Ray <i@maskray.tk>, haskell-cafe <haskell-cafe@haskell.org>
Message-ID:
<CAKFCL4WAtx6R0NVtP7nxnj1ZFp=KHDx1dGeO-s9EsG4H9nMsvQ@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
On Thu, Sep 13, 2012 at 2:22 AM, Alfredo Di Napoli <
alfredo.dinapoli@gmail.com> wrote:
> urxvtc -e sh -c 'echo a'
>> xterm -e echo a
>>
>
> I would like to, and in fact I've already tried, but urxvt is trickier
> than other shells. Using the command you gave me does not create a new
> window, tested both on XMonad and Gnome. This is
> the error you can see using the option "-hold", this way:
>
> urxvt --hold -e "echo a"
>
> This opens a new window with the error: *urxvt: Unable to exec child.
> *
>
I think you misunderstood; as I read it (and as I would expect it to work
given the above descrtiption) that would be
urxvt --hold -e sh -c 'echo a'
--
brandon s allbery allbery.b@gmail.com
wandering unix systems administrator (available) (412) 475-9364 vm/sms
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120913/76483291/attachment-0001.htm>
------------------------------
Message: 3
Date: Thu, 13 Sep 2012 18:16:06 +0200
From: Alfredo Di Napoli <alfredo.dinapoli@gmail.com>
Subject: Re: [Haskell-cafe] [ANN] Cumino 0.2 - Now supports pretty
indentation through stylish-haskell
To: haskell-cafe <haskell-cafe@haskell.org>
Message-ID: <20120913161604.GA31344@gmail.com>
Content-Type: text/plain; charset=utf-8
If I remember correctly, I've also tried that combinations, without success.
Anyway, I'm not at work so I can't test Cumino against gnome and Xmonad
until tomorrow morning: I'll keep you posted!
Bye,
Alfredo
>
> I think you misunderstood; as I read it (and as I would expect it to work
> given the above descrtiption) that would be
>
> urxvt --hold -e sh -c 'echo a'
>
> --
> brandon s allbery allbery.b@gmail.com
> wandering unix systems administrator (available) (412) 475-9364 vm/sms
------------------------------
Message: 4
Date: Thu, 13 Sep 2012 21:23:09 +0300
From: Boris Lykah <lykahb@gmail.com>
Subject: [Haskell-cafe] ANNOUNCE: Groundhog 0.1.0.1 - high-level
database library
To: haskell-cafe@haskell.org
Message-ID:
<CADgh=y_wwN0-AwWjoMBvERY0XpgByCoMeuxZ1SegVKXinRV4-A@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
I am happy to announce a new version of Groundhog, a library for fast
high-level database access:
http://hackage.haskell.org/package/groundhog
http://hackage.haskell.org/package/groundhog-th
http://hackage.haskell.org/package/groundhog-postgresql
http://hackage.haskell.org/package/groundhog-sqlite
Groundhog has been completely overhauled since the last release.
Notably, it got support for PostgreSQL and natural foreign keys. I
believe that it is a big step forward as this brings more flexibility
to the design of the relational schemas while keeping the applications
independent of the storage layer. Some of the solutions, particularly
schema migration were based on Persistent code.
Please see examples at http://github.com/lykahb/groundhog/tree/master/examples.
Features:
* Support for Sqlite and PostgreSQL.
* Natural and composite foreign keys. Earlier it was possible to
reference an entity only by the mandatory integer primary key. Now an
entity can have several keys including autoincrement primary key
(optional) and unique keys which have one or more columns.
* Full support of embedded datatypes. You can access a field that
contains an embedded datatype as a whole, or access some of the inner
subfields individually. This powerful mechanism has allowed
implementation of the composite keys, and can be used in future to
work with PostgreSQL composite types or MongoDB embedded documents.
Instead of serializing value to string, the Groundhog backends flatten
tree of embedded datatypes to db columns.
* Projections. You can choose what columns to query from a table in a
type-safe manner.
* Initialization and migration of database schema.
* Sum types and polymorphic types.
* Expression DSL for use in queries.
* Basic list support.
* YAML-based settings mechanism. It separates datatype definition and
description which facilitates modularity. The settings are inferred
from the analysis of the difinition, and overridden with values set by
user.
The Criterion benchmarks are available at
http://lykahb.github.com/groundhog/SqliteBench.html and
http://lykahb.github.com/groundhog/PostgreSQLBench.html.
Future plans:
* Support for joins
* Database indexes
* Investigate options for implementing MongoDB and MySQL backends
Your feedback, suggestions for improvement and criticism are welcome.
--
Regards,
Boris
------------------------------
Message: 5
Date: Thu, 13 Sep 2012 18:28:34 -0400
From: Tom Murphy <amindfv@gmail.com>
Subject: Re: [Haskell-cafe] ANNOUNCE: Groundhog 0.1.0.1 - high-level
database library
To: Boris Lykah <lykahb@gmail.com>
Cc: haskell-cafe@haskell.org
Message-ID:
<CAO9Q0tU187QkJL5UHyL3A6WvQpOhPWHHTHrMeoWYhOTcWEzHqg@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
How does this compare with other high-level Haskell db libraries?
Tom
On Sep 13, 2012 2:25 PM, "Boris Lykah" <lykahb@gmail.com> wrote:
> I am happy to announce a new version of Groundhog, a library for fast
> high-level database access:
> http://hackage.haskell.org/package/groundhog
> http://hackage.haskell.org/package/groundhog-th
> http://hackage.haskell.org/package/groundhog-postgresql
> http://hackage.haskell.org/package/groundhog-sqlite
>
> Groundhog has been completely overhauled since the last release.
> Notably, it got support for PostgreSQL and natural foreign keys. I
> believe that it is a big step forward as this brings more flexibility
> to the design of the relational schemas while keeping the applications
> independent of the storage layer. Some of the solutions, particularly
> schema migration were based on Persistent code.
>
> Please see examples at
> http://github.com/lykahb/groundhog/tree/master/examples.
>
> Features:
> * Support for Sqlite and PostgreSQL.
> * Natural and composite foreign keys. Earlier it was possible to
> reference an entity only by the mandatory integer primary key. Now an
> entity can have several keys including autoincrement primary key
> (optional) and unique keys which have one or more columns.
> * Full support of embedded datatypes. You can access a field that
> contains an embedded datatype as a whole, or access some of the inner
> subfields individually. This powerful mechanism has allowed
> implementation of the composite keys, and can be used in future to
> work with PostgreSQL composite types or MongoDB embedded documents.
> Instead of serializing value to string, the Groundhog backends flatten
> tree of embedded datatypes to db columns.
> * Projections. You can choose what columns to query from a table in a
> type-safe manner.
> * Initialization and migration of database schema.
> * Sum types and polymorphic types.
> * Expression DSL for use in queries.
> * Basic list support.
> * YAML-based settings mechanism. It separates datatype definition and
> description which facilitates modularity. The settings are inferred
> from the analysis of the difinition, and overridden with values set by
> user.
>
> The Criterion benchmarks are available at
> http://lykahb.github.com/groundhog/SqliteBench.html and
> http://lykahb.github.com/groundhog/PostgreSQLBench.html.
>
> Future plans:
> * Support for joins
> * Database indexes
> * Investigate options for implementing MongoDB and MySQL backends
>
> Your feedback, suggestions for improvement and criticism are welcome.
>
> --
> Regards,
> Boris
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120913/96747b7d/attachment-0001.htm>
------------------------------
Message: 6
Date: Fri, 14 Sep 2012 01:29:32 +0200
From: wren ng thornton <wren@freegeek.org>
Subject: Re: [Haskell-cafe] Either Monad and Laziness
To: haskell-cafe@haskell.org
Message-ID: <50526C5C.40506@freegeek.org>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
On 9/12/12 5:37 PM, Francesco Mazzoli wrote:
> At Wed, 12 Sep 2012 12:04:31 -0300,
> Eric Velten de Melo wrote:
>> It would be really awesome, though, if it were possible to use a
>> parser written in Parsec with this, in the spirit of avoiding code
>> rewriting and enhancing expressivity and abstraction.
>
> There is <http://hackage.haskell.org/package/attoparsec-conduit> and
> <http://hackage.haskell.org/package/attoparsec-enumerator>, which turn
> attoparsec parsers into enumerators/conduits, and
> <http://hackage.haskell.org/package/attoparsec-parsec>, which is a compatibility
> layer between attoaparsec and parsec. Good luck :).
Not to mention attoparsec-iteratee, for the iteratee minded folks:
http://hackage.haskell.org/package/attoparsec-iteratee
--
Live well,
~wren
------------------------------
Message: 7
Date: Thu, 13 Sep 2012 20:04:49 -0400
From: Andrew Pennebaker <andrew.pennebaker@gmail.com>
Subject: [Haskell-cafe] How do I generate random numbers using
random-fu, with platform-agnostic code?
To: Haskell Cafe <haskell-cafe@haskell.org>
Message-ID:
<CAHXt_SUvif47+r1gV32hKoQTQCw1yfv2i=DYKggntLViDxnXUA@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
I can't figure out how to use Data.Random.Source.IO to generate random
numbers in a multiplatform way.
I can generate random numbers in Unix using Data.Random.Source.DevRandom,
and there is an example in the GitHub documentation for Windows using
Data.Random.Source.MWC, but there is no example code for using
Data.Random.Source.IO.
Cheers,
Andrew Pennebaker
www.yellosoft.us
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120913/f63ed3f0/attachment-0001.htm>
------------------------------
Message: 8
Date: Fri, 14 Sep 2012 10:33:40 +0530
From: C K Kashyap <ckkashyap@gmail.com>
Subject: [Haskell-cafe] Is Hackage down?
To: Haskell Cafe <haskell-cafe@haskell.org>
Message-ID:
<CAGdT1gpVt10WoEkOr8tSiunOxfaPN4rk5V2KskAufztcqSa6Cw@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
Is it just me or is Hackage indeed been going down more frequently of late?
Regards,
Kashyap
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120914/14dde1d2/attachment-0001.htm>
------------------------------
Message: 9
Date: Fri, 14 Sep 2012 10:38:55 +0530
From: damodar kulkarni <kdamodar2000@gmail.com>
Subject: Re: [Haskell-cafe] Is Hackage down?
To: C K Kashyap <ckkashyap@gmail.com>
Cc: Haskell Cafe <haskell-cafe@haskell.org>
Message-ID:
<CAD5Hsyoxt-BqeBOXthp4YA_xm=+A0tc-27TKS7CcYYfyrOF1AA@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
It shows hackage down:
http://www.downforeveryoneorjustme.com/http://hackage.haskell.org/
- damodar
On Fri, Sep 14, 2012 at 10:33 AM, C K Kashyap <ckkashyap@gmail.com> wrote:
> Is it just me or is Hackage indeed been going down more frequently of late?
>
> Regards,
> Kashyap
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120914/c42a51b2/attachment-0001.htm>
------------------------------
Message: 10
Date: Fri, 14 Sep 2012 13:29:52 +0800
From: Magicloud Magiclouds <magicloud.magiclouds@gmail.com>
Subject: [Haskell-cafe] What is the good way to work with list
comprehension and UTCTime?
To: haskell-cafe <haskell-cafe@haskell.org>
Message-ID:
<CABErt4f8iN5Ozv7_dbTPDn6ZVp=4ghf+bcm8f72O1RifBJnLpA@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8
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.
------------------------------
Message: 11
Date: Thu, 13 Sep 2012 23:04:51 -0700
From: Karl Voelker <ktvoelker@gmail.com>
Subject: Re: [Haskell-cafe] What is the good way to work with list
comprehension and UTCTime?
To: Magicloud Magiclouds <magicloud.magiclouds@gmail.com>
Cc: haskell-cafe <haskell-cafe@haskell.org>
Message-ID:
<CAFfow0zQc43kEgZkVdsD9Wr6PZJfEoLajPdiCRG5cjbEfOarFg@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
On Thu, Sep 13, 2012 at 10:29 PM, Magicloud Magiclouds <
magicloud.magiclouds@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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120913/5ab286e4/attachment-0001.htm>
------------------------------
Message: 12
Date: Fri, 14 Sep 2012 06:14:11 +0000
From: Alfredo Di Napoli <alfredo.dinapoli@gmail.com>
Subject: Re: [Haskell-cafe] [ANN] Cumino 0.2 - Now supports pretty
indentation through stylish-haskell
To: haskell-cafe <haskell-cafe@haskell.org>
Message-ID:
<CAFqA6+X-0LTOir4i+oOGqiu64cqR_ayrgGnj-P+K2V+FrUcOJw@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Ok, I've added the support for urxvt.
Bear in mind that it partially support urxvt, though: it works fine if you
run GVim or Vim outside an already running tmux session, otherwise it won't
start.
The problem is due to the fact urxvt believes that the new session is
launched within the running tmux session, whining about nested tmux session
and not starting at all.
You can unset the $TERM variable as workaround, but I don't like that
apporach.
If you come up with an alternative solution please let me know :)
A.
On 13 September 2012 16:16, Alfredo Di Napoli <alfredo.dinapoli@gmail.com>wrote:
> If I remember correctly, I've also tried that combinations, without
> success.
>
> Anyway, I'm not at work so I can't test Cumino against gnome and Xmonad
> until tomorrow morning: I'll keep you posted!
>
> Bye,
> Alfredo
>
> >
> > I think you misunderstood; as I read it (and as I would expect it to work
> > given the above descrtiption) that would be
> >
> > urxvt --hold -e sh -c 'echo a'
> >
> > --
> > brandon s allbery
> allbery.b@gmail.com
> > wandering unix systems administrator (available) (412) 475-9364vm/sms
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120914/34645cae/attachment-0001.htm>
------------------------------
Message: 13
Date: Fri, 14 Sep 2012 01:21:03 -0500
From: "John Wiegley" <johnw@newartisans.com>
Subject: Re: [Haskell-cafe] Is Hackage down?
To: haskell-cafe@haskell.org
Message-ID: <m2k3vx86r4.fsf@newartisans.com>
Content-Type: text/plain
>>>>> C K Kashyap <ckkashyap@gmail.com> writes:
> Is it just me or is Hackage indeed been going down more frequently of late?
It's not just you.
------------------------------
Message: 14
Date: Fri, 14 Sep 2012 06:50:07 +0000
From: Alfredo Di Napoli <alfredo.dinapoli@gmail.com>
Subject: Re: [Haskell-cafe] [ANN] Cumino 0.2 - Now supports pretty
indentation through stylish-haskell
To: haskell-cafe <haskell-cafe@haskell.org>
Message-ID:
<CAFqA6+WT-0Wfv=7DcvBbNuBzxk7tDkcaaf8ERD78q4VucqGGtA@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Sorry the typo, the variable is $TMUX and controls the nesting ot tmux
session. It turns out that if affect not only urxvt but also xterm and
gnome-terminal.
Perhaps it could be useful to unset it programmatically, I'll keep you
posted if I find a workaround.
A.
On 14 September 2012 06:14, Alfredo Di Napoli <alfredo.dinapoli@gmail.com>wrote:
> Ok, I've added the support for urxvt.
> Bear in mind that it partially support urxvt, though: it works fine if you
> run GVim or Vim outside an already running tmux session, otherwise it won't
> start.
> The problem is due to the fact urxvt believes that the new session is
> launched within the running tmux session, whining about nested tmux session
> and not starting at all.
> You can unset the $TERM variable as workaround, but I don't like that
> apporach.
> If you come up with an alternative solution please let me know :)
> A.
>
>
> On 13 September 2012 16:16, Alfredo Di Napoli <alfredo.dinapoli@gmail.com>wrote:
>
>> If I remember correctly, I've also tried that combinations, without
>> success.
>>
>> Anyway, I'm not at work so I can't test Cumino against gnome and Xmonad
>> until tomorrow morning: I'll keep you posted!
>>
>> Bye,
>> Alfredo
>>
>> >
>> > I think you misunderstood; as I read it (and as I would expect it to
>> work
>> > given the above descrtiption) that would be
>> >
>> > urxvt --hold -e sh -c 'echo a'
>> >
>> > --
>> > brandon s allbery
>> allbery.b@gmail.com
>> > wandering unix systems administrator (available) (412) 475-9364vm/sms
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120914/0b8897fd/attachment-0001.htm>
------------------------------
Message: 15
Date: Fri, 14 Sep 2012 10:03:01 +0200
From: Roman Cheplyaka <roma@ro-che.info>
Subject: Re: [Haskell-cafe] What is the good way to work with list
comprehension and UTCTime?
To: Magicloud Magiclouds <magicloud.magiclouds@gmail.com>
Cc: haskell-cafe <haskell-cafe@haskell.org>
Message-ID:
<CAD+QkRoxe0TuwrO3VayE78emfVFFz_rv1RdE+oaX1xanpqpyKg@mail.gmail.com>
Content-Type: text/plain; charset="gb2312"
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 <
magicloud.magiclouds@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?
> --
> ???????
> ???????
>
> And for G+, please use magiclouds#gmail.com.
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120914/067fc717/attachment-0001.htm>
------------------------------
Message: 16
Date: Fri, 14 Sep 2012 16:25:58 +0800
From: Magicloud Magiclouds <magicloud.magiclouds@gmail.com>
Subject: Re: [Haskell-cafe] What is the good way to work with list
comprehension and UTCTime?
To: Roman Cheplyaka <roma@ro-che.info>
Cc: haskell-cafe <haskell-cafe@haskell.org>
Message-ID:
<CABErt4fEAnEaFjhSjbYDMX7y0jJJkCO8WAq-ToXjGc5xRtGg4A@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8
This is nice. Thanks to all.
On Fri, Sep 14, 2012 at 4:03 PM, Roman Cheplyaka <roma@ro-che.info> wrote:
> 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
> <magicloud.magiclouds@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?
>> --
>> ???????
>> ???????
>>
>> And for G+, please use magiclouds#gmail.com.
>>
>> _______________________________________________
>> Haskell-Cafe mailing list
>> Haskell-Cafe@haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
--
???????
???????
And for G+, please use magiclouds#gmail.com.
------------------------------
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
End of Haskell-Cafe Digest, Vol 109, Issue 19
*********************************************