alpaca icon indicating copy to clipboard operation
alpaca copied to clipboard

Non-exhaustive patterns in "match" expressions

Open tim2CF opened this issue 5 years ago • 2 comments

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)

tim2CF avatar May 20 '19 21:05 tim2CF

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

lpil avatar May 20 '19 22:05 lpil

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

https://github.com/alpaca-lang/alpaca/issues/269

tim2CF avatar May 20 '19 22:05 tim2CF