From 299ff4b563f844cdcd3007fa10a4067879b0236e Mon Sep 17 00:00:00 2001 From: Chris Done Date: Thu, 29 Sep 2016 09:50:17 +0200 Subject: [PATCH 1/2] Strict handling of UTF8 files (fixes fd issue) --- src/System/IO/UTF8.hs | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/src/System/IO/UTF8.hs b/src/System/IO/UTF8.hs index fe2788f4d7..a69dded993 100644 --- a/src/System/IO/UTF8.hs +++ b/src/System/IO/UTF8.hs @@ -2,24 +2,13 @@ module System.IO.UTF8 where import Prelude.Compat -import System.IO ( IOMode(..) - , hGetContents - , hSetEncoding - , hClose - , hPutStr - , openFile - , utf8 - ) +import qualified Data.ByteString as BS +import qualified Data.ByteString.UTF8 as UTF8 readUTF8File :: FilePath -> IO String readUTF8File inFile = do - h <- openFile inFile ReadMode - hSetEncoding h utf8 - hGetContents h + fmap UTF8.toString (BS.readFile inFile) writeUTF8File :: FilePath -> String -> IO () writeUTF8File inFile text = do - h <- openFile inFile WriteMode - hSetEncoding h utf8 - hPutStr h text - hClose h + BS.writeFile inFile (UTF8.fromString text) From d6db416f3b80e74ea475bd42e6cc8313b14fae3d Mon Sep 17 00:00:00 2001 From: Chris Done Date: Thu, 29 Sep 2016 18:27:31 +0200 Subject: [PATCH 2/2] Update CONTRIBUTORS.md --- CONTRIBUTORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index fe5f27dc6f..5f0f220523 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -18,6 +18,7 @@ This file lists the contributors to the PureScript compiler project, and the ter - [@bsermons](https://github.com/bsermons) (Brian Sermons) My existing contributions and all future contributions until further notice are Copyright Brian Sermons, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT). - [@cdepillabout](https://github.com/cdepillabout) (Dennis Gosnell) My existing contributions and all future contributions until further notice are Copyright Dennis Gosnell, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT). - [@charleso](https://github.com/charleso) (Charles O'Farrell) My existing contributions to the PureScript compiler and all future contributions to the PureScript compiler until further notice, are Copyright Charles O'Farrell, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT). +- [@chrisdone](https://github.com/chrisdone) (Chris Done) - My existing contributions and all future contributions until further notice are Copyright Chris Done, and are licensed to the owners and users of the PureScript compiler project under the terms of the MIT license. - [@chrissmoak](https://github.com/chrissmoak) (Chris Smoak) My existing contributions to the PureScript compiler and all future contributions to the PureScript compiler until further notice, are Copyright Chris Smoak, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT). - [@codedmart](https://github.com/codedmart) (Brandon Martin) My existing contributions and all future contributions until further notice are Copyright Brandon Martin, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT). - [@davidchambers](https://github.com/davidchambers) (David Chambers) My existing contributions and all future contributions until further notice are Copyright David Chambers, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).