https://github.com/Helium4Haskell/lvm
Raw File
Tip revision: 3ceeb230e21c5f315c786bef5bb84f4dc497dfa7 authored by Mias van Klei on 08 August 2020, 08:15:11 UTC
Lvm.Core: fix pretty printing of annotations, export ptypeconstraints in Parser
Tip revision: 3ceeb23
Sieve.hs
module Main where 


import Win32 (timeGetTime)

tickCount :: IO Int
tickCount = do{ t <- timeGetTime
              ; return (fromIntegral t)
              }

main  = do{ t1 <- tickCount
          ; let n = last (take 1000 primes)
          ; t2 <- seq n tickCount
          ; putStr $ "running time: " ++ show (t2 - t1) ++ " msecs.\n"
          }


-- main    = print (last (take 1000 primes))

primes  = sieve [3,5..]
        where
          sieve (x:xs)  = x:sieve (filter (noDiv x) xs)
          noDiv x y     = (y `mod` x /= 0)
back to top