Code Review: Monad and run time error #3297
Replies: 1 comment 5 replies
-
The following is responded by ChatGPT The reason why Regarding the handling of |
Beta Was this translation helpful? Give feedback.
-
The following is responded by ChatGPT The reason why Regarding the handling of |
Beta Was this translation helpful? Give feedback.
-
In the following code, it will have run time error because
isBalancedWithHeight'
could return aNothing
, I did not tell the program what to do ifisBalancedWithHeight' l
orisBalancedWithHeight' r
isNothing
. (the comment part)I was puzzled why the following code wouldn't have a run time error as the previous code does
After enabling Haskell Language Server in vscode,
lh
andrh
be automatically inferred asInt
rather thanMabye Int
. Can anyone tell me why and how this code handle whenisBalancedWithHeight l
orisBalancedWithHeight r
returnNothing
?Beta Was this translation helpful? Give feedback.
All reactions