Explicit function call

Arjan van IJzendoorn afie@cs.uu.nl
Wed, 12 Mar 2003 14:02:41 +0100


> How can I make an explicit function call in a "do" sequence?
>
> Ex:
> ... do let a = myFunc ...
> b = myFunc ...
> c = "Something else"
> return c
> ...
>
> As I understand myFunc will not be executed,

Correct.

> but I need it...

If it has a side effect, it will have type "IO something" (or whatever monad
your using) and you can write:

   do a <- myFunc ...

If it doesn't have a side effect, why do it anyway? The result 'c' does not
depend on a.

Arjan