Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Examples for non-exhaustive pattern matches #12

Open
Eckankar opened this issue Nov 3, 2011 · 1 comment
Open

Examples for non-exhaustive pattern matches #12

Eckankar opened this issue Nov 3, 2011 · 1 comment

Comments

@Eckankar
Copy link
Contributor

Eckankar commented Nov 3, 2011

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 = <fun>

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

@kfl
Copy link
Owner

kfl commented Nov 4, 2011

I agree that this would be a nice feature to add, but I'm not sure how hard is to implement. Moscow ML has at least some of the needed machinery in place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants