I am implementing a function with the following signature to solve the 0-1 knapsack problem in Haskell.
knapsack :: [Item] -> Capacity -> [Item]
Where the Item and Capacity files are defined as:
type Value = Int
type Weight = Int
type Capacity = Int
type Item = (Value, Weight)
I'd like to memoize it to have better performances. I tried to use Data.MemoCombinators but I can't get how to have it work.
Can you give me some hints?
ItemandCapacitytypes? This is necessary to define a memoization function for them.