{- | Description: Range of integers Copyright: Copyright (C) 2021 Yoo Chung License: GPL-3.0-or-later Maintainer: dev@chungyc.org Some solutions to "Problems.P22" of Ninety-Nine Haskell "Problems". -} module Solutions.P22 (range) where -- | Create a list containing all integers within a given range. range :: Int -> Int -> [Int] range :: Int -> Int -> [Int] range Int m Int n = (Int -> Bool) -> [Int] -> [Int] forall a. (a -> Bool) -> [a] -> [a] takeWhile (Int n >=) ([Int] -> [Int]) -> [Int] -> [Int] forall a b. (a -> b) -> a -> b $ (Int -> Int) -> Int -> [Int] forall a. (a -> a) -> a -> [a] iterate (Int 1 +) Int m