I need to split a list into a list of all possible tuples, but I'm unsure of how to do so.
For example
pairs ["cat","dog","mouse"]
should result in
[("cat","dog"), ("cat","mouse"), ("dog","cat"), ("dog","mouse"), ("mouse","cat"), ("mouse","dog")]
I was able to form the first two, but am unsure of how to get the rest.
Here's what I have so far:
pairs :: [a] -> [(a,a)]
pairs (x:xs) = [(m,n) | m <- [x], n <- xs]