LightAndLight / ipso

A functional scripting language.
https://ipso.dev
16 stars 1 forks source link

Detect incomplete pattern matches #364

Open LightAndLight opened 1 year ago

LightAndLight commented 1 year ago

Incomplete pattern matches aren't detected during type checking and will cause a runtime failure.

f : (| A : String, B ; String |) -> String
f x =
  case x of
    A a -> a

main : IO ()
main = println <| f (B "b")

I'd like ipso to tell me when I've missed a pattern; usually it's unintentional.

Pattern match completeness is a big topic. I might want to break the feature down by type. I might also be able to separate "detecting incomplete patterns" from "calculating missing patterns".