fork download
  1. isPrime :: Integer -> Bool
  2. isPrime n = all (\i -> (n `rem` i) /= 0) $ takeWhile (\i -> i^2 <= n) [2..]
  3.  
  4. main :: IO ()
  5. main = do n <- readLn
  6. forM_ [1..n] $ \i ->
  7. putStrLn (show (i) ++ " is a prime? " ++ show (isPrime i))
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
20
compilation info
[1 of 1] Compiling Main             ( prog.hs, prog.o )

prog.hs:6:10: Not in scope: `forM_'
stdout
Standard output is empty