I am trying to make a program that solves the tower of hanoi. I made it a bit complicated just for exercise:
hanoi :: [Int] -> String
hanoi n
| n > 0 = hanoi' n "1" "2" "3"
where hanoi' n a b c
| n == 0 = "|"
| otherwise = let pre = hanoi' (n-1) a c b
posle = hanoi' (n-1) b c a
in pre ++ a ++ " ~~> " ++ c ++ posle
| otherwise = "Number must be greater than 0!!!"
But i get:
hanoi.hs:7:97: parse error on input ‘=’
Can someone please explain to me what is going on? I see now that i don't understand an important part of the language.