小编Fie*_*nko的帖子

Haskell也许类型 - >类型

我遇到了这个问题:

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)

haskell maybe

2
推荐指数
2
解决办法
420
查看次数

标签 统计

haskell ×1

maybe ×1