Merge branch 'master' of darcs.haskell.org:/srv/darcs//packages/base
[packages/base.git] / tests / enum04.hs
1 {-# LANGUAGE ScopedTypeVariables #-}
2 import Control.Exception
3
4 -- enumFrom on basic numeric types should be strict
5 -- (possibly a bug in the Haskell Report: it specifies that
6 -- these ops should be strict in the section on Enum, but the
7 -- sample code in the Prelude doesn't agree, at least for
8 -- Float and Double).
9
10 main = do
11 catch (evaluate [error "" :: Int ..] >> return ()) (\(e::SomeException) -> putStrLn "ok1")
12 catch (evaluate [error "" :: Integer ..] >> return ()) (\(e::SomeException) -> putStrLn "ok2")
13 catch (evaluate [error "" :: Float ..] >> return ()) (\(e::SomeException) -> putStrLn "ok3")
14 catch (evaluate [error "" :: Double ..] >> return ()) (\(e::SomeException) -> putStrLn "ok4")