4 ms·
This is not the reason why haskell is "Safe" Haskell is safe because of type checking. A function in python f(x) = x / 3 will crash if you make x = "a string"
by crimsonalucard 7y ago
This is not the reason why haskell is "Safe"
Haskell is safe because of type checking. A function in python f(x) = x / 3 will crash if you make x = "a string" because "a string" / 3 doesn't make any sense. Python won't let you know about this until the program actually calls f(x).
In haskell f(x: int) -> int = x + 3 is type checked meaning that this program will never compile unless you make x = <some integer>. Haskell does not need to compile the program to know about this.
At a very high level what this means is this , languages like python and closure are so expressive they allow you to write programs that will crash during runtime. Languages like haskell are restrictive. They are so restrictive that they will only allow you to write programs that compile and make sense.
You will note even when using clojure or untyped lisp languages in the usual way (via functional programming with pure functions) you will still run into many runtime type errors just like python.
- deleted 7y ago[deleted]