Varying output type

The input type and output type of a function are fixed. So you can't write something like:

f 4 = True
f 5 = 6

This is because the output type of f can be either always a Bool, as the first line implies, or always a number, as the second line implies.

See this FAQ for the correct approach.

Last update: January 12, 2023
Created: January 7, 2023