r/haskellquestions • • Oct 10 '18

Multiple variables defined inside function

I get error on this code if i want ot declare second variable

foo x =

y + yy

where y = x + 1

yy = (-x)

My example is much more complicated, this is simplifed version. I can't find example of declaring multiple variable inside function. Is this incorect way of thinking and I should add two functions as parameters instead?

0 Upvotes

3 comments sorted by

View all comments

4

u/ihamsa Oct 10 '18

I get error

This is useless.


I'm getting this error:

    funny.hs:3:1: error:
        parse error (possibly incorrect indentation or mismatched brackets)
      |
    3 | y + yy
      | ^

This is something that can be discussed.