type Cplex = (String,Float,Float)
makeRec :: Float -> Float -> Cplex
makeRec a b = ("R",a,b)
makePol :: Float -> Float -> Cplex
makePol r v
| v > 2pi = error "v is not in interval"
| v < (-2)pi = error "v is not in interval"
| v < 0 = ("P",r(cos (v+2pi)),r*(sin (v+2pi)))
| otherwise = ("P",r(cos v),r*(sin v))
Here it is properly idented and without Unicode. First error GHC throws at me is:
prova.hs:10:20: error:
ā¢ Couldn't match expected type āFloat -> Floatā
with actual type āFloatā
ā¢ The function ārā is applied to one value argument,
but its type āFloatā has none
In the expression: r (cos (v + 2 pi))
In the expression: ("P", r (cos (v + 2 pi)), r * (sin (v + 2 pi)))
|
10 | | v < 0 = ("P",r(cos (v+2pi)),r*(sin (v+2pi)))
| ^^^^^^^^^^^^^^
And indeed r
is a Float
. So what are you trying to do with r(cos (v+2pi))
? @minimoll you need to learn how to heed the compiler and simple exercises like these will become a breeze.