X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=Data%2FArray%2FDiff.hs;h=5bcaba5c7efa83e935686bff0e0629c6b5af7bda;hb=9fa9bc17072a58c0bae2cce4764d38677e96ac29;hp=2ef109fd5d5ad9b4e29acba641cbbe8516a28190;hpb=23f43c48018638acbbf533447e74e08bf9fd789a;p=ghc-base.git diff --git a/Data/Array/Diff.hs b/Data/Array/Diff.hs index 2ef109f..5bcaba5 100644 --- a/Data/Array/Diff.hs +++ b/Data/Array/Diff.hs @@ -1,5 +1,5 @@ ----------------------------------------------------------------------------- --- +-- | -- Module : Data.Array.Diff -- Copyright : (c) The University of Glasgow 2001 -- License : BSD-style (see the file libraries/core/LICENSE) @@ -8,7 +8,7 @@ -- Stability : experimental -- Portability : non-portable -- --- $Id: Diff.hs,v 1.1 2001/07/04 10:48:39 simonmar Exp $ +-- $Id: Diff.hs,v 1.3 2002/04/24 16:31:43 simonmar Exp $ -- -- Functional arrays with constant-time update. -- @@ -104,6 +104,51 @@ type DiffUArray = IOToDiffArray IOUArray -- -fallow-undecidable-instances, so each instance is separate here. ------------------------------------------------------------------------ +-- Showing DiffArrays + +instance (Ix ix, Show ix, Show e) => Show (DiffArray ix e) where + showsPrec = showsIArray + +instance (Ix ix, Show ix) => Show (DiffUArray ix Char) where + showsPrec = showsIArray + +instance (Ix ix, Show ix) => Show (DiffUArray ix Int) where + showsPrec = showsIArray + +instance (Ix ix, Show ix) => Show (DiffUArray ix Word) where + showsPrec = showsIArray + +instance (Ix ix, Show ix) => Show (DiffUArray ix Float) where + showsPrec = showsIArray + +instance (Ix ix, Show ix) => Show (DiffUArray ix Double) where + showsPrec = showsIArray + +instance (Ix ix, Show ix) => Show (DiffUArray ix Int8) where + showsPrec = showsIArray + +instance (Ix ix, Show ix) => Show (DiffUArray ix Int16) where + showsPrec = showsIArray + +instance (Ix ix, Show ix) => Show (DiffUArray ix Int32) where + showsPrec = showsIArray + +instance (Ix ix, Show ix) => Show (DiffUArray ix Int64) where + showsPrec = showsIArray + +instance (Ix ix, Show ix) => Show (DiffUArray ix Word8) where + showsPrec = showsIArray + +instance (Ix ix, Show ix) => Show (DiffUArray ix Word16) where + showsPrec = showsIArray + +instance (Ix ix, Show ix) => Show (DiffUArray ix Word32) where + showsPrec = showsIArray + +instance (Ix ix, Show ix) => Show (DiffUArray ix Word64) where + showsPrec = showsIArray + +------------------------------------------------------------------------ -- Boring instances. instance HasBounds a => HasBounds (IOToDiffArray a) where @@ -194,6 +239,8 @@ instance IArray (IOToDiffArray IOUArray) Word64 where unsafeAt a i = unsafePerformIO $ a `readDiffArray` i unsafeReplace a ies = unsafePerformIO $ a `replaceDiffArray` ies + + ------------------------------------------------------------------------ -- The important stuff.