The principle behind getting those parameters out is pattern matching, like so:
case rect of
Rectangle x y w h -> "The width is " ++ show w ++ " and the height is " ++ show h
This will assign the width and the height to w
and h
inside the case expression.
In a specific setting this could possibly be made shorter (by pattern matching directly on the argument to a function, by assigning the rect
value to a pattern and so on) but pattern matching like this is the main principle.