module Solutions.P39 (primesR, primes) where
import qualified Solutions.Arithmetic as Arithmetic
primesR :: Integral a => a -> a -> [a]
primesR :: forall a. Integral a => a -> a -> [a]
primesR a
lo a
hi = (a -> Bool) -> [a] -> [a]
forall a. (a -> Bool) -> [a] -> [a]
takeWhile (a -> a -> Bool
forall a. Ord a => a -> a -> Bool
<= a
hi) ([a] -> [a]) -> [a] -> [a]
forall a b. (a -> b) -> a -> b
$ (a -> Bool) -> [a] -> [a]
forall a. (a -> Bool) -> [a] -> [a]
dropWhile (a -> a -> Bool
forall a. Ord a => a -> a -> Bool
< a
lo) [a]
forall a. Integral a => [a]
primes
primes :: Integral a => [a]
primes :: forall a. Integral a => [a]
primes = [a]
forall a. Integral a => [a]
Arithmetic.primes