Reputation: 1
Im getting parse error on my if then else statement and I dont understand why. I have checked the functions, and as far as I can tell all of them are getting the arguments they need, so I dont understand why this is happening. Im very new to haskell so help in understanding this would be deeply appreciated.
replace :: [(Int,Int)] -> String -> String
replace xs ys = if translate (manipulator (fst (convert xs)) (snd (convert xs)) ys) /= ""
then take (fst (convert xs)) ys ++ (manipulator (fst (convert xs)) (snd (convert xs)) ys) ++ drop (snd (convert xs)) ys
else take (fst (convert xs)) ys ++ stjerner (snd (convert xs) - fst (convert xs)) ++ drop (snd (convert (xs)) ys
--get parse error here, see picture.
stjerner :: Int -> String
stjerner 0 = ""
stjerner int | int > 0 = "*" ++ stjerner (int -1)
manipulator:: Int -> Int -> String -> String
manipulator low high xs = take high (drop low xs)
convert :: [a] -> a
convert [a] = a
Upvotes: 0
Views: 148
Reputation: 14025
The last expression in you else
clause --- drop (snd (convert (xs)) ys
-- is misparenthesized. You've got 3 open parens but only 2 close parens. I think you meant drop (snd (convert xs)) ys
.
Upvotes: 1