permutation 0.4.1 → 0.5.0.5
raw patch · 4 files changed
Files
- NEWS +4/−0
- lib/Data/IntArray.hs +17/−8
- lib/Data/Permute/MPermute.hs +5/−1
- permutation.cabal +8/−7
NEWS view
@@ -1,3 +1,7 @@+Changes in 0.5.0:++* GHC 7.8.1 compatability+ Changes in 0.4.1: * added indexOf/getIndexOf
lib/Data/IntArray.hs view
@@ -1,4 +1,5 @@-{-# LANGUAGE MagicHash, UnboxedTuples #-}++{-# LANGUAGE MagicHash, UnboxedTuples, CPP #-} {-# OPTIONS_GHC -funbox-strict-fields #-} ----------------------------------------------------------------------------- -- |@@ -39,6 +40,14 @@ import GHC.ST import Foreign( sizeOf ) +#if __GLASGOW_HASKELL__ >= 708+import GHC.Exts (isTrue#)++isTrue = isTrue#+#else+isTrue = id+#endif +{-# INLINE isTrue #-} ----------------------------- Immutable arrays ----------------------------- data IntArray = IntArray !Int (ByteArray#)@@ -75,8 +84,8 @@ {-# INLINE sameSTIntArray #-} sameSTIntArray :: STIntArray s -> STIntArray s -> Bool sameSTIntArray (STIntArray _ marr1#) (STIntArray _ marr2#) =- sameMutableByteArray# marr1# marr2#- + isTrue (sameMutableByteArray# marr1# marr2#)+ {-# INLINE numElementsSTIntArray #-} numElementsSTIntArray :: STIntArray s -> Int numElementsSTIntArray (STIntArray n _) = n@@ -109,15 +118,15 @@ case readIntArray# marr# j# s2# of { (# s3#, f# #) -> case writeIntArray# marr# i# f# s3# of { s4# -> writeIntArray# marr# j# e# s4# }}} in- if i# ==# j# then (# s1#, () #)- else case doSwap of { s2# ->- (# s2#, () #) }+ if isTrue (i# ==# j#) then (# s1#, () #)+ else case doSwap of { s2# ->+ (# s2#, () #) } {-# INLINE readElems #-} readElems :: STIntArray s -> ST s [Int] readElems (STIntArray (I# n#) marr#) = ST $ \s1# ->- let inlineReadList i# | i# ==# n# = []+ let inlineReadList i# | isTrue (i# ==# n#) = [] | otherwise = case readIntArray# marr# i# s1# of { (# _, e# #) -> let e = I# e#@@ -130,7 +139,7 @@ writeElems :: STIntArray s -> [Int] -> ST s () writeElems (STIntArray (I# n#) marr#) es = ST $ \s1# ->- let fillFromList i# xs s2# | i# ==# n# = s2#+ let fillFromList i# xs s2# | isTrue (i# ==# n#) = s2# | otherwise = case xs of [] -> s2# (I# y#):ys -> case writeIntArray# marr# i# y# s2# of { s3# ->
lib/Data/Permute/MPermute.hs view
@@ -1,5 +1,5 @@ {-# LANGUAGE BangPatterns, MultiParamTypeClasses, FunctionalDependencies, - FlexibleContexts #-}+ FlexibleContexts, CPP #-} ----------------------------------------------------------------------------- -- | -- Module : Data.Permute.MPermute@@ -78,8 +78,12 @@ import Control.Monad import Control.Monad.ST+#if __GLASGOW_HASKELL__ >= 708+import Control.Monad.ST.Unsafe+#endif import Data.Function( on ) import qualified Data.List as List+ import System.IO.Unsafe( unsafeInterleaveIO ) import Data.Permute.Base
permutation.cabal view
@@ -1,6 +1,6 @@ name: permutation-version: 0.4.1-homepage: http://stat.stanford.edu/~patperry/code/permutation+version: 0.5.0.5+homepage: https://github.com/spacekitteh/permutation synopsis: A library for permutations and combinations. description: This library includes data types for storing permutations and@@ -22,10 +22,10 @@ license-file: LICENSE copyright: (c) 2008. Patrick Perry <patperry@stanford.edu> author: Patrick Perry-maintainer: Patrick Perry <patperry@stanford.edu>+maintainer: Sophie Taylor <sophie@traumapony.org> cabal-version: >= 1.2.3 build-type: Custom-tested-with: GHC ==6.8.2, GHC ==6.10.1+tested-with: GHC ==7.8.1 extra-source-files: examples/Enumerate.hs tests/Test/Choose.hs@@ -56,16 +56,17 @@ Data.Permute.Base Data.Permute.IOBase - build-depends: base+ build-depends: base < 5 && >=4, QuickCheck extensions: BangPatterns, FlexibleContexts, FunctionalDependencies, MagicHash, MultiParamTypeClasses, Rank2Types,- UnboxedTuples+ UnboxedTuples,+ CPP - ghc-options: -Wall+ ghc-options: -Wall -O3 if impl(ghc >= 6.9) build-depends: ghc-prim