add sugar for typeclass

This commit is contained in:
2024-11-16 21:08:01 -08:00
parent 454dccaa72
commit fac34e729c
8 changed files with 94 additions and 31 deletions

View File

@@ -666,8 +666,9 @@ mkPat top (tm, icit) = do
(Just (MkEntry name type (DCon k str))) =>
-- TODO check arity, also figure out why we need reverse
pure $ PatCon fc icit nm !(traverse (mkPat top) b)
Just _ => error (getFC tm) "not a data constructor"
Nothing => case b of
-- This fires when a global is shadowed by a pattern var
-- Just _ => error (getFC tm) "\{show nm} is not a data constructor"
_ => case b of
[] => pure $ PatVar fc icit nm
_ => error (getFC tm) "patvar applied to args"
((RImplicit fc), []) => pure $ PatWild fc icit