
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
On Fri, Sep 14, 2012 at 6:00 AM,
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
Subject: [Haskell-cafe] Fwd: How Type inference work in presence of Functional Dependencies To: Haskell Caf? List 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
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
Subject: Re: [Haskell-cafe] [ANN] Cumino 0.2 - Now supports pretty indentation through stylish-haskell To: Alfredo Di Napoli Cc: Ray , haskell-cafe Message-ID: 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