You just need some parentheses and to fix your pattern matching:
calcPolynom _ (Polynom []) = 0.0
calcPolynom n (Polynom (h:ts)) = h + n * ???
I left a blank for you to fill in at the ???
, you'll have to figure out what should go there instead of what you have right now. The reason why is that you can't multiply a value of type Double
with a value of type Polynom
, but you could write this recursively (I'm assuming that was your original intention).
When you have code like
calcPolynom n Polynom [h:ts] = ...
The compiler sees that calcPolynom
has 3 arguments and Polynom
has none, you use parentheses for grouping.