1 definition module Figure
3 /** Example library to demonstrate the use of Existential Types.
4 The library implements a simple set of drawing objects.
13 // drawFigure f creates a window in which f is displayed
14 drawFigure :: Figure -> *World -> *World
16 // convenient lifting operations on the methods of a figure to the figure self
17 move :: Vector2 Figure -> Figure
19 // Specialized Figure constructor functions:
20 // mkFigures figs combines all figs in left-to-right order
21 mkFigures :: [Figure] -> Figure
23 // line a b draws a line from a to b
24 line :: Point2 Point2 -> Figure
26 // rectangle a b forms a rectangle with diagonal-points a and b
27 rectangle :: Point2 Point2 -> Figure
29 // ellips a b forms an ellips that fits in the rectangle with diagonal-points a and b
30 ellips :: Point2 Point2 -> Figure
32 // text t a shows a text t with left-top corner at a
33 text :: String Point2 -> Figure