You can adapt the answers to your previos similar questions for this case. Remember that a 3-tuple or triple (i.e. your type Costs) is just another data type. If there were no tuples in Haskell, you could write:
data Triple a b c = Triple a b c
and it would behave exactly as 3-tuples do! The only difference is that Hakell supports a more convenient syntax both for tuple expressions and tuple patterns.
Now for Patterns in general: Simplifying a bit, there are basicall 3 possibilities to write them:
- a literal (suitable only for data types that support this, like String, Int, etc.), matches only that value.
- a variable, matches any value
- a data constructor, applied to patterns. Matches values constructed with that data constructor where the subpatterns match.
Turns out that you already wrote correct patterns in your question:
i.e. (1,3,9) executes a different equation to (0,0,16)
hence
orders stuff (Farm p1 p2 p3 feed) (1,3,9) = some code here
orders stuff (Farm p1 p2 p3 feed) (0,0,16) = some other code here
It probably would help us to help you if we could understand what your specific issues with pattern matching is. i.e. why you couldn't just try to come up with that yourself, as it feels quite natural, does it not?