This has something to do with the Enum instance for NominalDiffTime:

    ghci> [0..2] :: [NominalDiffTime]
    ...

Appears to also diverge.  This works though:

    ghci> mapM_ putStrLn $ map (mkDated . fromIntegral) [0..2]
    2015-01-01T00:00:00Z
    2015-01-01T01:00:00Z
    2015-01-01T02:00:00Z


Ryan



On Sun, Jan 18, 2015 at 7:45 PM, mariopal <mariopal@gmail.com> wrote:
This code produces an infinite output... why? it's a bug in ghc?

> -- Glasgow Haskell Compiler, Version 7.6.3 on Debian Sid
> import System.Locale (defaultTimeLocale)
> import Data.Time
>
>
> mkDated n = formatTime defaultTimeLocale "%FT%TZ" $ addUTCTime (3600*n) $
UTCTime (fromGregorian 2015 1 1) (timeOfDayToTime $ TimeOfDay 0 0 0)
>
> main = mapM_ putStrLn $ map mkDated [0..2]


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