A few days ago I was motivated to write a program in Haskell to test whether
three numbers form a Pythagorean triple. There is an obvious solution, of
course, but it’s always nice to shove monads in to problems that don’t need
them. In this case, though, I found that the resulting solution did more than
I had originally planned: if you pass the
pTriples function a list of
numbers, it will return a list of each Pythagorean triple that can be made
from numbers in the list (without replacement). Cool!