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

Non-exhaustive patterns in "match" expressions #270

Open
tim2CF opened this issue May 20, 2019 · 2 comments
Open

Non-exhaustive patterns in "match" expressions #270

tim2CF opened this issue May 20, 2019 · 2 comments

Comments

@tim2CF
Copy link

tim2CF commented May 20, 2019

type maybe 'a = Just 'a | Nothing

val (>>=) 'a 'b : fn (maybe 'a) (fn 'a -> maybe 'b) -> (maybe 'b)
let (>>=) x f =
  match x with
    Nothing -> Nothing
    -- | Just y -> f y

This code is compiled without warnings/errors, but it should not (because 2nd clause is commented out)

@lpil
Copy link
Contributor

lpil commented May 20, 2019

Only top level expressions have exhaustiveness checking at present -> https://github.com/alpaca-lang/alpaca#using-it

@tim2CF
Copy link
Author

tim2CF commented May 20, 2019

@lpil that's fine, but top-level expressions based variant is not compiling (even if patterns are exhaustive)

#269

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