I have a tuple study that I want to write out in Haskell. It's given that S = {〈x, y〉| 2x + y = 7, x ∈B, y ∈B }, where B = {1, 2.. 20}. I figured out that the answer is S = {〈1, 5〉,〈2, 3〉,〈3, 1〉}. However, when I type it out in a online Haskell compiler https://app.codingrooms.com/w/Yr2VJHj0yb9S, I either get way too many tuples, or I get an error message Snapshot, Haskell compiler . I've tried changing up the code by separating x and y, or by alterating between parenthesis and square brackets, but I haven't had any success. Does anyone have any advice for me? Thanks in advance!
Code in Haskell compiler:
b = [1, 2.. 20]
s = [(x,y)|x <- b, y <- b, let 2*x + y = 7]
main = do
print s