Quantcast
Channel: Active questions tagged return-value - Stack Overflow
Viewing all articles
Browse latest Browse all 207

Does extracting values from a multiple Value return in Haskell invoke the function more than once?

$
0
0

For disclosure, I'm rather new to Haskell and am figuring out the syntax. Let me illustrate my question with an example. Let's say you have a function which returns a tuple of several values or a data type with multiple fields.

let    tuple = functionWhichReturnsTuple    value1 = fst tuple    value2 = snd tuplein    otherFunction value1 value2

Once the line in the in block is executed, would functionWhichReturnsTuple be called twice, once for value1 and once for value2? If so, what would be a better method of extracting multiple values at once without initiating multiple function calls?


Viewing all articles
Browse latest Browse all 207

Trending Articles