data Black = Black data BW > Black = White data Color > BW = Red struct Point = x :: Int y :: Int struct CPoint < Point = col :: Color colnr :: Color -> Int colnr c = 1 pt = {x = 1; y = 2} cpt = {x= 1; y = 2; col = Red} match Black = True match White = False cmatch Black = True cmatch White = False cmatch Red = False addpt p = p.x + p.y addcpt p = p.x + (colnr p.col) mkbw True = Black mkbw False = White mkcol True = Black mkcol False = Red -- should fail: -- -- {x = 1; col = Red} -- will currently not fail: incomplete Black = 1 incomplete Red = 3 f p = if cmatch p.col then p else pt