> If we want to be pedantic, there is no such thing as a pure JavaScript function. If the stack is full, ...
Under this definition, Haskell has no pure functions either.
Under this definition, Haskell has no pure functions either.
Prelude> undefined
*** Exception: Prelude.undefined
Prelude> let x 2 = 4 in x 1
*** Exception: <interactive>:7:5-11: Non-exhaustive patterns in function x
Neither of these behaviors is indicated in the type definition: Prelude> :t undefined
undefined :: t
Prelude> :t let x 2 = 4 in x
let x 2 = 4 in x :: (Eq a, Num a, Num a1) => a -> a1
I was promised a -> a but got a runtime exception instead.Only at definition site, not use site, for both better and worse.
No it's not because you can't check for bottom (purely) and thus you can't use it as a flag or sentinel value.