Solution

ID: past-exam-of-the-year-1-of-the-computer-science-course-of-the-university-of-oxford/2014/functional-programming-design-and-analysis-of-algorithms/2/a/solution

Swap the components of every ordered pair using a list comprehension:
invert :: [(a, a)] -> [(a, a)]
invert r = [(y, x) | (x, y) <- r]
Thus , the converse relation. Swapping is a bijection, since doing it twice restores the original pair. Therefore distinct input pairs remain distinct; no equality constraint or duplicate removal is necessary.

New to topics? Read the docs here!