Yes, that's great. If you compile with optimizations enabled, the tuples will be truly “unpacked”, so they will not have additional costs. The code will be transformed into something like this:
(# var1, var2, var3 #) = case foo > 0 of False -> (# "Bar", "Baz", 1 #) True -> (# "Foo", "Bar", 3 #)
Unboxed 3-tuple is actually only three values - it has no extra structure. As a result, it cannot be stored in the data structure, but this is normal. Of course, if foo known at compile time, case will also be optimized, and you will only get three definitions.
source share