                     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
            stopx
              | mx /= 0 && iB==nx-1 = mx
              | otherwise           = sx

    (nx,ny) = bandBlockCount b
    (sx,sy) = bandBlockSize b
    (bx,by) = bandSize b
{-# INLINE ifoldlM' #-}

writeBandBlock
  :: forall s a. GDALType a
