Suppose I have a function that takes some input structure and returns some output structure (which may be related to the input structure, but different from it).
I don't want these I / O structures to be bound to a specific type, I just want to make sure that they have several behaviors that I need.
Should I?
a) Define a class that has the appropriate extraction methods and force the input to be an instance of this class? OR
b) Ask the function to accept another parameter, which is the function (s) that determines how to retrieve the data.
Also, I have the same question for output structures (except that the required functionality is a mutation)?
design design-patterns haskell
Clinton
source share