From b16ebd3d4e9107a3cb5e255e08f54d0e5678437d Mon Sep 17 00:00:00 2001
From: Herbert Valerio Riedel <hvr@gnu.org>
Date: Wed, 7 Sep 2011 09:49:43 +0200
Subject: [PATCH] Implement NFData instance for Array

The implementation is basically the same that was formely
defined in the `deepseq` package.

This adds a dependancy to the `deepseq` package

See #5468 for more information about this change.
---
 Data/Array.hs |    5 +++++
 array.cabal   |    4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/Data/Array.hs b/Data/Array.hs
index 43e9efd..221e182 100644
--- a/Data/Array.hs
+++ b/Data/Array.hs
@@ -55,6 +55,7 @@ module Data.Array (
 
 import Data.Ix
 import Data.Typeable ()
+import Control.DeepSeq (NFData(rnf))
 
 #ifdef __GLASGOW_HASKELL__
 import GHC.Arr  -- Most of the hard work is done here
@@ -68,6 +69,10 @@ import Hugs.Array
 import Array    -- Haskell'98 arrays
 #endif
 
+-- generic/unoptimized 'rnf' implementation
+instance (Ix a, NFData a, NFData b) => NFData (Array a b) where
+    rnf x = rnf (bounds x) `seq` rnf (elems x)
+
 {- $intro
 Haskell provides indexable /arrays/, which may be thought of as functions
 whose domains are isomorphic to contiguous subsets of the integers.
diff --git a/array.cabal b/array.cabal
index 00d7653..9e8008b 100644
--- a/array.cabal
+++ b/array.cabal
@@ -1,5 +1,5 @@
 name:       array
-version:    0.3.0.3
+version:    0.4.0.0
 license:    BSD3
 license-file:    LICENSE
 maintainer:    libraries@haskell.org
@@ -19,7 +19,7 @@ source-repository head
     location: http://darcs.haskell.org/packages/array.git/
 
 library
-  build-depends: base >= 4.2 && < 5
+  build-depends: base >= 4.2 && < 5, deepseq >= 1.3 && < 1.4
   exposed-modules:
       Data.Array
   extensions: CPP
-- 
1.7.4.1

