This small example quickly uses many GB RAM (seemingly unbounded) without doing anything useful. Better would be to bail out early with an exception (perhaps Overflow :: ArithException ? not sure which is best). I also expect bad behaviour from NaN but i haven't explicitly tested yet.
import Codec.Picture( PixelRGBA8( .. ), writePng )
import Graphics.Rasterific
import Graphics.Rasterific.Texture
main :: IO ()
main = do
let white = PixelRGBA8 255 255 255 255
drawColor = PixelRGBA8 0 0x86 0xc1 255
img = renderDrawing 400 200 white $
withTexture (uniformTexture drawColor) $ do
fill $ circle (V2 0 0) 1e50 -- overflows to Infinity :: Float -> boom
writePng "bug.png" img
This small example quickly uses many GB RAM (seemingly unbounded) without doing anything useful. Better would be to bail out early with an exception (perhaps Overflow :: ArithException ? not sure which is best). I also expect bad behaviour from NaN but i haven't explicitly tested yet.