preparing for rewrite #100

This commit is contained in:
crumbtoo
2024-03-13 16:06:20 -06:00
parent 8d8651d549
commit e00e0eff3b
5 changed files with 95 additions and 5 deletions

View File

@@ -26,6 +26,9 @@ import Rlp.AltSyntax
newtype Context = Context
{ _contextVars :: HashMap PsName (Type PsName)
}
deriving (Generic)
deriving (Semigroup, Monoid)
via Generically Context
data Constraint = Equality (Type PsName) (Type PsName)
deriving (Eq, Generic, Show)
@@ -49,6 +52,7 @@ data TypeError
-- | Untyped, potentially undefined variable
| TyErrUntypedVariable Name
| TyErrMissingTypeSig Name
| TyErrNonHomogenousCaseAlternatives (RlpExpr PsName)
deriving (Show)
instance IsRlpcError TypeError where
@@ -124,6 +128,7 @@ addConstraint = tell . pure
makeLenses ''Context
makePrisms ''Constraint
makePrisms ''TypeError
supplement :: [(PsName, Type PsName)] -> Context -> Context
supplement bs = contextVars %~ (H.fromList bs <>)