{"provider_url":"https://hatena.blog","published":"2009-06-26 10:01:18","author_name":"zknx","blog_title":"zknx\u306e\u65e5\u8a18","height":"190","title":"hGetContents \u3068 hClose","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fzknx.hatenadiary.org%2Fentry%2F20090626%2F1245978078\" title=\"hGetContents \u3068 hClose - zknx\u306e\u65e5\u8a18\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","provider_name":"Hatena Blog","version":"1.0","width":"100%","type":"rich","author_url":"https://blog.hatena.ne.jp/zknx/","url":"https://zknx.hatenadiary.org/entry/20090626/1245978078","image_url":null,"description":"hGetContents \u306b\u6e21\u3057\u305f\u30cf\u30f3\u30c9\u30e9\u3092 hClose \u3059\u308b\u3068\u3001hGetContents \u306e\u7d50\u679c\u304c\u7a7a\u6587\u5b57\u5217\u306b\u306a\u308b\u3002 import IO (openFile, IOMode(ReadMode), hGetContents, hClose, bracket) f1 = do h <- openFile \"hoge.txt\" ReadMode s <- hGetContents h return s f2 = bracket (openFile \"hoge.txt\" ReadMode) (hClose) (hGetContents) main = do run \"f1\" f1 run \"f2\" \u2026","blog_url":"https://zknx.hatenadiary.org/","categories":["Haskell"]}