I created this program to return a list of positions of a matrix that no has zero value.
This Code:
type Pos = (Int,Int)
type Matrix = [[Int]]
v0 [Pos]->Matrix->[Pos]
v0 [] m =[]
v0 [p:ps] m = if ((takeH m p) == 0) then v0 ps m
else p:v0 ps m
takeH:: Matrix->Pos->Int
takeH m (i,j)= (m!!(i-1))!!(j-1)
Produces this error:
Parse error on input '->'
Failed,modules loades: nome.
Why ?
I hope that I've been clear.
You need ::
before the type of a function.
-- vv here
v0 :: [Pos] -> Matrix -> [Pos]
v0 [] _ = []
-- v v also parenthesis, not square brackets
v0 (p:ps) m = if ((takeH m p) == 0) then v0 ps
else p:v0 ps