Last active
June 30, 2023 14:36
-
-
Save nobsun/da95ada94f5f7932a199381f63f13283 to your computer and use it in GitHub Desktop.
This file contains 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
module Main where | |
import System.Environment | |
import System.IO | |
main :: IO () | |
main = do | |
{ putStrLn =<< getProgName | |
; putStr "stdin : "; print =<< hGetBuffering stdin | |
; putStr "stdout: "; print =<< hGetBuffering stdout | |
; putStr "stderr: "; print =<< hGetBuffering stderr | |
} | |
{- GHCi で起動すると -- | |
>>> main | |
<interactive> | |
stdin : NoBuffering | |
stdout: NoBuffering | |
stderr: NoBuffering | |
-- -} | |
{- runghc で起動すると -- | |
$ runghc buffering_mode.hs | |
buffering_mode.hs | |
stdin : LineBuffering | |
stdout: NoBuffering | |
stderr: NoBuffering | |
-- -} | |
{- コンパイルして実行可能ファイルを起動すると -- | |
$ ghc buffering_mode.hs | |
$ ./buffering_mode | |
buffering_mode | |
stdin : LineBuffering | |
stdout: LineBuffering | |
stderr: NoBuffering | |
-- -} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment