-- Agh how do monads actually work!?
imagesFromIDXFile :: String -> IO [ImageMatrix]
imagesFromIDXFile path = do
  idxData <- decodeIDXFile path
  let [imageCount, width, height] = DU.toList (idxDimensions $ fromJust idxData)
  let imageData = idxIntContent $ fromJust idxData
  let imageMatrices = chunksOf (width * height) (DU.toList imageData)
  let images = map (\pixels -> ImageMatrix { width = width, height = height, pixels = pixels }) imageMatrices
  return images

-- FIXME: handle case where IDX data has wrong dimensions for labels
imagesFromIDXFile :: String -> IO [ImageMatrix]
imagesFromIDXFile path = do
  idxData <- decodeIDXFile path
  let [imageCount, width, height] = DU.toList (idxDimensions $ fromJust idxData)
  let imageData = idxIntContent $ fromJust idxData
  let imageMatrices = chunksOf (width * height) (DU.toList imageData)
  let images = map (\pixels -> ImageMatrix { width = width, height = height, pixels = pixels }) imageMatrices
  return images

-- FIXME: handle case where IDX data has wrong dimensions for labels
imagesFromIDXFile path = do
  idxData <- decodeIDXFile path
  let [imageCount, width, height] = DU.toList (idxDimensions $ fromJust idxData)
  let imageData = idxIntContent $ fromJust idxData
  let imageMatrices = chunksOf (width * height) (DU.toList imageData)
  let images = map (\pixels -> ImageMatrix { width = width, height = height, pixels = pixels }) imageMatrices
  return images

-- FIXME: handle case where IDX data has wrong dimensions for labels