summaryrefslogtreecommitdiff
path: root/testsuite/tests/perf/compiler/InfiniteListFusion.hs
blob: 5bfd9d7122f9770e648259d54238b21604959f83 (plain)
1
2
3
4
5
6
7
8
9
module Main where

import qualified GHC.Data.List.Infinite as Inf

main :: IO ()
main = print $ sum $ take (2^16) $ Inf.toList $ Inf.filter isEven $ Inf.iterate succ (0 :: Int)

isEven :: Integral a => a -> Bool
isEven n = 0 == mod n 2