> I get to take for granted that a boolean is true or false (and not some brilliant third value!)
[True, False, undefined] :: [Bool] [True, False, undefined] :: [Bool]but in Haskell, yes, it's undefined. Which isn't a real value! For example, infinite loops are undefined. Theorists like to call it a value of every type, but in practical terms, it's more like a computation that never produces a value. The builtin "undefined" can be written as an infinite loop ("undefined = undefined") and many other pure infinite loops can also act as undefined values. The runtime is able to catch some and crash instead of hanging, but not others.
check :: Bool -> a
check True = undefined
check False = undefined
check _ = undefined
7:1: warning: [GHC-53633] [-Woverlapping-patterns]
Pattern match is redundant
In an equation for ‘check’: check _ = ...
|
7 | check _ = undefined
| ^^^^^^^^^^^^^^^^^^^^^^^