5 ms·
>For instance, in Haskell a value is a value. If I have a value of type Integer then it definitely exists; x,y::Integer x = x + 1 y = undefined
by GregBuchholz 13y ago
>For instance, in Haskell a value is a value. If I have a value of type Integer then it definitely exists;
x,y::Integer
x = x + 1
y = undefined
- dllthomas 13y agoThat's an important point, but since you can't test for undefined-ness it's not quite the same thing as carrying around something that's actually a Maybe Int but just hopes you'll check before implicitly using fromJust everywhere.
- GregBuchholz 13y agoWe just don't want to forget that exceptions and termination are effects, and that Haskell isn't perfectly pure... a,b::Integer a = div 1 0 b = sum [1..]
- gnuvince 13y ago`undefined` is used as a placeholder for yet to be written code; since you cannot do anything meaningful with it, it is never used in practice.