[commit: packages/array] master: Remove redundant constraints, discovered by -fwarn-redundant-constraints (c9f2071)
git at git.haskell.org
git at git.haskell.org
Tue Jan 6 12:15:35 UTC 2015
Repository : ssh://git@git.haskell.org/array
On branch : master
Link : http://git.haskell.org/packages/array.git/commitdiff/c9f207182d4c0a4fcfaaabffb5ed759b99913bb5
>---------------------------------------------------------------
commit c9f207182d4c0a4fcfaaabffb5ed759b99913bb5
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date: Tue Jan 6 12:15:33 2015 +0000
Remove redundant constraints, discovered by -fwarn-redundant-constraints
>---------------------------------------------------------------
c9f207182d4c0a4fcfaaabffb5ed759b99913bb5
Data/Array/Base.hs | 14 +++++++-------
Data/Array/IO/Internals.hs | 8 ++++----
Data/Array/ST.hs | 8 +++-----
3 files changed, 14 insertions(+), 16 deletions(-)
diff --git a/Data/Array/Base.hs b/Data/Array/Base.hs
index e00a97d..d632e10 100644
--- a/Data/Array/Base.hs
+++ b/Data/Array/Base.hs
@@ -1390,7 +1390,7 @@ freeze marr = do
-- use the safe array creation function here.
return (listArray (l,u) es)
-freezeSTUArray :: Ix i => STUArray s i e -> ST s (UArray i e)
+freezeSTUArray :: STUArray s i e -> ST s (UArray i e)
freezeSTUArray (STUArray l u n marr#) = ST $ \s1# ->
case sizeofMutableByteArray# marr# of { n# ->
case newByteArray# n# s1# of { (# s2#, marr'# #) ->
@@ -1465,7 +1465,7 @@ thaw arr = case bounds arr of
| i <- [0 .. n - 1]]
return marr
-thawSTUArray :: Ix i => UArray i e -> ST s (STUArray s i e)
+thawSTUArray :: UArray i e -> ST s (STUArray s i e)
thawSTUArray (UArray l u n arr#) = ST $ \s1# ->
case sizeofByteArray# arr# of { n# ->
case newByteArray# n# s1# of { (# s2#, marr# #) ->
@@ -1525,7 +1525,7 @@ unsafeThaw :: (Ix i, IArray a e, MArray b e m) => a i e -> m (b i e)
unsafeThaw = thaw
{-# INLINE unsafeThawSTUArray #-}
-unsafeThawSTUArray :: Ix i => UArray i e -> ST s (STUArray s i e)
+unsafeThawSTUArray :: UArray i e -> ST s (STUArray s i e)
unsafeThawSTUArray (UArray l u n marr#) =
return (STUArray l u n (unsafeCoerce# marr#))
@@ -1535,7 +1535,7 @@ unsafeThawSTUArray (UArray l u n marr#) =
#-}
{-# INLINE unsafeThawIOArray #-}
-unsafeThawIOArray :: Ix ix => Arr.Array ix e -> IO (IOArray ix e)
+unsafeThawIOArray :: Arr.Array ix e -> IO (IOArray ix e)
unsafeThawIOArray arr = stToIO $ do
marr <- ArrST.unsafeThawSTArray arr
return (IOArray marr)
@@ -1544,7 +1544,7 @@ unsafeThawIOArray arr = stToIO $ do
"unsafeThaw/IOArray" unsafeThaw = unsafeThawIOArray
#-}
-thawIOArray :: Ix ix => Arr.Array ix e -> IO (IOArray ix e)
+thawIOArray :: Arr.Array ix e -> IO (IOArray ix e)
thawIOArray arr = stToIO $ do
marr <- ArrST.thawSTArray arr
return (IOArray marr)
@@ -1553,7 +1553,7 @@ thawIOArray arr = stToIO $ do
"thaw/IOArray" thaw = thawIOArray
#-}
-freezeIOArray :: Ix ix => IOArray ix e -> IO (Arr.Array ix e)
+freezeIOArray :: IOArray ix e -> IO (Arr.Array ix e)
freezeIOArray (IOArray marr) = stToIO (ArrST.freezeSTArray marr)
{-# RULES
@@ -1561,7 +1561,7 @@ freezeIOArray (IOArray marr) = stToIO (ArrST.freezeSTArray marr)
#-}
{-# INLINE unsafeFreezeIOArray #-}
-unsafeFreezeIOArray :: Ix ix => IOArray ix e -> IO (Arr.Array ix e)
+unsafeFreezeIOArray :: IOArray ix e -> IO (Arr.Array ix e)
unsafeFreezeIOArray (IOArray marr) = stToIO (ArrST.unsafeFreezeSTArray marr)
{-# RULES
diff --git a/Data/Array/IO/Internals.hs b/Data/Array/IO/Internals.hs
index 1a015d9..6c91d7c 100644
--- a/Data/Array/IO/Internals.hs
+++ b/Data/Array/IO/Internals.hs
@@ -375,7 +375,7 @@ castIOUArray (IOUArray marr) = stToIO $ do
return (IOUArray marr')
{-# INLINE unsafeThawIOUArray #-}
-unsafeThawIOUArray :: Ix ix => UArray ix e -> IO (IOUArray ix e)
+unsafeThawIOUArray :: UArray ix e -> IO (IOUArray ix e)
unsafeThawIOUArray arr = stToIO $ do
marr <- unsafeThawSTUArray arr
return (IOUArray marr)
@@ -384,7 +384,7 @@ unsafeThawIOUArray arr = stToIO $ do
"unsafeThaw/IOUArray" unsafeThaw = unsafeThawIOUArray
#-}
-thawIOUArray :: Ix ix => UArray ix e -> IO (IOUArray ix e)
+thawIOUArray :: UArray ix e -> IO (IOUArray ix e)
thawIOUArray arr = stToIO $ do
marr <- thawSTUArray arr
return (IOUArray marr)
@@ -394,14 +394,14 @@ thawIOUArray arr = stToIO $ do
#-}
{-# INLINE unsafeFreezeIOUArray #-}
-unsafeFreezeIOUArray :: Ix ix => IOUArray ix e -> IO (UArray ix e)
+unsafeFreezeIOUArray :: IOUArray ix e -> IO (UArray ix e)
unsafeFreezeIOUArray (IOUArray marr) = stToIO (unsafeFreezeSTUArray marr)
{-# RULES
"unsafeFreeze/IOUArray" unsafeFreeze = unsafeFreezeIOUArray
#-}
-freezeIOUArray :: Ix ix => IOUArray ix e -> IO (UArray ix e)
+freezeIOUArray :: IOUArray ix e -> IO (UArray ix e)
freezeIOUArray (IOUArray marr) = stToIO (freezeSTUArray marr)
{-# RULES
diff --git a/Data/Array/ST.hs b/Data/Array/ST.hs
index 29bfafb..31e1ed0 100644
--- a/Data/Array/ST.hs
+++ b/Data/Array/ST.hs
@@ -37,8 +37,7 @@ import GHC.Arr ( STArray, Array, unsafeFreezeSTArray )
-- the array before returning it - it uses 'unsafeFreeze' internally, but
-- this wrapper is a safe interface to that function.
--
-runSTArray :: (Ix i)
- => (forall s . ST s (STArray s i e))
+runSTArray :: (forall s . ST s (STArray s i e))
-> Array i e
runSTArray st = runST (st >>= unsafeFreezeSTArray)
@@ -48,9 +47,8 @@ runSTArray st = runST (st >>= unsafeFreezeSTArray)
-- 'unsafeFreeze' internally, but this wrapper is a safe interface to
-- that function.
--
-runSTUArray :: (Ix i)
- => (forall s . ST s (STUArray s i e))
- -> UArray i e
+runSTUArray :: (forall s . ST s (STUArray s i e))
+ -> UArray i e
runSTUArray st = runST (st >>= unsafeFreezeSTUArray)
More information about the ghc-commits
mailing list