3 ms·
> I get to take for granted that a boolean is true or false (and not some brilliant third value!) [True, False, undefined] :: [Bool]
by edef 1y ago
> I get to take for granted that a boolean is true or false (and not some brilliant third value!)
[True, False, undefined] :: [Bool]
- immibis 1y agoThe traditional third value is actually FileNotFound: https://thedailywtf.com/articles/what_is_truth_0x3f_ https://thedailywtf.com/articles/what_is_truth_0x3f_ 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.
- ddellacosta 1y agoSee, you can even do quantum computing very naturally in Haskell.
- mrkeen 1y agoNah. 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 | ^^^^^^^^^^^^^^^^^^^^^^^