imageToGrid :: Image.RGB -> Grid
imageToGrid (Image.Manifest manifestSize manifestVector) =
  let
    image             = Storable.toList manifestVector
    (Coord x y)       = dim2ToCoord manifestSize
    dims              = (GridDims x y)
    squares           = map colorToSquare image
    squaresWithIndices = zip [0..] squares
    squaresWithCoords = [(dim2ToCoord (fromLinearIndex manifestSize index), sq)
                        | (index, sq) <- squaresWithIndices]
    grid              = Unboxed.fromList squares
    in Grid dims grid
imageToGrid :: Image.RGB -> Grid
imageToGrid (Image.Manifest manifestSize manifestVector) =
  let
    image             = Storable.toList manifestVector
    (Coord x y)       = dim2ToCoord manifestSize
    dims              = (GridDims x y)
    squares           = map colorToSquare image
    squaresWithIndices = zip [0..] squares
    squaresWithCoords = [(dim2ToCoord (fromLinearIndex manifestSize index), sq)
                        | (index, sq) <- squaresWithIndices]
    grid              = Unboxed.fromList squares
    in Grid dims grid
imageToGrid (Image.Manifest manifestSize manifestVector) =
  let
    image             = Storable.toList manifestVector
    (Coord x y)       = dim2ToCoord manifestSize
    dims              = (GridDims x y)
    squares           = map colorToSquare image
    squaresWithIndices = zip [0..] squares
    squaresWithCoords = [(dim2ToCoord (fromLinearIndex manifestSize index), sq)
                        | (index, sq) <- squaresWithIndices]
    grid              = Unboxed.fromList squares
    in Grid dims grid