我需要在 Haskell 中制作可乐自动售货机,但我遇到了一些问题。我不太了解Haskell,所以我不知道发生了什么
main = start
return()
start = do putStr "\nSelect a coin\n1. R$0,25\n2. R$0,50\n3. R$1,00\n"
coin <- getChar;
case coin of
1 -> twentyFive
2 -> fifty
3 -> dispensed
otherwise -> do putStr "Select a valid option"
start
twentyFive = do putStr "\nSelect a coin\n1. R$0,25\n2. R$0,50\n3. R$1,00\n"
coin <- getChar;
case coin of
1 -> fifty
2 -> seventyFive
3 -> dispensed
otherwise -> do putStr "Select a valid option"
twentyFive
fifty = do putStr "\nSelect a coin\n1. R$0,25\n2. R$0,50\n3. R$1,00\n"
coin <- getChar;
case coin of
1 -> seventyFive
2 -> dispensed
3 -> dispensed
otherwise -> do putStr "Select a valid option"
fifty
seventyFive = do putStr "\nSelect a coin\n1. R$0,25\n2. R$0,50\n3. R$1,00\n"
coin <- getChar;
case coin of
1 -> dispensed
2 -> dispensed
3 -> dispensed
otherwise -> do putStr "Select a valid option"
seventyFive
dispensed = do putStr "-- Coke Dispensed --"
return()
但我收到此错误:
Unresolved top-level overloading
*** Binding : seventyFive
*** Outstanding context : Num Char
这是什么意思?