-
-
Save zakky-dev/5729559 to your computer and use it in GitHub Desktop.
Haskellの遅延評価がわからない。
これの実行結果 before
testBEFORE
after
AFTER
after
AFTER なんでこうなるの……。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.Char | |
main = do | |
contents <- getContents | |
putStr "test" | |
putStr $ map toUpper contents |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
結論
実行環境の問題でした。
Linuxのターミナルにて実行した場合、そちらでバッファされてしまうためプログラムが関与できないらしい。