menu

arrow_back Why shows oshibku? like all true? and how to fix?

by
1 vote
Good day!
Shows error requires let and how to fix?
The program not entirely ,the problem is in the validation block to enter letters
In this part of the validation block letters and block check digits are the same but digital does not swear,and the validation block letters arguing..

1 Answer

by
 
Best answer
0 votes
Move the Declaration and definition of f-functions in their proper place.
main = do
putStrLn "Start point: "
start <- getArg
putStrLn "End point: "
end <- getArg
putStrLn "Max cost: "
costStr <- getArgNum
let cost = read costStr :: Double
mapM_ putStr $ astar graph1 start end cost
putStrLn " "
----------------CHECK BUKVI--------
getArg :: IO String -- И так все что ниже
getArg = do
line <- getLine


Но у тебя там еще другие проблемы.
getArgNum ...
getArgNum :: IO Double
getArgNum = do
line <- getLine
if numOk line
then return (read line :: Double)
else do
putStrLn "Please input a proper number:"
getArgNum -- У тебя было getArg


costStr <- getArg -- у тебя было getArgNum
let cost = read costStr :: Double