3 ms·
Interesting. I assumed Haskell would at least warn you. But it's probably only a matter of time before Catch is built in to the compiler, at least as an option.
by paulbaumgart 16y ago
Interesting. I assumed Haskell would at least warn you. But it's probably only a matter of time before Catch is built in to the compiler, at least as an option.
- kragen 16y agoOCaml does warn you: : kragen@inexorable:~/mail ; ocaml Objective Caml version 3.10.2 # let divide x = function 0 -> None | y -> Some (x / y) ;; val divide : int -> int -> int option = <fun> # let printResult = function Some x -> print_int x ;; Warning P: this pattern-matching is not exhaustive. Here is an example of a value that is not matched: None val printResult : int option -> unit = <fun> # printResult (divide 9 3) ;; 3- : unit = () # printResult (divide 10 0) ;; Exception: Match_failure ("", 1, 18). #