Permalink
Browse files

allow arbitrary (and return for non-positive) integers as argument of…

… . fixed by ahammar.
  • Loading branch information...
Sebastian Fischer
Sebastian Fischer committed Apr 29, 2011
1 parent 42e5fba commit c790609dbc7dd5517e0e343cb196c742de481d1e
Showing with 3 additions and 2 deletions.
  1. +2 −1 Data/Numbers/Primes.hs
  2. +1 −1 primes.cabal
View
@@ -59,7 +59,8 @@ wheelSieve k = reverse ps ++ map head (sieve p (cycle ns))
-- impractical for numbers with a very large smallest prime factor.
--
isPrime :: Integral int => int -> Bool
-isPrime n = n > 1 && primeFactors n == [n]
+isPrime n | n > 1 = primeFactors n == [n]
+ | otherwise = False
{-# SPECIALISE isPrime :: Int -> Bool #-}
{-# SPECIALISE isPrime :: Integer -> Bool #-}
View
@@ -1,5 +1,5 @@
Name: primes
-Version: 0.2.0.0
+Version: 0.2.1.0
Cabal-Version: >= 1.6
Synopsis: Efficient, purely functional generation of prime numbers
Description:

0 comments on commit c790609

Please sign in to comment.