If I have a function like the following
f x = if g x /= Nothing then g x else False
will g be called twice in f or does Haskell 'cache' the result of g x after the first instance for possible later use in the same line? I'm trying to optimise some code and I don't know if functions in the style of the one above are twice as computationally expensive as I want them to be.
Thanks in advance.