我有這樣的功能:轉換也許詮釋在一個複雜的函數爲int在Haskell
to_ref :: Idx -> Idx -> Idx -> Idx -> Mat El -> Mat El
to_ref cb ce rb re m
| cb <= ce && (find_non_null_row cb rb re m) == Nothing = (to_ref (cb+1) ce rb re m)
| cb <= ce && (find_non_null_row cb rb re m) /= Nothing = (elim_all cb rb re (find_non_null_row cb rb re m) m) : (to_ref (cb+1) ce rb re m)
| otherwise = m
在(elim_all cb rb re (find_non_null_row cb rb re m) m) : (to_ref (cb+1) ce rb re m)
,(find_non_null_row cb rb re m)
返回Maybe Int
類型值,但我需要它作爲Int
類型使我的工作。
我已經檢查了這個帖子,http://stackoverflow.com/questions/8905272/convert-maybe-int-to-int-in-haskell
,但我無法解決我的問題。
如何以最有效的方式將其轉換爲Int
?
可能的複製(http://stackoverflow.com/questions/8905272/convert-maybe-int [轉換也許詮釋在Haskell到INT] to-int-in-haskell) – jkeuhlen