Hs2lib-0.4.8: Tests/Src/Test_AdvancedListCallbacks.hs
module Tests.Src.Test_AdvancedListCallbacks 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 [])
data MyPly = MyPly { unPly :: Int -> [Int] -> [Int] }
-- @@ Export
myPly :: Int -> MyPly -> Int
myPly x m = summerize (unPly m x []) (unPly m x [])