kfl/mosml — Issue #12: Examples for non-exhaustive pattern matches
Author: Eckankar
Created: 2011-11-03 11:37:42+00:00
State: open

Here's an example of a non-exhaustive pattern in Moscow ML:

- fun foo (x::xs) = xs;
! Toplevel input:
! fun foo (x::xs) = xs;
! ^^^^^^^^^^^^^^^^
! Warning: pattern matching is not exhaustive

Here's an example of the same non-exhaustive pattern in OCaml:

# let foo (x::xs) = xs;;
Warning P: this pattern-matching is not exhaustive.
Here is an example of a value that is not matched:
[]
val foo : 'a list -> 'a list =

It'd be quite nice if Moscow ML, similarily to this, gave an example of an unmatched pattern.