Suppose I have the following:
class Shape a where draw a :: a -> IO () data Rectangle = Rectangle Int Int instance Shape Rectangle where draw (Recta
One way to do it would be with vtables:
data Shape = Shape { draw :: IO (), etc :: ... } rectangle :: Int -> Int -> Shape rectangle len width = Shape { draw = ..., etc = ... } circle :: Int -> Int -> Shape circle center radius = Shape { draw = ..., etc = ... }