我遇到了这个问题:
Couldn't match expected type ‘Int’ with actual type ‘Maybe Int’
Run Code Online (Sandbox Code Playgroud)
我可以以某种方式将'Maybe Int'转换为'Int'吗?
if index == Nothing
then
do
let index = 0
putStrLn(fancyPrint2 $ kaasasOlevList !! index)
else
do
let index = index
putStrLn(fancyPrint2 $ kaasasOlevList !! index)
Run Code Online (Sandbox Code Playgroud)
我试过这样,但这给了我:
Exception: <<loop>>
Run Code Online (Sandbox Code Playgroud)