-{-# OPTIONS_GHC -fno-implicit-prelude -funbox-strict-fields #-}
+{-# OPTIONS_GHC -XNoImplicitPrelude -funbox-strict-fields #-}
{-# LANGUAGE BangPatterns #-}
-----------------------------------------------------------------------------
-- |
import GHC.Base
import GHC.Real
import GHC.Num
-import GHC.IO
+-- import GHC.IO
import GHC.IO.Exception
import GHC.IO.Buffer
import GHC.IO.Encoding.Types
import System.Posix.Internals
import Foreign.C
import GHC.Show
+import GHC.Ptr
puts :: String -> IO ()
puts s = do withCStringLen (s++"\n") $ \(p,len) ->
- c_write 1 p (fromIntegral len)
+ c_write 1 (castPtr p) (fromIntegral len)
return ()
#endif
-- The UTF-16 codec: either UTF16BE or UTF16LE with a BOM
utf16 :: TextEncoding
-utf16 = TextEncoding { mkTextDecoder = utf16_DF,
+utf16 = TextEncoding { textEncodingName = "UTF-16",
+ mkTextDecoder = utf16_DF,
mkTextEncoder = utf16_EF }
utf16_DF :: IO (TextDecoder (Maybe DecodeBuffer))
-- UTF16LE and UTF16BE
utf16be :: TextEncoding
-utf16be = TextEncoding { mkTextDecoder = utf16be_DF,
+utf16be = TextEncoding { textEncodingName = "UTF-16BE",
+ mkTextDecoder = utf16be_DF,
mkTextEncoder = utf16be_EF }
utf16be_DF :: IO (TextDecoder ())
})
utf16le :: TextEncoding
-utf16le = TextEncoding { mkTextDecoder = utf16le_DF,
+utf16le = TextEncoding { textEncodingName = "UTF16-LE",
+ mkTextDecoder = utf16le_DF,
mkTextEncoder = utf16le_EF }
utf16le_DF :: IO (TextDecoder ())