X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=Data%2FArray%2FIO%2FInternals.hs;h=8789a94cb9b75b4f9b60ecf6359e3508f0c15b07;hb=2570f264ed329f04017d507250494eb0ab680d64;hp=1479df3c8dd9b2f4eb778b2a1a54ae9f99888974;hpb=b9c2781e05a7cfb8098bbfa2d7946d8fadb9b0f1;p=haskell-directory.git diff --git a/Data/Array/IO/Internals.hs b/Data/Array/IO/Internals.hs index 1479df3..8789a94 100644 --- a/Data/Array/IO/Internals.hs +++ b/Data/Array/IO/Internals.hs @@ -1,4 +1,4 @@ -{-# OPTIONS -#include "HsBase.h" #-} +{-# OPTIONS_GHC -#include "HsBase.h" #-} ----------------------------------------------------------------------------- -- | -- Module : Data.Array.IO.Internal @@ -7,12 +7,13 @@ -- -- Maintainer : libraries@haskell.org -- Stability : experimental --- Portability : non-portable +-- Portability : non-portable (uses Data.Array.Base) -- -- Mutable boxed and unboxed arrays in the IO monad. -- ----------------------------------------------------------------------------- +-- #hide module Data.Array.IO.Internals ( IOArray(..), -- instance of: Eq, Typeable IOUArray(..), -- instance of: Eq, Typeable @@ -24,7 +25,7 @@ import Prelude import Data.Array.MArray import Data.Int import Data.Word -import Data.Dynamic +import Data.Typeable #ifdef __HUGS__ import Hugs.IOArray @@ -40,12 +41,9 @@ import GHC.IOBase import GHC.Base #endif /* __GLASGOW_HASKELL__ */ -iOArrayTc :: TyCon -iOArrayTc = mkTyCon "IOArray" +#include "Typeable.h" -instance (Typeable a, Typeable b) => Typeable (IOArray a b) where - typeOf a = mkAppTy iOArrayTc [typeOf ((undefined :: IOArray a b -> a) a), - typeOf ((undefined :: IOArray a b -> b) a)] +INSTANCE_TYPEABLE2(IOArray,iOArrayTc,"IOArray") ----------------------------------------------------------------------------- -- | Instance declarations for 'IOArray's @@ -72,19 +70,14 @@ instance MArray IOArray e IO where -- | Mutable, unboxed, strict arrays in the 'IO' monad. The type -- arguments are as follows: -- --- * @i@: the index type of the array (should be an instance of @Ix@) +-- * @i@: the index type of the array (should be an instance of 'Ix') -- -- * @e@: the element type of the array. Only certain element types --- are supported: see 'MArray' for a list of instances. +-- are supported: see "Data.Array.MArray" for a list of instances. -- newtype IOUArray i e = IOUArray (STUArray RealWorld i e) -iOUArrayTc :: TyCon -iOUArrayTc = mkTyCon "IOUArray" - -instance (Typeable a, Typeable b) => Typeable (IOUArray a b) where - typeOf a = mkAppTy iOUArrayTc [typeOf ((undefined :: IOUArray a b -> a) a), - typeOf ((undefined :: IOUArray a b -> b) a)] +INSTANCE_TYPEABLE2(IOUArray,iOUArrayTc,"IOUArray") instance HasBounds IOUArray where {-# INLINE bounds #-} @@ -126,7 +119,6 @@ instance MArray IOUArray Int IO where {-# INLINE unsafeWrite #-} unsafeWrite (IOUArray marr) i e = stToIO (unsafeWrite marr i e) -#ifdef __GLASGOW_HASKELL__ instance MArray IOUArray Word IO where {-# INLINE newArray #-} newArray lu init = stToIO $ do @@ -138,7 +130,6 @@ instance MArray IOUArray Word IO where unsafeRead (IOUArray marr) i = stToIO (unsafeRead marr i) {-# INLINE unsafeWrite #-} unsafeWrite (IOUArray marr) i e = stToIO (unsafeWrite marr i e) -#endif instance MArray IOUArray (Ptr a) IO where {-# INLINE newArray #-} @@ -303,3 +294,4 @@ castIOUArray :: IOUArray ix a -> IO (IOUArray ix b) castIOUArray (IOUArray marr) = stToIO $ do marr' <- castSTUArray marr return (IOUArray marr') +