These are chat archives for ramda/ramda
void' or '
()' or perhaps '
(lambda () 1)
λ: const 3 (1 `div` 0) 3 λ: const (1 `div` 0) 3 *** Exception: divide by zero
const doesn't evaluate its second argument, no exception is raised when you divide by 0 in the second argument. But when you divide by 0 in the first argument, an exception is raised, as const evaluates its first argument.
λ: const 3 $! (1 `div` 0) *** Exception: divide by zero
actually, that's still not entirely true...
ghci is doing the evaluation there, forcing the
Show instance. It has nothing to do with how
const is implemented. The function doesn't force either argument. But ghci wanting to show the result does force the return value. So something like this, still doesn't raise an exception:
λ: const 3 (const (1 `div` 0) (0 `div` 0)) 3
Even though the nested
const has both exception raising arguments, it doesn't matter as the value is never forced.