packages feed

Hs2lib-0.4.8: Tests/Src/Test_AdvancedListCall.hs

module Tests.Src.Test_AdvancedListCall where

-- @@ Export
summerize :: [Int] -> [Int] -> Int
summerize x y = sum $ x ++ y

-- @@ Export
single :: Int -> [Int]
single x = [1..x]

-- @@ Export
-- | Simple function to test higher-order
--   functions with lists.
ply :: Int -> (Int -> [Int] -> [Int]) -> Int
ply x f = summerize (f x []) (f x [])

-- @@ Export
unPly :: Int -> ([Int] -> Int) -> Int
unPly i f = f [i]