Mike Meyer schreef op 19-2-2015 om
8:25:
_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
Thanks,
1 remark.
You have to do this hanoi 1 start _ end = "move 1 disk from " ++
[start] ++ " to " ++ [end] ++ ".\n"
because in your code you get this error message :
*Main> main
[('a','c'),('a','b'),('c','b'),('a','c'),('b','a'),('b','c'),('a','c')]
*Main> :l hanoi
[1 of 1] Compiling Main ( hanoi.hs, interpreted )
hanoi.hs:4:24:
Couldn't match expected type ‘[Char]’ with actual type ‘Char’
In the second argument of ‘hanoi’, namely ‘'a'’
In the second argument of ‘($)’, namely ‘hanoi 3 'a' 'b' 'c'’
In the expression: print $ hanoi 3 'a' 'b' 'c'
hanoi.hs:4:28:
Couldn't match expected type ‘[Char]’ with actual type ‘Char’
In the third argument of ‘hanoi’, namely ‘'b'’
In the second argument of ‘($)’, namely ‘hanoi 3 'a' 'b' 'c'’
In the expression: print $ hanoi 3 'a' 'b' 'c'
hanoi.hs:4:32:
Couldn't match expected type ‘[Char]’ with actual type ‘Char’
In the fourth argument of ‘hanoi’, namely ‘'c'’
In the second argument of ‘($)’, namely ‘hanoi 3 'a' 'b' 'c'’
In the expression: print $ hanoi 3 'a' 'b' 'c'
Failed, modules loaded: none.
Prelude> :l hanoi
[1 of 1] Compiling Main ( hanoi.hs, interpreted )
hanoi.hs:4:25:
Couldn't match expected type ‘[Char]’ with actual type ‘Char’
In the second argument of ‘hanoi’, namely ‘'a'’
In the second argument of ‘($)’, namely ‘hanoi 3 'a' 'b' 'c'’
In the expression: putStr $ hanoi 3 'a' 'b' 'c'
hanoi.hs:4:29:
Couldn't match expected type ‘[Char]’ with actual type ‘Char’
In the third argument of ‘hanoi’, namely ‘'b'’
In the second argument of ‘($)’, namely ‘hanoi 3 'a' 'b' 'c'’
In the expression: putStr $ hanoi 3 'a' 'b' 'c'
hanoi.hs:4:33:
Couldn't match expected type ‘[Char]’ with actual type ‘Char’
In the fourth argument of ‘hanoi’, namely ‘'c'’
In the second argument of ‘($)’, namely ‘hanoi 3 'a' 'b' 'c'’
In the expression: putStr $ hanoi 3 'a' 'b' 'c'
Now I have to figure out how this works before I can work on the
optional exercise hanoi with 4 pegs.
Roelof