I tried to make an nearly empty grid 1000 by 1000 cells, but after it used 40 GB of system memory I had to kill it. Sample code:
{-# LANGUAGE NoMonomorphismRestriction #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
module Main where
import Control.Lens hiding ((#))
import Data.Default
import Data.List
import Data.List.Split
import Data.Typeable
import Diagrams.Backend.SVG.CmdLine
import Diagrams.Prelude
import Diagrams.TwoD
default (Int)
example :: Int -> Int -> [((Int, Int), (Double, Double), Colour Double)]
-> Diagram B
example n m =
foldr (\((x, y), (w, h), c) -> situate x y w h c)
$ gridWithHalves n m
where
situate x y w h c =
flip placeDiagramOnGrid [((x*2)+1, (y*2)+1) :: (Int, Int)]
$ rect (w / fromIntegral n) (h / fromIntegral m)
# alignTL
# lc c
# fc c
main :: IO ()
main = mainWith $ example 1000 1000 shapes
where
shapes = [ ((3, 4), (2, 2), black)
, ((5, 7), (3, 1), red)
]
I tried to make an nearly empty grid 1000 by 1000 cells, but after it used 40 GB of system memory I had to kill it. Sample code: