[Haskell-cafe] Statements spanning multiple lines?
J. Garrett Morris
trevion at gmail.com
Thu Dec 22 11:40:42 EST 2005
On 12/22/05, Daniel Carrera <daniel.carrera at zmsl.com> wrote:
> Hi all,
> How do I write a statement that spans multiple lines?
> I have this function:
> pythagoras n = [(a,b,c) | a <-[1..n], b <-[1..n], c <-[1..n], a <= b, b
> < c, a*a + b*b == c*c]
> This should all be in one line. I know some ways to make the line
> shorter, like defining local functions and using 'filter'. But the code
> would be clearer if I could just make this one statement span several lines.
Indent the second line:
pythagoras n = [(a,b,c) | a <-[1..n], b <-[1..n], c <-[1..n], a <= b, b
< c, a*a + b*b == c*c]
We have lingered in the chambers of the sea
By sea-girls wreathed with seaweed red and brown
Till human voices wake us, and we drown.
More information about the Haskell-Cafe