>>530

newtype Vec2 a = Vec2 {toTuple: (a, a)}
v1 `add` v2 = Vec2 (x0+x1, y0+y1)
where
(x0, y0) = toTuple v1
(x1, y1) = toTuple v2

Vec2の定義を変えた場合はtoTupleの定義を変える。