@@ -0,0 +1,20 @@
1+module Type.Constrain.Declaration where
2+
3+import Type.Type
4+import SourceSyntax.Declaration
5+import qualified Type.Constrain.Expression as Expr
6+import qualified Type.Environment as Env
7+
8+constrain :: Env.Environment -> Declaration t v -> Type -> IO TypeConstraint
9+constrain env decl tipe =
10+ case decl of
11+ ImportEvent _ expr var sourceType -> do
12+ etipe <- (Expr.instantiateType sourceType)
13+ constraint <- Expr.constrain env expr etipe
14+ return (tipe === etipe /\ constraint)
15+ -- also do something with var. Not sure what yet.
16+
17+ ExportEvent _ var sourceType -> do
18+ etipe <- (Expr.instantiateType sourceType)
19+ return (tipe === etipe)
20+ -- also do something with var. Not sure what yet.