3 ms·
A constant function doesn't act on its input. `f(x) = 6` doesn't perform a different action on each input. But given your comparison to `f(x) = 0*x + 6`, let's
by acomar 8y ago
A constant function doesn't act on its input. `f(x) = 6` doesn't perform a different action on each input. But given your comparison to `f(x) = 0*x + 6`, let's move away from numbers and consider a different function. `f'` which I'll define as:
const :: a -> b -> a
const a _ = a
f' :: a -> ()
f' = const ()
Now I can give `f'` anything at all. Can you try to explain the action of `f'` in any way but that it ignores its argument?