X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=Foreign%2FMarshal%2FArray.hs;h=89859d458b52759270e2b42dc731c0862331515f;hb=1a2d88a60a8e2c8be84879d79f148d4c6ceb348e;hp=a3d9d1639ced5b3f9e07bccd32a130f5afb94cb9;hpb=fb80d56c0b7617261c93a808e9001bbb25a7562e;p=ghc-base.git diff --git a/Foreign/Marshal/Array.hs b/Foreign/Marshal/Array.hs index a3d9d16..89859d4 100644 --- a/Foreign/Marshal/Array.hs +++ b/Foreign/Marshal/Array.hs @@ -68,11 +68,12 @@ import Foreign.Marshal.Alloc (mallocBytes, allocaBytes, reallocBytes) import Foreign.Marshal.Utils (copyBytes, moveBytes) #ifdef __GLASGOW_HASKELL__ -import GHC.IOBase import GHC.Num import GHC.List import GHC.Err import GHC.Base +#else +import Control.Monad (zipWithM_) #endif -- allocation @@ -150,8 +151,8 @@ pokeArray :: Storable a => Ptr a -> [a] -> IO () #ifndef __GLASGOW_HASKELL__ pokeArray ptr vals = zipWithM_ (pokeElemOff ptr) [0..] vals #else -pokeArray ptr vals = go vals 0# - where go [] n# = return () +pokeArray ptr vals0 = go vals0 0# + where go [] _ = return () go (val:vals) n# = do pokeElemOff ptr (I# n#) val; go vals (n# +# 1#) #endif @@ -164,7 +165,7 @@ pokeArray0 marker ptr vals = do pokeArray ptr vals pokeElemOff ptr (length vals) marker #else -pokeArray0 marker ptr vals = go vals 0# +pokeArray0 marker ptr vals0 = go vals0 0# where go [] n# = pokeElemOff ptr (I# n#) marker go (val:vals) n# = do pokeElemOff ptr (I# n#) val; go vals (n# +# 1#) #endif