data BW = Black | White data RGB = Red | Green | Blue data Color > BW,RGB = Gray struct Couple a = fst :: a snd :: a struct Triple a < Couple a = thd :: a struct Point = xpos :: Int ypos :: Int struct CPoint < Point = color :: Color data Box a = Box a data Box2 a > Box a = Box2 a opA :: Box Point -> Int opB :: Box2 CPoint -> Int opC :: Triple Point -> Int opD :: Couple CPoint -> Int opA = undefined opB = undefined opC = undefined opD = undefined p1 = {fst = Black; snd = White} p2 = {fst = Black; snd = Red} t1 = {fst = Black; snd = White; thd = White} t2 = {fst = Black; snd = White; thd = Red} t3 = {fst = Black; snd = Red; thd = White} mergetest1 f = ((f 1).xpos, (f 0).color) mergetest2 x = case x of {Box a -> case x of {Box2 c -> (3, a.color); Box d -> (d.ypos, a.color)}} mergetest3 x = case x of {Box2 c -> case x of {Box a -> (3, a.color)}; Box d -> (d.ypos, d.color)} mergetest4 b = (opA b, opB b) mergetest5 b = (opC b, opD b)