Skip to content

Instantly share code, notes, and snippets.

@tokiwoousaka
Created November 20, 2014 13:48
Show Gist options
  • Save tokiwoousaka/c9a073ddb7b64b65495a to your computer and use it in GitHub Desktop.
Save tokiwoousaka/c9a073ddb7b64b65495a to your computer and use it in GitHub Desktop.
f :: Maybe Int
f = do
x <- return 5
y <- return 3
return $ x + y
f' :: Maybe Int
f' = do
x <- return 5
Nothing --途中どこかでNothingが挟まると問答無用で結果はNothingになる
y <- return 3
return $ x + y
g :: [Int]
g = do
x <- [1,2,3]
y <- [10,11,20]
return $ x + y
g' :: [Int]
g' = do
x <- [1,2,3]
[] --途中どこかで空リストが挟まると問答無用で結果は空リスト
y <- [10,11,20]
return $ x + y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment