pugs-compat 0.0.6.20130611.0 → 0.0.6.20150815
raw patch · 6 files changed
+18/−32 lines, 6 filesdep +hashtablesPVP ok
version bump matches the API change (PVP)
Dependencies added: hashtables
API changes (from Hackage documentation)
Files
- pugs-compat.cabal +3/−2
- src/Pugs/Compat.hs +2/−2
- src/Pugs/Compat/Cast.hs +2/−1
- src/Pugs/Compat/ID.hs +4/−18
- src/Pugs/Compat/Monads.hs +2/−2
- src/Pugs/Compat/Posix.hs +5/−7
pugs-compat.cabal view
@@ -1,5 +1,5 @@ Name : pugs-compat-Version : 0.0.6.20130611.0+Version : 0.0.6.20150815 Build-type : Simple Category : Pugs License : PublicDomain@@ -9,7 +9,7 @@ Description : Portable Haskell/POSIX layer for Pugs Cabal-Version : >=1.2.3 -Tested-With: GHC==7.6.3+Tested-With: GHC==6.8.2, GHC==6.8.3, GHC==6.10.1, GHC==6.12.1, GHC==7.4.1, GHC==7.10.2 Library Extensions : CPP, MagicHash, ScopedTypeVariables, MultiParamTypeClasses,@@ -19,6 +19,7 @@ Build-depends : base >=4 && < 5, time, directory, process, regex-pcre-builtin >= 0.94.4.4.8.31, regex-base, random, network, containers, bytestring, array, mtl >= 2.0.0.0, stm, utf8-string, syb, stringtable-atom >= 0.0.6.1+ , hashtables Exposed-modules : Pugs.Compat Other-modules : Pugs.Compat.Cast Pugs.Compat.Global Pugs.Compat.ID Pugs.Compat.Monads Pugs.Compat.Posix Pugs.Compat.String
src/Pugs/Compat.hs view
@@ -55,7 +55,7 @@ import Data.Tree as X import Data.Unique as X import Data.Word as X hiding (Word)-import Debug.Trace as X +import Debug.Trace as X hiding (traceM) import GHC.Conc as X (unsafeIOToSTM) import GHC.Exts as X (unsafeCoerce#, Word(W#), Word#) import Network as X @@ -63,7 +63,7 @@ import System.Cmd as X import System.Directory as X (Permissions(..), getPermissions, getTemporaryDirectory, createDirectory, removeDirectory, removeFile, getDirectoryContents, getModificationTime) import System.Environment as X (getArgs, withArgs, getProgName)-import System.Exit as X +import System.Exit as X hiding (die) import System.IO as X ( Handle, stdin, stdout, hClose, hGetLine, hGetChar, hGetContents, openFile, hSetBinaryMode, hPutStr, hPutStrLn, IOMode(..), stderr, SeekMode(..), hSetBuffering, BufferMode(..), hIsTerminalDevice, hFlush, hPrint, isEOF, hSeek, hTell, hIsOpen, hIsClosed, hIsReadable, hIsWritable, hIsSeekable) import System.IO.Error as X (ioeGetErrorString, isUserError) import System.IO.Unsafe as X
src/Pugs/Compat/Cast.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE BangPatterns #-} {-# OPTIONS_GHC -fno-warn-unused-imports #-} module Pugs.Compat.Cast ( (:>:)(..),@@ -54,7 +55,7 @@ {-# INLINE addressOf #-} addressOf :: a -> Word-addressOf x = W# (unsafeCoerce# x)+addressOf !x = W# (unsafeCoerce# x) {-# INLINE showAddressOf #-} showAddressOf :: String -> a -> String
src/Pugs/Compat/ID.hs view
@@ -1,7 +1,7 @@ {-# OPTIONS_GHC -fno-full-laziness -fno-cse -cpp #-} module Pugs.Compat.ID (- ID, bufToID, hashNew, hashByteString,+ ID, bufToID, hashNew, __, (+++), nullID, idKey, idBuf, AtomMap, AtomSet ) where @@ -14,7 +14,7 @@ import Data.ByteString (ByteString) import qualified Data.ByteString as BS import qualified Data.ByteString.UTF8 as UTF8-import qualified Data.HashTable as H+import qualified Data.HashTable.IO as H type ID = Atom @@ -28,22 +28,8 @@ idKey = fromAtom {-# INLINE hashNew #-}-hashNew :: IO (H.HashTable ByteString a)-hashNew = H.new (==) hashByteString--hashByteString :: ByteString -> Int32-hashByteString = BS.foldl' f golden- where- f m c = fromIntegral c * magic + hashInt32 m- magic = 0xdeadbeef- golden :: Int32- golden = 1013904242 -- = round ((sqrt 5 - 1) * 2^32) :: Int32- hashInt32 :: Int32 -> Int32- hashInt32 x = mulHi x golden + x- mulHi a b = fromIntegral (r `shiftR` 32)- where- r :: Int64- r = fromIntegral a * fromIntegral b+hashNew :: IO (H.BasicHashTable ByteString a)+hashNew = H.new {- -- XXX - Under GHCI, our global _BufToID table could be refreshed into
src/Pugs/Compat/Monads.hs view
@@ -21,9 +21,9 @@ import Prelude hiding (mapM) import Data.Traversable-import Debug.Trace+import Debug.Trace hiding (traceM) import qualified Data.ByteString.Internal as I (inlinePerformIO)-import System.Exit+import System.Exit hiding (die) import System.IO (hPutStrLn, stderr) import System.IO.Unsafe import Control.Exception (Exception(..))
src/Pugs/Compat/Posix.hs view
@@ -1,4 +1,5 @@ {-# OPTIONS_GHC -fno-warn-orphans #-}+{-# LANGUAGE StandaloneDeriving, DeriveDataTypeable #-} {-| POSIX calls and emulations. @@ -54,7 +55,6 @@ import System.Cmd import System.Posix.Types import Data.Time-import Control.Exception #ifdef PUGS_HAVE_POSIX import System.Posix.Files@@ -68,6 +68,7 @@ import Foreign.C.String import Data.Typeable import qualified System.Posix.Signals+import Control.Exception _PUGS_HAVE_POSIX :: Bool _PUGS_HAVE_POSIX = True@@ -76,10 +77,8 @@ doesExist = fileExist testStatusWith :: (FileStatus -> Bool) -> FilePath -> IO Bool-testStatusWith t f = fmap t (getFileStatus f) `catch` false- where- false :: SomeException -> IO Bool- false = const (return False)+testStatusWith t f = fmap t (getFileStatus f) `catch`+ (const (return False) :: SomeException -> IO Bool) doesFileExist :: FilePath -> IO Bool doesFileExist = testStatusWith isRegularFile@@ -126,8 +125,7 @@ clocksPerSecond :: (Num a) => a clocksPerSecond = 1000000 -instance Typeable DirStream where- typeOf _ = mkTyConApp (mkTyCon "DirStream") []+deriving instance Typeable DirStream #else