eklavya 2017-02-22 22:58:36
please help?
int-e 2017-02-22 23:05:01
eklavya: please paste complete error messages with such questions, they contain important information. For example, "In the first argument of '(>)', namely '(M.read v l)'" <-- this indicates that you are using a monadic action as an argument to a comparison. Indeed, (M.read v l) > (M.read v i) cannot work, you need to do those reads as part of the monadic code (in the do block), and then...
int-e 2017-02-22 23:05:07
...compare the results.
eklavya 2017-02-22 23:06:55
oh
eklavya 2017-02-22 23:06:56
yes
eklavya 2017-02-22 23:07:05
int-e: let me do that
Cooler 2017-02-22 23:07:42
how do you declare an inner helper function?
liste 2017-02-22 23:08:32
Cooler: using with or let
liste 2017-02-22 23:08:36
where or let*
liste 2017-02-22 23:08:37
not with
liste 2017-02-22 23:09:04
> let innerHelperFunction x = x + 1 in (innerHelperFunction 5) * (innerHelperFunction 6)
lambdabot 2017-02-22 23:09:07
42
eklavya 2017-02-22 23:09:09
int-e: thank you so much :D
eklavya 2017-02-22 23:09:10
that was it
Cooler 2017-02-22 23:09:36
thanks
eklavya 2017-02-22 23:09:50
very hard to figure that out from the error message though and I should have noticed it that it was indeed a monadic action :P
liste 2017-02-22 23:10:07
@let outerFunction x = (innerHelperFunction x) * (innerHelperFunction x) where innerHelperFunction x = x + 1 -- Cooler
lambdabot 2017-02-22 23:10:09
Defined.
liste 2017-02-22 23:10:19
> outerFunction 7
lambdabot 2017-02-22 23:10:22
64
liste 2017-02-22 23:11:19
(note that I shadowed `x', which isn't usually a good practice)