permutation 0.4.1 → 0.5.0
raw patch · 4 files changed
+28/−15 lines, 4 filesdep ~basenew-uploaderPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
Files
- NEWS +3/−0
- lib/Data/IntArray.hs +16/−8
- lib/Data/Permute/MPermute.hs +1/−0
- permutation.cabal +8/−7
NEWS view
@@ -1,3 +1,6 @@+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,4 @@-{-# LANGUAGE MagicHash, UnboxedTuples #-}+{-# LANGUAGE MagicHash, UnboxedTuples, CPP #-} {-# OPTIONS_GHC -funbox-strict-fields #-} ----------------------------------------------------------------------------- -- |@@ -39,6 +39,14 @@ import GHC.ST import Foreign( sizeOf ) +#ifdef MIN_VERSION_base(4,7,0)+import GHC.Exts (isTrue#)++isTrue = isTrue#+#else+isTrue = id+#endif +{-# INLINE isTrue #-} ----------------------------- Immutable arrays ----------------------------- data IntArray = IntArray !Int (ByteArray#)@@ -75,8 +83,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 +117,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 +138,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
@@ -78,6 +78,7 @@ import Control.Monad import Control.Monad.ST+import Control.Monad.ST.Unsafe import Data.Function( on ) import qualified Data.List as List import System.IO.Unsafe( unsafeInterleaveIO )
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+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 >= 4.6 && <4.8 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