-- Convert a grid to a corresponding image
gridToImage :: Grid -> Image.RGB
gridToImage (Grid (GridDims dimx dimy) grid) =
  let
    gridshape  = coordToDim2 (Coord dimx dimy)
    pixels     = map squareToColor (Unboxed.toList grid)
  in Image.Manifest gridshape (Storable.fromList pixels)
gridToImage :: Grid -> Image.RGB
gridToImage (Grid (GridDims dimx dimy) grid) =
  let
    gridshape  = coordToDim2 (Coord dimx dimy)
    pixels     = map squareToColor (Unboxed.toList grid)
  in Image.Manifest gridshape (Storable.fromList pixels)
gridToImage (Grid (GridDims dimx dimy) grid) =
  let
    gridshape  = coordToDim2 (Coord dimx dimy)
    pixels     = map squareToColor (Unboxed.toList grid)
  in Image.Manifest gridshape (Storable.fromList pixels)