     (nx,ny) = bandBlockCount b
     (sx,sy) = bandBlockSize b
     (bx,by) = bandSize b
-{-# INLINE foldlM' #-}
+{-# INLINE ifoldlM' #-}
 
 writeBandBlock
   :: forall s a. GDALType a

                    Nothing -> Value
                    Just nd ->
                      \v -> if toNodata v == nd then NoData else Value v
        applyTo i j acc = f acc . toValue =<< peekElemOff ptr (j*sx+i)
        goB !iB !jB !acc
          | iB < nx   = do
              throwIfError "could not read block" $

          | jB+1 < ny = goB 0 (jB+1) acc
          | otherwise = return acc
          where
            applyTo i j acc = f acc x y . toValue =<< peekElemOff ptr (j*sx+i)
              where x = iB*sx+i
                    y = jB*sy+j
            stopx
              | mx /= 0 && iB==nx-1 = mx
              | otherwise           = sx
