oneCircle = Shape (Ellipse 1 1) manyCircles' = [Translate (x,y) oneCircle | x <- centers, y <- centers] where centers = [0, 2 ..] ++ [-2, -4 ..] manyCirclesRegion = foldl Union Empty manyCircles' rectRegion = Translate (4,0) (Shape (Rectangle 10 2)) fiveCircles' = rectRegion `Intersect` manyCirclesRegion
This is technically correct, but the problem here lies with the inability to lazy evaluate Intersect in a matter similar to take. I'm not sure this could easily be made to work: we would need to define Intersect differently and probably also impose an ordering constraint on Region composition. Even then, I think we still have an ordering problem with the positive-and-negative-infinite list evaluation, whereby a bounded Region and an infinite Region (e.g. a semi-infinite halfplane) would be incompatible (although I could be wrong about this depending on how Haskell's lazy evaluation works exactly).