array 0.4.0.1 → 0.5.0.0
raw patch · 16 files changed
+113/−688 lines, 16 filesdep ~basenew-uploaderPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
- Data.Array.IO: castIOUArray :: IOUArray i a -> IO (IOUArray i b)
- Data.Array.MArray: unsafeFreeze :: (Ix i, MArray a e m, IArray b e) => a i e -> m (b i e)
- Data.Array.MArray: unsafeThaw :: (Ix i, IArray a e, MArray b e m) => a i e -> m (b i e)
- Data.Array.ST: castSTUArray :: STUArray s ix a -> ST s (STUArray s ix b)
- Data.Array.Storable: unsafeForeignPtrToStorableArray :: Ix i => ForeignPtr e -> (i, i) -> IO (StorableArray i e)
Files
- Data/Array.hs +0/−10
- Data/Array/Base.hs +28/−375
- Data/Array/IO.hs +5/−67
- Data/Array/IO/Internals.hs +3/−22
- Data/Array/IO/Safe.hs +2/−2
- Data/Array/MArray.hs +3/−77
- Data/Array/MArray/Safe.hs +2/−1
- Data/Array/ST.hs +1/−21
- Data/Array/ST/Safe.hs +1/−0
- Data/Array/Storable.hs +1/−19
- Data/Array/Storable/Internals.hs +2/−1
- Data/Array/Storable/Safe.hs +1/−0
- Data/Array/Unsafe.hs +1/−0
- array.cabal +40/−34
- changelog +23/−0
- include/Typeable.h +0/−59
Data/Array.hs view
@@ -56,17 +56,7 @@ import Data.Ix import Data.Typeable () -#ifdef __GLASGOW_HASKELL__ import GHC.Arr -- Most of the hard work is done here-#endif--#ifdef __HUGS__-import Hugs.Array-#endif--#ifdef __NHC__-import Array -- Haskell'98 arrays-#endif {- $intro Haskell provides indexable /arrays/, which may be thought of as functions
Data/Array/Base.hs view
@@ -1,11 +1,5 @@-{-# OPTIONS_GHC -XBangPatterns -fno-warn-unused-imports #-}+{-# LANGUAGE BangPatterns, CPP, RankNTypes, MagicHash, UnboxedTuples, MultiParamTypeClasses, FlexibleInstances, FlexibleContexts, DeriveDataTypeable, UnliftedFFITypes #-} {-# OPTIONS_HADDOCK hide #-}--- XXX With a GHC 6.9 we get a spurious--- Data/Array/Base.hs:26:0:--- Warning: Module `Data.Ix' is imported, but nothing from it is used,--- except perhaps instances visible in `Data.Ix'--- To suppress this warning, use: import Data.Ix()--- The -fno-warn-unused-imports works around that bug ----------------------------------------------------------------------------- -- |@@ -22,7 +16,6 @@ -- ----------------------------------------------------------------------------- --- #hide module Data.Array.Base where import Control.Monad.ST.Lazy ( strictToLazyST )@@ -31,50 +24,25 @@ import Foreign.C.Types import Foreign.StablePtr -#ifdef __GLASGOW_HASKELL__ import Data.Char-import GHC.Arr ( STArray, unsafeIndex )+import GHC.Arr ( STArray ) import qualified GHC.Arr as Arr import qualified GHC.Arr as ArrST import GHC.ST ( ST(..), runST ) import GHC.Base-import GHC.Word ( Word(..) ) import GHC.Ptr ( Ptr(..), FunPtr(..), nullPtr, nullFunPtr )-import GHC.Float ( Float(..), Double(..) ) import GHC.Stable ( StablePtr(..) )+#if !MIN_VERSION_base(4,6,0)+import GHC.Exts ( Word(..) )+#endif import GHC.Int ( Int8(..), Int16(..), Int32(..), Int64(..) ) import GHC.Word ( Word8(..), Word16(..), Word32(..), Word64(..) )-#if __GLASGOW_HASKELL__ >= 611-import GHC.IO ( IO(..), stToIO )+import GHC.IO ( stToIO ) import GHC.IOArray ( IOArray(..), newIOArray, unsafeReadIOArray, unsafeWriteIOArray )-#else-import GHC.IOBase ( IO(..), IOArray(..), stToIO,- newIOArray, unsafeReadIOArray, unsafeWriteIOArray )-#endif-#else-import Data.Int-import Data.Word-import Foreign.Ptr-#endif--#ifdef __HUGS__-import Data.Bits-import Foreign.Storable-import qualified Hugs.Array as Arr-import qualified Hugs.ST as ArrST-import Hugs.Array ( unsafeIndex )-import Hugs.IOArray-import Hugs.ST ( STArray, ST(..), runST )-import Hugs.ByteArray-#endif- import Data.Typeable-#include "Typeable.h" -#ifdef __GLASGOW_HASKELL__ #include "MachDeps.h"-#endif ----------------------------------------------------------------------------- -- Class of immutable arrays@@ -252,7 +220,6 @@ -- calls seem to be floated out, then floated back into the middle -- of listUArrayST, so I was not able to do this. -#ifdef __GLASGOW_HASKELL__ type ListUArray e = forall i . Ix i => (i,i) -> [e] -> UArray i e {-# RULES@@ -291,7 +258,6 @@ "listArray/UArray/Word64" listArray = (\lu es -> runST (listUArrayST lu es >>= unsafeFreezeSTUArray)) :: ListUArray Word64 #-}-#endif {-# INLINE (!) #-} -- | Returns the element of an immutable array at the specified index.@@ -433,14 +399,8 @@ -- get the benefits of unboxed arrays (don\'t forget to import -- "Data.Array.Unboxed" instead of "Data.Array"). ---#ifdef __GLASGOW_HASKELL__ data UArray i e = UArray !i !i !Int ByteArray#-#endif-#ifdef __HUGS__-data UArray i e = UArray !i !i !Int !ByteArray-#endif--INSTANCE_TYPEABLE2(UArray,uArrayTc,"UArray")+ deriving Typeable {-# INLINE unsafeArrayUArray #-} unsafeArrayUArray :: (MArray (STUArray s) e (ST s), Ix i)@@ -452,15 +412,9 @@ {-# INLINE unsafeFreezeSTUArray #-} unsafeFreezeSTUArray :: STUArray s i e -> ST s (UArray i e)-#if __GLASGOW_HASKELL__ unsafeFreezeSTUArray (STUArray l u n marr#) = ST $ \s1# -> case unsafeFreezeByteArray# marr# s1# of { (# s2#, arr# #) -> (# s2#, UArray l u n arr# #) }-#elif __HUGS__-unsafeFreezeSTUArray (STUArray l u n marr) = do- arr <- unsafeFreezeMutableByteArray marr- return (UArray l u n arr)-#endif {-# INLINE unsafeReplaceUArray #-} unsafeReplaceUArray :: (MArray (STUArray s) e (ST s), Ix i)@@ -535,11 +489,6 @@ ----------------------------------------------------------------------------- -- Flat unboxed arrays: instances -#ifdef __HUGS__-unsafeAtBArray :: Storable e => UArray i e -> Int -> e-unsafeAtBArray (UArray _ _ _ arr) = readByteArray arr-#endif- instance IArray UArray Bool where {-# INLINE bounds #-} bounds (UArray l u _ _) = (l,u)@@ -547,16 +496,15 @@ numElements (UArray _ _ n _) = n {-# INLINE unsafeArray #-} unsafeArray lu ies = runST (unsafeArrayUArray lu ies False)-#ifdef __GLASGOW_HASKELL__ {-# INLINE unsafeAt #-}+#if __GLASGOW_HASKELL__ > 706+ unsafeAt (UArray _ _ _ arr#) (I# i#) = isTrue#+#else unsafeAt (UArray _ _ _ arr#) (I# i#) =- (indexWordArray# arr# (bOOL_INDEX i#) `and#` bOOL_BIT i#)- `neWord#` int2Word# 0# #endif-#ifdef __HUGS__- unsafeAt (UArray _ _ _ arr) i =- testBit (readByteArray arr (bOOL_INDEX i)::BitSet) (bOOL_SUBINDEX i)-#endif+ ((indexWordArray# arr# (bOOL_INDEX i#) `and#` bOOL_BIT i#)+ `neWord#` int2Word# 0#)+ {-# INLINE unsafeReplace #-} unsafeReplace arr ies = runST (unsafeReplaceUArray arr ies) {-# INLINE unsafeAccum #-}@@ -572,12 +520,7 @@ {-# INLINE unsafeArray #-} unsafeArray lu ies = runST (unsafeArrayUArray lu ies '\0') {-# INLINE unsafeAt #-}-#ifdef __GLASGOW_HASKELL__ unsafeAt (UArray _ _ _ arr#) (I# i#) = C# (indexWideCharArray# arr# i#)-#endif-#ifdef __HUGS__- unsafeAt = unsafeAtBArray-#endif {-# INLINE unsafeReplace #-} unsafeReplace arr ies = runST (unsafeReplaceUArray arr ies) {-# INLINE unsafeAccum #-}@@ -592,13 +535,8 @@ numElements (UArray _ _ n _) = n {-# INLINE unsafeArray #-} unsafeArray lu ies = runST (unsafeArrayUArray lu ies 0)-#ifdef __GLASGOW_HASKELL__ {-# INLINE unsafeAt #-} unsafeAt (UArray _ _ _ arr#) (I# i#) = I# (indexIntArray# arr# i#)-#endif-#ifdef __HUGS__- unsafeAt = unsafeAtBArray-#endif {-# INLINE unsafeReplace #-} unsafeReplace arr ies = runST (unsafeReplaceUArray arr ies) {-# INLINE unsafeAccum #-}@@ -613,13 +551,8 @@ numElements (UArray _ _ n _) = n {-# INLINE unsafeArray #-} unsafeArray lu ies = runST (unsafeArrayUArray lu ies 0)-#ifdef __GLASGOW_HASKELL__ {-# INLINE unsafeAt #-} unsafeAt (UArray _ _ _ arr#) (I# i#) = W# (indexWordArray# arr# i#)-#endif-#ifdef __HUGS__- unsafeAt = unsafeAtBArray-#endif {-# INLINE unsafeReplace #-} unsafeReplace arr ies = runST (unsafeReplaceUArray arr ies) {-# INLINE unsafeAccum #-}@@ -635,12 +568,7 @@ {-# INLINE unsafeArray #-} unsafeArray lu ies = runST (unsafeArrayUArray lu ies nullPtr) {-# INLINE unsafeAt #-}-#ifdef __GLASGOW_HASKELL__ unsafeAt (UArray _ _ _ arr#) (I# i#) = Ptr (indexAddrArray# arr# i#)-#endif-#ifdef __HUGS__- unsafeAt = unsafeAtBArray-#endif {-# INLINE unsafeReplace #-} unsafeReplace arr ies = runST (unsafeReplaceUArray arr ies) {-# INLINE unsafeAccum #-}@@ -655,13 +583,8 @@ numElements (UArray _ _ n _) = n {-# INLINE unsafeArray #-} unsafeArray lu ies = runST (unsafeArrayUArray lu ies nullFunPtr)-#ifdef __GLASGOW_HASKELL__ {-# INLINE unsafeAt #-} unsafeAt (UArray _ _ _ arr#) (I# i#) = FunPtr (indexAddrArray# arr# i#)-#endif-#ifdef __HUGS__- unsafeAt = unsafeAtBArray-#endif {-# INLINE unsafeReplace #-} unsafeReplace arr ies = runST (unsafeReplaceUArray arr ies) {-# INLINE unsafeAccum #-}@@ -676,13 +599,8 @@ numElements (UArray _ _ n _) = n {-# INLINE unsafeArray #-} unsafeArray lu ies = runST (unsafeArrayUArray lu ies 0)-#ifdef __GLASGOW_HASKELL__ {-# INLINE unsafeAt #-} unsafeAt (UArray _ _ _ arr#) (I# i#) = F# (indexFloatArray# arr# i#)-#endif-#ifdef __HUGS__- unsafeAt = unsafeAtBArray-#endif {-# INLINE unsafeReplace #-} unsafeReplace arr ies = runST (unsafeReplaceUArray arr ies) {-# INLINE unsafeAccum #-}@@ -697,13 +615,8 @@ numElements (UArray _ _ n _) = n {-# INLINE unsafeArray #-} unsafeArray lu ies = runST (unsafeArrayUArray lu ies 0)-#ifdef __GLASGOW_HASKELL__ {-# INLINE unsafeAt #-} unsafeAt (UArray _ _ _ arr#) (I# i#) = D# (indexDoubleArray# arr# i#)-#endif-#ifdef __HUGS__- unsafeAt = unsafeAtBArray-#endif {-# INLINE unsafeReplace #-} unsafeReplace arr ies = runST (unsafeReplaceUArray arr ies) {-# INLINE unsafeAccum #-}@@ -718,13 +631,8 @@ numElements (UArray _ _ n _) = n {-# INLINE unsafeArray #-} unsafeArray lu ies = runST (unsafeArrayUArray lu ies nullStablePtr)-#ifdef __GLASGOW_HASKELL__ {-# INLINE unsafeAt #-} unsafeAt (UArray _ _ _ arr#) (I# i#) = StablePtr (indexStablePtrArray# arr# i#)-#endif-#ifdef __HUGS__- unsafeAt = unsafeAtBArray-#endif {-# INLINE unsafeReplace #-} unsafeReplace arr ies = runST (unsafeReplaceUArray arr ies) {-# INLINE unsafeAccum #-}@@ -734,12 +642,7 @@ -- bogus StablePtr value for initialising a UArray of StablePtr. nullStablePtr :: StablePtr a-#ifdef __GLASGOW_HASKELL__ nullStablePtr = StablePtr (unsafeCoerce# 0#)-#endif-#ifdef __HUGS__-nullStablePtr = castPtrToStablePtr nullPtr-#endif instance IArray UArray Int8 where {-# INLINE bounds #-}@@ -748,13 +651,8 @@ numElements (UArray _ _ n _) = n {-# INLINE unsafeArray #-} unsafeArray lu ies = runST (unsafeArrayUArray lu ies 0)-#ifdef __GLASGOW_HASKELL__ {-# INLINE unsafeAt #-} unsafeAt (UArray _ _ _ arr#) (I# i#) = I8# (indexInt8Array# arr# i#)-#endif-#ifdef __HUGS__- unsafeAt = unsafeAtBArray-#endif {-# INLINE unsafeReplace #-} unsafeReplace arr ies = runST (unsafeReplaceUArray arr ies) {-# INLINE unsafeAccum #-}@@ -769,13 +667,8 @@ numElements (UArray _ _ n _) = n {-# INLINE unsafeArray #-} unsafeArray lu ies = runST (unsafeArrayUArray lu ies 0)-#ifdef __GLASGOW_HASKELL__ {-# INLINE unsafeAt #-} unsafeAt (UArray _ _ _ arr#) (I# i#) = I16# (indexInt16Array# arr# i#)-#endif-#ifdef __HUGS__- unsafeAt = unsafeAtBArray-#endif {-# INLINE unsafeReplace #-} unsafeReplace arr ies = runST (unsafeReplaceUArray arr ies) {-# INLINE unsafeAccum #-}@@ -790,13 +683,8 @@ numElements (UArray _ _ n _) = n {-# INLINE unsafeArray #-} unsafeArray lu ies = runST (unsafeArrayUArray lu ies 0)-#ifdef __GLASGOW_HASKELL__ {-# INLINE unsafeAt #-} unsafeAt (UArray _ _ _ arr#) (I# i#) = I32# (indexInt32Array# arr# i#)-#endif-#ifdef __HUGS__- unsafeAt = unsafeAtBArray-#endif {-# INLINE unsafeReplace #-} unsafeReplace arr ies = runST (unsafeReplaceUArray arr ies) {-# INLINE unsafeAccum #-}@@ -811,13 +699,8 @@ numElements (UArray _ _ n _) = n {-# INLINE unsafeArray #-} unsafeArray lu ies = runST (unsafeArrayUArray lu ies 0)-#ifdef __GLASGOW_HASKELL__ {-# INLINE unsafeAt #-} unsafeAt (UArray _ _ _ arr#) (I# i#) = I64# (indexInt64Array# arr# i#)-#endif-#ifdef __HUGS__- unsafeAt = unsafeAtBArray-#endif {-# INLINE unsafeReplace #-} unsafeReplace arr ies = runST (unsafeReplaceUArray arr ies) {-# INLINE unsafeAccum #-}@@ -832,13 +715,8 @@ numElements (UArray _ _ n _) = n {-# INLINE unsafeArray #-} unsafeArray lu ies = runST (unsafeArrayUArray lu ies 0)-#ifdef __GLASGOW_HASKELL__ {-# INLINE unsafeAt #-} unsafeAt (UArray _ _ _ arr#) (I# i#) = W8# (indexWord8Array# arr# i#)-#endif-#ifdef __HUGS__- unsafeAt = unsafeAtBArray-#endif {-# INLINE unsafeReplace #-} unsafeReplace arr ies = runST (unsafeReplaceUArray arr ies) {-# INLINE unsafeAccum #-}@@ -853,13 +731,8 @@ numElements (UArray _ _ n _) = n {-# INLINE unsafeArray #-} unsafeArray lu ies = runST (unsafeArrayUArray lu ies 0)-#ifdef __GLASGOW_HASKELL__ {-# INLINE unsafeAt #-} unsafeAt (UArray _ _ _ arr#) (I# i#) = W16# (indexWord16Array# arr# i#)-#endif-#ifdef __HUGS__- unsafeAt = unsafeAtBArray-#endif {-# INLINE unsafeReplace #-} unsafeReplace arr ies = runST (unsafeReplaceUArray arr ies) {-# INLINE unsafeAccum #-}@@ -874,13 +747,8 @@ numElements (UArray _ _ n _) = n {-# INLINE unsafeArray #-} unsafeArray lu ies = runST (unsafeArrayUArray lu ies 0)-#ifdef __GLASGOW_HASKELL__ {-# INLINE unsafeAt #-} unsafeAt (UArray _ _ _ arr#) (I# i#) = W32# (indexWord32Array# arr# i#)-#endif-#ifdef __HUGS__- unsafeAt = unsafeAtBArray-#endif {-# INLINE unsafeReplace #-} unsafeReplace arr ies = runST (unsafeReplaceUArray arr ies) {-# INLINE unsafeAccum #-}@@ -895,13 +763,8 @@ numElements (UArray _ _ n _) = n {-# INLINE unsafeArray #-} unsafeArray lu ies = runST (unsafeArrayUArray lu ies 0)-#ifdef __GLASGOW_HASKELL__ {-# INLINE unsafeAt #-} unsafeAt (UArray _ _ _ arr#) (I# i#) = W64# (indexWord64Array# arr# i#)-#endif-#ifdef __HUGS__- unsafeAt = unsafeAtBArray-#endif {-# INLINE unsafeReplace #-} unsafeReplace arr ies = runST (unsafeReplaceUArray arr ies) {-# INLINE unsafeAccum #-}@@ -992,15 +855,10 @@ -- initial value and it is constant for all elements. instance MArray IOArray e IO where-#if defined(__HUGS__)- getBounds = return . boundsIOArray- getNumElements = return . getNumElementsIOArray-#elif defined(__GLASGOW_HASKELL__) {-# INLINE getBounds #-} getBounds (IOArray marr) = stToIO $ getBounds marr {-# INLINE getNumElements #-} getNumElements (IOArray marr) = stToIO $ getNumElements marr-#endif newArray = newIOArray unsafeRead = unsafeReadIOArray unsafeWrite = unsafeWriteIOArray@@ -1106,10 +964,6 @@ {-# INLINE unsafeWrite #-} unsafeWrite arr i e = strictToLazyST (ArrST.unsafeWriteSTArray arr i e) -#ifdef __HUGS__-INSTANCE_TYPEABLE3(STArray,sTArrayTc,"STArray")-#endif- ----------------------------------------------------------------------------- -- Flat unboxed mutable arrays (ST monad) @@ -1128,26 +982,17 @@ -- element type. However, 'STUArray' is strict in its elements - so -- don\'t use 'STUArray' if you require the non-strictness that -- 'STArray' provides.-#ifdef __GLASGOW_HASKELL__ data STUArray s i e = STUArray !i !i !Int (MutableByteArray# s)-#endif-#ifdef __HUGS__-data STUArray s i e = STUArray !i !i !Int !(MutableByteArray s)-#endif--INSTANCE_TYPEABLE3(STUArray,stUArrayTc,"STUArray")+ deriving Typeable -#ifdef __GLASGOW_HASKELL__ instance Eq (STUArray s i e) where STUArray _ _ _ arr1# == STUArray _ _ _ arr2# =+#if __GLASGOW_HASKELL__ > 706+ isTrue# (sameMutableByteArray# arr1# arr2#)+#else sameMutableByteArray# arr1# arr2# #endif-#ifdef __HUGS__-instance Eq (STUArray s i e) where- STUArray _ _ _ arr1 == STUArray _ _ _ arr2 = arr1 == arr2-#endif -#ifdef __GLASGOW_HASKELL__ {-# INLINE unsafeNewArraySTUArray_ #-} unsafeNewArraySTUArray_ :: Ix i => (i,i) -> (Int# -> Int#) -> ST s (STUArray s i e)@@ -1169,8 +1014,12 @@ case safeRangeSize (l,u) of { n@(I# n#) -> case newByteArray# (bOOL_SCALE n#) s1# of { (# s2#, marr# #) -> case bOOL_WORD_SCALE n# of { n'# ->- let loop i# s3# | i# ==# n'# = s3#- | otherwise =+#if __GLASGOW_HASKELL__ > 706+ let loop i# s3# | isTrue# (i# ==# n'#) = s3#+#else+ let loop i# s3# | i# ==# n'# = s3#+#endif+ | otherwise = case writeWordArray# marr# i# e# s3# of { s4# -> loop (i# +# 1#) s4# } in case loop 0# s2# of { s3# ->@@ -1184,7 +1033,11 @@ {-# INLINE unsafeRead #-} unsafeRead (STUArray _ _ _ marr#) (I# i#) = ST $ \s1# -> case readWordArray# marr# (bOOL_INDEX i#) s1# of { (# s2#, e# #) ->- (# s2#, (e# `and#` bOOL_BIT i#) `neWord#` int2Word# 0# #) }+#if __GLASGOW_HASKELL__ > 706+ (# s2#, isTrue# ((e# `and#` bOOL_BIT i#) `neWord#` int2Word# 0#) :: Bool #) }+#else+ (# s2#, (e# `and#` bOOL_BIT i# `neWord#` int2Word# 0#) :: Bool #) }+#endif {-# INLINE unsafeWrite #-} unsafeWrite (STUArray _ _ _ marr#) (I# i#) e = ST $ \s1# -> case bOOL_INDEX i# of { j# ->@@ -1507,192 +1360,7 @@ where !(W# mask#) = SIZEOF_HSWORD * 8 - 1 bOOL_NOT_BIT n# = bOOL_BIT n# `xor#` mb# where !(W# mb#) = maxBound-#endif /* __GLASGOW_HASKELL__ */ -#ifdef __HUGS__-newMBArray_ :: (Ix i, Storable e) => (i,i) -> ST s (STUArray s i e)-newMBArray_ = makeArray undefined- where- makeArray :: (Ix i, Storable e) => e -> (i,i) -> ST s (STUArray s i e)- makeArray dummy (l,u) = do- let n = safeRangeSize (l,u)- marr <- newMutableByteArray (n * sizeOf dummy)- return (STUArray l u n marr)--unsafeReadMBArray :: Storable e => STUArray s i e -> Int -> ST s e-unsafeReadMBArray (STUArray _ _ _ marr) = readMutableByteArray marr--unsafeWriteMBArray :: Storable e => STUArray s i e -> Int -> e -> ST s ()-unsafeWriteMBArray (STUArray _ _ _ marr) = writeMutableByteArray marr--getBoundsMBArray :: Storable e => STUArray s i e -> ST s (i, i)-getBoundsMBArray (STUArray l u _ _) = return (l,u)--getNumElementsMBArray :: Storable e => STUArray s i e -> ST s Int-getNumElementsMBArray (STUArray _ _ n _) = return n--instance MArray (STUArray s) Bool (ST s) where- getBounds = getBoundsMBArray- getNumElements = getNumElementsMBArray- unsafeNewArray_ (l,u) = do- let n = rangeSize (l,u)- marr <- newMutableByteArray (bOOL_SCALE n)- return (STUArray l u n marr)- newArray_ bounds = unsafeNewArray_ bounds- unsafeRead (STUArray _ _ _ marr) i = do- let ix = bOOL_INDEX i- bit = bOOL_SUBINDEX i- w <- readMutableByteArray marr ix- return (testBit (w::BitSet) bit)- unsafeWrite (STUArray _ _ _ marr) i e = do- let ix = bOOL_INDEX i- bit = bOOL_SUBINDEX i- w <- readMutableByteArray marr ix- writeMutableByteArray marr ix- (if e then setBit (w::BitSet) bit else clearBit w bit)--instance MArray (STUArray s) Char (ST s) where- getBounds = getBoundsMBArray- getNumElements = getNumElementsMBArray- unsafeNewArray_ = newMBArray_- newArray_ = unsafeNewArray_- unsafeRead = unsafeReadMBArray- unsafeWrite = unsafeWriteMBArray--instance MArray (STUArray s) Int (ST s) where- getBounds = getBoundsMBArray- getNumElements = getNumElementsMBArray- unsafeNewArray_ = newMBArray_- newArray_ = unsafeNewArray_- unsafeRead = unsafeReadMBArray- unsafeWrite = unsafeWriteMBArray--instance MArray (STUArray s) Word (ST s) where- getBounds = getBoundsMBArray- getNumElements = getNumElementsMBArray- unsafeNewArray_ = newMBArray_- newArray_ = unsafeNewArray_- unsafeRead = unsafeReadMBArray- unsafeWrite = unsafeWriteMBArray--instance MArray (STUArray s) (Ptr a) (ST s) where- getBounds = getBoundsMBArray- getNumElements = getNumElementsMBArray- unsafeNewArray_ = newMBArray_- newArray_ = unsafeNewArray_- unsafeRead = unsafeReadMBArray- unsafeWrite = unsafeWriteMBArray--instance MArray (STUArray s) (FunPtr a) (ST s) where- getBounds = getBoundsMBArray- getNumElements = getNumElementsMBArray- unsafeNewArray_ = newMBArray_- newArray_ = unsafeNewArray_- unsafeRead = unsafeReadMBArray- unsafeWrite = unsafeWriteMBArray--instance MArray (STUArray s) Float (ST s) where- getBounds = getBoundsMBArray- getNumElements = getNumElementsMBArray- unsafeNewArray_ = newMBArray_- newArray_ = unsafeNewArray_- unsafeRead = unsafeReadMBArray- unsafeWrite = unsafeWriteMBArray--instance MArray (STUArray s) Double (ST s) where- getBounds = getBoundsMBArray- getNumElements = getNumElementsMBArray- unsafeNewArray_ = newMBArray_- newArray_ = unsafeNewArray_- unsafeRead = unsafeReadMBArray- unsafeWrite = unsafeWriteMBArray--instance MArray (STUArray s) (StablePtr a) (ST s) where- getBounds = getBoundsMBArray- getNumElements = getNumElementsMBArray- unsafeNewArray_ = newMBArray_- newArray_ = unsafeNewArray_- unsafeRead = unsafeReadMBArray- unsafeWrite = unsafeWriteMBArray--instance MArray (STUArray s) Int8 (ST s) where- getBounds = getBoundsMBArray- getNumElements = getNumElementsMBArray- unsafeNewArray_ = newMBArray_- newArray_ = unsafeNewArray_- unsafeRead = unsafeReadMBArray- unsafeWrite = unsafeWriteMBArray--instance MArray (STUArray s) Int16 (ST s) where- getBounds = getBoundsMBArray- getNumElements = getNumElementsMBArray- unsafeNewArray_ = newMBArray_- newArray_ = unsafeNewArray_- unsafeRead = unsafeReadMBArray- unsafeWrite = unsafeWriteMBArray--instance MArray (STUArray s) Int32 (ST s) where- getBounds = getBoundsMBArray- getNumElements = getNumElementsMBArray- unsafeNewArray_ = newMBArray_- newArray_ = unsafeNewArray_- unsafeRead = unsafeReadMBArray- unsafeWrite = unsafeWriteMBArray--instance MArray (STUArray s) Int64 (ST s) where- getBounds = getBoundsMBArray- getNumElements = getNumElementsMBArray- unsafeNewArray_ = newMBArray_- newArray_ = unsafeNewArray_- unsafeRead = unsafeReadMBArray- unsafeWrite = unsafeWriteMBArray--instance MArray (STUArray s) Word8 (ST s) where- getBounds = getBoundsMBArray- getNumElements = getNumElementsMBArray- unsafeNewArray_ = newMBArray_- newArray_ = unsafeNewArray_- unsafeRead = unsafeReadMBArray- unsafeWrite = unsafeWriteMBArray--instance MArray (STUArray s) Word16 (ST s) where- getBounds = getBoundsMBArray- getNumElements = getNumElementsMBArray- unsafeNewArray_ = newMBArray_- newArray_ = unsafeNewArray_- unsafeRead = unsafeReadMBArray- unsafeWrite = unsafeWriteMBArray--instance MArray (STUArray s) Word32 (ST s) where- getBounds = getBoundsMBArray- getNumElements = getNumElementsMBArray- unsafeNewArray_ = newMBArray_- newArray_ = unsafeNewArray_- unsafeRead = unsafeReadMBArray- unsafeWrite = unsafeWriteMBArray--instance MArray (STUArray s) Word64 (ST s) where- getBounds = getBoundsMBArray- getNumElements = getNumElementsMBArray- unsafeNewArray_ = newMBArray_- newArray_ = unsafeNewArray_- unsafeRead = unsafeReadMBArray- unsafeWrite = unsafeWriteMBArray--type BitSet = Word8--bitSetSize = bitSize (0::BitSet)--bOOL_SCALE :: Int -> Int-bOOL_SCALE n = (n + bitSetSize - 1) `div` bitSetSize--bOOL_INDEX :: Int -> Int-bOOL_INDEX i = i `div` bitSetSize--bOOL_SUBINDEX :: Int -> Int-bOOL_SUBINDEX i = i `mod` bitSetSize-#endif /* __HUGS__ */- ----------------------------------------------------------------------------- -- Freezing @@ -1709,7 +1377,6 @@ -- use the safe array creation function here. return (listArray (l,u) es) -#ifdef __GLASGOW_HASKELL__ freezeSTUArray :: Ix i => STUArray s i e -> ST s (UArray i e) freezeSTUArray (STUArray l u n marr#) = ST $ \s1# -> case sizeofMutableByteArray# marr# of { n# ->@@ -1727,7 +1394,6 @@ "freeze/STArray" freeze = ArrST.freezeSTArray "freeze/STUArray" freeze = freezeSTUArray #-}-#endif /* __GLASGOW_HASKELL__ */ -- In-place conversion of mutable arrays to immutable ones places -- a proof obligation on the user: no other parts of your code can@@ -1787,7 +1453,6 @@ return marr thawSTUArray :: Ix i => UArray i e -> ST s (STUArray s i e)-#if __GLASGOW_HASKELL__ thawSTUArray (UArray l u n arr#) = ST $ \s1# -> case sizeofByteArray# arr# of { n# -> case newByteArray# n# s1# of { (# s2#, marr# #) ->@@ -1803,11 +1468,6 @@ "thaw/STArray" thaw = ArrST.thawSTArray "thaw/STUArray" thaw = thawSTUArray #-}-#elif __HUGS__-thawSTUArray (UArray l u n arr) = do- marr <- thawByteArray arr- return (STUArray l u n marr)-#endif -- In-place conversion of immutable arrays to mutable ones places -- a proof obligation on the user: no other parts of your code can@@ -1851,7 +1511,6 @@ unsafeThaw :: (Ix i, IArray a e, MArray b e m) => a i e -> m (b i e) unsafeThaw = thaw -#ifdef __GLASGOW_HASKELL__ {-# INLINE unsafeThawSTUArray #-} unsafeThawSTUArray :: Ix i => UArray i e -> ST s (STUArray s i e) unsafeThawSTUArray (UArray l u n marr#) =@@ -1895,16 +1554,10 @@ {-# RULES "unsafeFreeze/IOArray" unsafeFreeze = unsafeFreezeIOArray #-}-#endif /* __GLASGOW_HASKELL__ */ -- | Casts an 'STUArray' with one element type into one with a -- different element type. All the elements of the resulting array -- are undefined (unless you know what you\'re doing...). castSTUArray :: STUArray s ix a -> ST s (STUArray s ix b)-#if __GLASGOW_HASKELL__ castSTUArray (STUArray l u n marr#) = return (STUArray l u n marr#)-#elif __HUGS__-castSTUArray (STUArray l u n marr) = return (STUArray l u n marr)-#endif-
Data/Array/IO.hs view
@@ -1,5 +1,5 @@-{-# OPTIONS_GHC -#include "HsBase.h" #-}-{-# OPTIONS_GHC -w #-} --tmp+{-# LANGUAGE MagicHash, UnliftedFFITypes #-}+ ----------------------------------------------------------------------------- -- | -- Module : Data.Array.IO@@ -20,7 +20,6 @@ -- * @IO@ arrays with unboxed elements IOUArray, -- instance of: Eq, Typeable- castIOUArray, -- :: IOUArray i a -> IO (IOUArray i b) -- * Overloaded mutable array interface module Data.Array.MArray,@@ -31,29 +30,17 @@ ) where import Data.Array.Base-import Data.Array.IO.Internals hiding ( castIOUArray )-import qualified Data.Array.Unsafe as U ( castIOUArray )+import Data.Array.IO.Internals import Data.Array.MArray import System.IO.Error -#ifdef __GLASGOW_HASKELL__ import Foreign import Foreign.C import GHC.Exts (MutableByteArray#, RealWorld)-import GHC.Arr-import GHC.IORef import GHC.IO.Handle-import GHC.IO.Buffer import GHC.IO.Exception -#else-import Data.Char-import Data.Word ( Word8 )-import System.IO-#endif--#ifdef __GLASGOW_HASKELL__ -- --------------------------------------------------------------------------- -- hGetArray @@ -77,7 +64,7 @@ -- allocate a separate area of memory and copy. allocaBytes count $ \p -> do r <- hGetBuf handle p count- memcpy_ba_ptr ptr p (fromIntegral r)+ _ <- memcpy_ba_ptr ptr p (fromIntegral r) return r foreign import ccall unsafe "memcpy"@@ -100,7 +87,7 @@ -- as in hGetArray, we would like to use the array directly, but -- we can't be sure that the MutableByteArray# is pinned. allocaBytes count $ \p -> do- memcpy_ptr_ba p raw (fromIntegral count)+ _ <- memcpy_ptr_ba p raw (fromIntegral count) hPutBuf handle p count foreign import ccall unsafe "memcpy"@@ -114,52 +101,3 @@ ioException (ioeSetErrorString (mkIOError InvalidArgument fn (Just handle) Nothing) ("illegal buffer size " ++ showsPrec 9 (sz::Int) []))--#else /* !__GLASGOW_HASKELL__ */-hGetArray :: Handle -> IOUArray Int Word8 -> Int -> IO Int-hGetArray handle arr count = do- bds <- getBounds arr- if count < 0 || count > rangeSize bds- then illegalBufferSize handle "hGetArray" count- else get 0- where- get i | i == count = return i- | otherwise = do- error_or_c <- try (hGetChar handle)- case error_or_c of- Left ex- | isEOFError ex -> return i- | otherwise -> ioError ex- Right c -> do- unsafeWrite arr i (fromIntegral (ord c))- get (i+1)--hPutArray :: Handle -> IOUArray Int Word8 -> Int -> IO ()-hPutArray handle arr count = do- bds <- getBounds arr- if count < 0 || count > rangeSize bds- then illegalBufferSize handle "hPutArray" count- else put 0- where- put i | i == count = return ()- | otherwise = do- w <- unsafeRead arr i- hPutChar handle (chr (fromIntegral w))- put (i+1)--illegalBufferSize :: Handle -> String -> Int -> IO a-illegalBufferSize _ fn sz = ioError $- userError (fn ++ ": illegal buffer size " ++ showsPrec 9 (sz::Int) [])-#endif /* !__GLASGOW_HASKELL__ */---{-# DEPRECATED castIOUArray- "Please import from Data.Array.Unsafe instead; This will be removed in the next release"- #-}--- | Casts an 'IOUArray' with one element type into one with a--- different element type. All the elements of the resulting array--- are undefined (unless you know what you\'re doing...).-{-# INLINE castIOUArray #-}-castIOUArray :: IOUArray i a -> IO (IOUArray i b)-castIOUArray = U.castIOUArray-
Data/Array/IO/Internals.hs view
@@ -1,9 +1,9 @@+{-# LANGUAGE DeriveDataTypeable, FlexibleInstances, MultiParamTypeClasses #-} {-# OPTIONS_HADDOCK hide #-}-{-# OPTIONS_GHC -#include "HsBase.h" #-} ----------------------------------------------------------------------------- -- | -- Module : Data.Array.IO.Internal--- Copyright : (c) The University of Glasgow 2001+-- Copyright : (c) The University of Glasgow 2001-2012 -- License : BSD-style (see the file libraries/base/LICENSE) -- -- Maintainer : libraries@haskell.org@@ -14,14 +14,11 @@ -- ----------------------------------------------------------------------------- --- #hide module Data.Array.IO.Internals ( IOArray(..), -- instance of: Eq, Typeable IOUArray(..), -- instance of: Eq, Typeable castIOUArray, -- :: IOUArray ix a -> IO (IOUArray ix b)-#ifdef __GLASGOW_HASKELL__ unsafeThawIOUArray,-#endif ) where import Data.Int@@ -35,20 +32,8 @@ import Data.Ix import Data.Array.Base -#ifdef __HUGS__-import Hugs.IOArray-#endif--#ifdef __GLASGOW_HASKELL__-#if __GLASGOW_HASKELL__ >= 611 import GHC.IOArray (IOArray(..))-#else-import GHC.IOBase (IOArray(..))-#endif-#endif /* __GLASGOW_HASKELL__ */ -#include "Typeable.h"- ----------------------------------------------------------------------------- -- Flat unboxed mutable arrays (IO monad) @@ -61,8 +46,7 @@ -- are supported: see "Data.Array.MArray" for a list of instances. -- newtype IOUArray i e = IOUArray (STUArray RealWorld i e)--INSTANCE_TYPEABLE2(IOUArray,iOUArrayTc,"IOUArray")+ deriving Typeable instance Eq (IOUArray i e) where IOUArray s1 == IOUArray s2 = s1 == s2@@ -381,7 +365,6 @@ marr' <- castSTUArray marr return (IOUArray marr') -#ifdef __GLASGOW_HASKELL__ {-# INLINE unsafeThawIOUArray #-} unsafeThawIOUArray :: Ix ix => UArray ix e -> IO (IOUArray ix e) unsafeThawIOUArray arr = stToIO $ do@@ -415,5 +398,3 @@ {-# RULES "freeze/IOUArray" freeze = freezeIOUArray #-}-#endif /* __GLASGOW_HASKELL__ */-
Data/Array/IO/Safe.hs view
@@ -1,6 +1,5 @@ {-# LANGUAGE Trustworthy #-}-{-# OPTIONS_GHC -#include "HsBase.h" #-}-{-# OPTIONS_GHC -w #-} --tmp+ ----------------------------------------------------------------------------- -- | -- Module : Data.Array.IO.Safe@@ -15,6 +14,7 @@ -- . -- Safe API only of "Data.Array.IO". --+-- /Since: 0.4.0.0/ ----------------------------------------------------------------------------- module Data.Array.IO.Safe (
Data/Array/MArray.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE CPP #-}+ ----------------------------------------------------------------------------- -- | -- Module : Data.Array.MArray@@ -41,87 +43,11 @@ -- * Conversions between mutable and immutable arrays freeze, -- :: (Ix i, MArray a e m, IArray b e) => a i e -> m (b i e)- unsafeFreeze, -- :: (Ix i, MArray a e m, IArray b e) => a i e -> m (b i e) thaw, -- :: (Ix i, IArray a e, MArray b e m) => a i e -> m (b i e)- unsafeThaw, -- :: (Ix i, IArray a e, MArray b e m) => a i e -> m (b i e) ) where import Data.Ix-import Data.Array.Base hiding ( unsafeFreeze, unsafeThaw )-import qualified Data.Array.Base as U ( unsafeFreeze, unsafeThaw )+import Data.Array.Base #ifdef __HADDOCK__ import Data.Array.IArray #endif--{-# DEPRECATED unsafeFreeze, unsafeThaw- "Please import from Data.Array.Unsafe instead; This will be removed in the next release"- #-}--{- |- Converts an mutable array into an immutable array. The- implementation may either simply cast the array from- one type to the other without copying the array, or it- may take a full copy of the array.-- Note that because the array is possibly not copied, any subsequent- modifications made to the mutable version of the array may be- shared with the immutable version. It is safe to use, therefore, if- the mutable version is never modified after the freeze operation.-- The non-copying implementation is supported between certain pairs- of array types only; one constraint is that the array types must- have identical representations. In GHC, The following pairs of- array types have a non-copying O(1) implementation of- 'unsafeFreeze'. Because the optimised versions are enabled by- specialisations, you will need to compile with optimisation (-O) to- get them.-- * 'Data.Array.IO.IOUArray' -> 'Data.Array.Unboxed.UArray'-- * 'Data.Array.ST.STUArray' -> 'Data.Array.Unboxed.UArray'-- * 'Data.Array.IO.IOArray' -> 'Data.Array.Array'-- * 'Data.Array.ST.STArray' -> 'Data.Array.Array'--}-{-# INLINE unsafeFreeze #-}-unsafeFreeze :: (Ix i, MArray a e m, IArray b e) => a i e -> m (b i e)-unsafeFreeze = U.unsafeFreeze--{- |- Converts an immutable array into a mutable array. The- implementation may either simply cast the array from- one type to the other without copying the array, or it- may take a full copy of the array.-- Note that because the array is possibly not copied, any subsequent- modifications made to the mutable version of the array may be- shared with the immutable version. It is only safe to use,- therefore, if the immutable array is never referenced again in this- thread, and there is no possibility that it can be also referenced- in another thread. If you use an unsafeThaw/write/unsafeFreeze- sequence in a multi-threaded setting, then you must ensure that- this sequence is atomic with respect to other threads, or a garbage- collector crash may result (because the write may be writing to a- frozen array).-- The non-copying implementation is supported between certain pairs- of array types only; one constraint is that the array types must- have identical representations. In GHC, The following pairs of- array types have a non-copying O(1) implementation of- 'unsafeThaw'. Because the optimised versions are enabled by- specialisations, you will need to compile with optimisation (-O) to- get them.-- * 'Data.Array.Unboxed.UArray' -> 'Data.Array.IO.IOUArray'-- * 'Data.Array.Unboxed.UArray' -> 'Data.Array.ST.STUArray'-- * 'Data.Array.Array' -> 'Data.Array.IO.IOArray'-- * 'Data.Array.Array' -> 'Data.Array.ST.STArray'--}-{-# INLINE unsafeThaw #-}-unsafeThaw :: (Ix i, IArray a e, MArray b e m) => a i e -> m (b i e)-unsafeThaw = U.unsafeThaw-
Data/Array/MArray/Safe.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE Trustworthy #-}+{-# LANGUAGE CPP, Trustworthy #-} ----------------------------------------------------------------------------- -- | -- Module : Data.Array.MArray.Safe@@ -15,6 +15,7 @@ -- . -- Safe API only of "Data.Array.MArray". --+-- /Since: 0.4.0.0/ ----------------------------------------------------------------------------- module Data.Array.MArray.Safe (
Data/Array/ST.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE RankNTypes #-} ----------------------------------------------------------------------------- -- | -- Module : Data.Array.ST@@ -20,7 +21,6 @@ -- * Unboxed arrays STUArray, -- instance of: Eq, MArray runSTUArray,- castSTUArray, -- :: STUArray s i a -> ST s (STUArray s i b) -- * Overloaded mutable array interface module Data.Array.MArray,@@ -28,17 +28,9 @@ import Data.Array.Base ( STUArray, UArray, unsafeFreezeSTUArray ) import Data.Array.MArray-import qualified Data.Array.Unsafe as U ( castSTUArray ) import Control.Monad.ST ( ST, runST ) -#ifdef __HUGS__-import Hugs.Array ( Array )-import Hugs.ST ( STArray, unsafeFreezeSTArray )-#endif--#ifdef __GLASGOW_HASKELL__ import GHC.Arr ( STArray, Array, unsafeFreezeSTArray )-#endif -- | A safe way to create and work with a mutable array before returning an -- immutable array for later perusal. This function avoids copying@@ -73,15 +65,3 @@ -- unsafeFreezeSTUArray directly in the defn of runSTUArray above, but -- this essentially constrains us to a single unsafeFreeze for all STUArrays -- (in theory we might have a different one for certain element types).--{-# DEPRECATED castSTUArray- "Please import from Data.Array.Unsafe instead; This will be removed in the next release"- #-}---- | Casts an 'STUArray' with one element type into one with a--- different element type. All the elements of the resulting array--- are undefined (unless you know what you\'re doing...).-{-# INLINE castSTUArray #-}-castSTUArray :: STUArray s ix a -> ST s (STUArray s ix b)-castSTUArray = U.castSTUArray-
Data/Array/ST/Safe.hs view
@@ -13,6 +13,7 @@ -- -- Safe API only of "Data.Array.ST". --+-- /Since: 0.4.0.0/ ----------------------------------------------------------------------------- module Data.Array.ST.Safe (
Data/Array/Storable.hs view
@@ -34,25 +34,7 @@ withStorableArray, -- :: StorableArray i e -> (Ptr e -> IO a) -> IO a touchStorableArray, -- :: StorableArray i e -> IO ()-- unsafeForeignPtrToStorableArray ) where -import Foreign hiding (newArray)- import Data.Array.MArray-import Data.Array.Storable.Internals hiding ( unsafeForeignPtrToStorableArray )-import qualified Data.Array.Unsafe as U ( unsafeForeignPtrToStorableArray )--{-# DEPRECATED unsafeForeignPtrToStorableArray- "Please import from Data.Array.Unsafe instead; This will be removed in the next release"- #-}---- |Construct a 'StorableArray' from an arbitrary 'ForeignPtr'. It is--- the caller's responsibility to ensure that the 'ForeignPtr' points to--- an area of memory sufficient for the specified bounds.-{-# INLINE unsafeForeignPtrToStorableArray #-}-unsafeForeignPtrToStorableArray- :: Ix i => ForeignPtr e -> (i,i) -> IO (StorableArray i e)-unsafeForeignPtrToStorableArray = U.unsafeForeignPtrToStorableArray-+import Data.Array.Storable.Internals
Data/Array/Storable/Internals.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE FlexibleInstances, MultiParamTypeClasses #-} {-# OPTIONS_HADDOCK hide #-} ----------------------------------------------------------------------------- -- |@@ -11,9 +12,9 @@ -- -- Actual implementation of "Data.Array.Storable". --+-- /Since: 0.4.0.0/ ----------------------------------------------------------------------------- --- #hide module Data.Array.Storable.Internals ( StorableArray(..), withStorableArray,
Data/Array/Storable/Safe.hs view
@@ -20,6 +20,7 @@ -- -- Safe API only of "Data.Array.Storable". --+-- /Since: 0.4.0.0/ ----------------------------------------------------------------------------- module Data.Array.Storable.Safe (
Data/Array/Unsafe.hs view
@@ -11,6 +11,7 @@ -- Contains the various unsafe operations that can be performed -- on arrays. --+-- /Since: 0.4.0.0/ ----------------------------------------------------------------------------- module Data.Array.Unsafe (
array.cabal view
@@ -1,30 +1,51 @@-name: array-version: 0.4.0.1-license: BSD3-license-file: LICENSE+name: array+version: 0.5.0.0+-- GHC 7.6.1 released with 0.4.0.1+license: BSD3+license-file: LICENSE maintainer: libraries@haskell.org-bug-reports: http://hackage.haskell.org/trac/ghc/newticket?component=libraries%20%28other%29-synopsis: Mutable and immutable arrays-category: Data Structures+bug-reports: http://ghc.haskell.org/trac/ghc/newticket?component=libraries%20%28other%29&keywords=array+synopsis: Mutable and immutable arrays+category: Data Structures+build-type: Simple+cabal-version: >=1.10+tested-with: GHC==7.6.3, GHC==7.6.2, GHC==7.6.1, GHC==7.4.2, GHC==7.4.1 description:- This package defines the classes @IArray@ of immutable arrays and- @MArray@ of arrays mutable within appropriate monads, as well as- some instances of these classes.-cabal-version: >=1.6-build-type: Simple-extra-source-files: include/Typeable.h+ In addition to providing the "Data.Array" module+ <http://www.haskell.org/onlinereport/haskell2010/haskellch14.html as specified in the Haskell 2010 Language Report>,+ this package also defines the classes 'IArray' of+ immutable arrays and 'MArray' of arrays mutable within appropriate+ monads, as well as some instances of these classes. +extra-source-files: changelog+ source-repository head- type: git- location: http://darcs.haskell.org/packages/array.git/+ type: git+ location: http://git.haskell.org/packages/array.git +source-repository this+ type: git+ location: http://git.haskell.org/packages/array.git+ tag: array-0.5.0.0-release+ library- build-depends: base >= 4.2 && < 5+ default-language: Haskell2010+ other-extensions:+ BangPatterns,+ CPP,+ DeriveDataTypeable,+ FlexibleContexts,+ FlexibleInstances,+ MagicHash,+ MultiParamTypeClasses,+ RankNTypes,+ Trustworthy,+ UnboxedTuples,+ UnliftedFFITypes+ build-depends: base >= 4.5 && < 4.8+ ghc-options: -Wall exposed-modules: Data.Array- extensions: CPP- if !impl(nhc98)- exposed-modules: Data.Array.Base Data.Array.IArray Data.Array.IO@@ -39,18 +60,3 @@ Data.Array.Storable.Internals Data.Array.Unboxed Data.Array.Unsafe- extensions:- MultiParamTypeClasses,- FlexibleContexts,- FlexibleInstances,- TypeSynonymInstances- if impl(ghc)- extensions:- DeriveDataTypeable,- StandaloneDeriving,- Rank2Types,- MagicHash,- UnboxedTuples,- ForeignFunctionInterface,- UnliftedFFITypes- include-dirs: include
+ changelog view
@@ -0,0 +1,23 @@+-*-change-log-*-++0.5.0.0 Nov 2013+ * Update to Cabal 1.10 format+ * Remove NHC and Hugs specific code+ * Remove deprecated function exports `Data.Array.IO.castIOUArray`,+ `Data.Array.MArray.unsafeFreeze`, `Data.Array.MArray.unsafeThaw`,+ and `Data.Array.ST.castSTUArray`; These functions are still+ available from the "Data.Array.Unsafe" module.++0.4.0.1 Sep 2012+ * Bundled with GHC 7.6.1+ * Fix inline rule shadowing warnings++0.4.0.0 Feb 2012+ * Bundled with GHC 7.4.1+ * Add support for SafeHaskell+ * New "Data.Array.IO.Safe" module+ * New "Data.Array.MArray.safe" module+ * New "Data.Array.ST.safe" module+ * New "Data.Array.Storable.Internals" module+ * New "Data.Array.Storable.Safe" module+ * New "Data.Array.Unsafe" module
− include/Typeable.h
@@ -1,59 +0,0 @@-{- ---------------------------------------------------------------------------// Macros to help make Typeable instances.-//-// INSTANCE_TYPEABLEn(tc,tcname,"tc") defines-//-// instance Typeable/n/ tc-// instance Typeable a => Typeable/n-1/ (tc a)-// instance (Typeable a, Typeable b) => Typeable/n-2/ (tc a b)-// ...-// instance (Typeable a1, ..., Typeable an) => Typeable (tc a1 ... an)-// ----------------------------------------------------------------------------}--#ifndef TYPEABLE_H-#define TYPEABLE_H--#ifdef __GLASGOW_HASKELL__---- // For GHC, we can use DeriveDataTypeable + StandaloneDeriving to--- // generate the instances.--#define INSTANCE_TYPEABLE0(tycon,tcname,str) deriving instance Typeable tycon-#define INSTANCE_TYPEABLE1(tycon,tcname,str) deriving instance Typeable1 tycon-#define INSTANCE_TYPEABLE2(tycon,tcname,str) deriving instance Typeable2 tycon-#define INSTANCE_TYPEABLE3(tycon,tcname,str) deriving instance Typeable3 tycon--#else /* !__GLASGOW_HASKELL__ */--#define INSTANCE_TYPEABLE0(tycon,tcname,str) \-tcname :: TyCon; \-tcname = mkTyCon str; \-instance Typeable tycon where { typeOf _ = mkTyConApp tcname [] }--#define INSTANCE_TYPEABLE1(tycon,tcname,str) \-tcname = mkTyCon str; \-instance Typeable1 tycon where { typeOf1 _ = mkTyConApp tcname [] }; \-instance Typeable a => Typeable (tycon a) where { typeOf = typeOfDefault }--#define INSTANCE_TYPEABLE2(tycon,tcname,str) \-tcname = mkTyCon str; \-instance Typeable2 tycon where { typeOf2 _ = mkTyConApp tcname [] }; \-instance Typeable a => Typeable1 (tycon a) where { \- typeOf1 = typeOf1Default }; \-instance (Typeable a, Typeable b) => Typeable (tycon a b) where { \- typeOf = typeOfDefault }--#define INSTANCE_TYPEABLE3(tycon,tcname,str) \-tcname = mkTyCon str; \-instance Typeable3 tycon where { typeOf3 _ = mkTyConApp tcname [] }; \-instance Typeable a => Typeable2 (tycon a) where { \- typeOf2 = typeOf2Default }; \-instance (Typeable a, Typeable b) => Typeable1 (tycon a b) where { \- typeOf1 = typeOf1Default }; \-instance (Typeable a, Typeable b, Typeable c) => Typeable (tycon a b c) where { \- typeOf = typeOfDefault }--#endif /* !__GLASGOW_HASKELL__ */--#endif