@@ -24,7 +24,7 @@ import Type.Type hiding (Descriptor(..))
27−constrain :: Env.Env -> C.Expr -> Type -> IO TypeConstraint
27+constrain :: Env.Env -> C.Expr -> Type -> IO Constraint
28constrain env annotatedExpr@(A.A region expression) tipe =
28constrain env annotatedExpr@(A.A region expression) tipe =
29 case expression of
29 case expression of
30 C.Literal lit ->
30 C.Literal lit ->
@@ -64,11 +64,11 @@ constrain env annotatedExpr@(A.A region expression) tipe =
64 if Map.null decls then
64 if Map.null decls then
67− record (Map.map glToType decls) baseRec
67+ RecordN (Map.map glToType decls) baseRec
69 attribute = makeRec Lit.attribute attr
69 attribute = makeRec Lit.attribute attr
70 uniform = makeRec Lit.uniform unif
70 uniform = makeRec Lit.uniform unif
71− varying = makeRec Lit.varying (TermN EmptyRecord1)
71+ varying = makeRec Lit.varying EmptyRecordN
73 return (CEqual Error.Shader region (shaderTipe attribute uniform varying) tipe)
73 return (CEqual Error.Shader region (shaderTipe attribute uniform varying) tipe)
@@ -117,7 +117,7 @@ constrain env annotatedExpr@(A.A region expression) tipe =
117 exists $ \ext ->
117 exists $ \ext ->
118 do recordCon <- constrain env expr recordType
118 do recordCon <- constrain env expr recordType
119 let maybeBody = C.collectFields expr
119 let maybeBody = C.collectFields expr
120− let desiredType = record (Map.singleton field tipe) ext
120+ let desiredType = RecordN (Map.singleton field tipe) ext
121 let fieldCon = CEqual (Error.Access maybeBody field) region recordType desiredType
121 let fieldCon = CEqual (Error.Access maybeBody field) region recordType desiredType
122 return $ recordCon /\ fieldCon
122 return $ recordCon /\ fieldCon
@@ -125,11 +125,11 @@ constrain env annotatedExpr@(A.A region expression) tipe =
125 exists $ \t ->
125 exists $ \t ->
126 do oldVars <- mapM (\_ -> mkVar Nothing) fields
126 do oldVars <- mapM (\_ -> mkVar Nothing) fields
127 let oldFields = Map.fromList (zip (map fst fields) (map VarN oldVars))
127 let oldFields = Map.fromList (zip (map fst fields) (map VarN oldVars))
128− cOld <- ex oldVars <$> constrain env expr (record oldFields t)
128+ cOld <- ex oldVars <$> constrain env expr (RecordN oldFields t)
130 newVars <- mapM (\_ -> mkVar Nothing) fields
130 newVars <- mapM (\_ -> mkVar Nothing) fields
131 let newFields = Map.fromList (zip (map fst fields) (map VarN newVars))
131 let newFields = Map.fromList (zip (map fst fields) (map VarN newVars))
132− let cNew = CEqual Error.Record region (record newFields t) tipe
132+ let cNew = CEqual Error.Record region (RecordN newFields t) tipe
134 cs <- Monad.zipWithM (constrain env) (map snd fields) (map VarN newVars)
134 cs <- Monad.zipWithM (constrain env) (map snd fields) (map VarN newVars)
@@ -143,7 +143,7 @@ constrain env annotatedExpr@(A.A region expression) tipe =
143 (map snd fields)
143 (map snd fields)
144 (map VarN vars)
144 (map VarN vars)
145 let fields' = Map.fromList (zip (map fst fields) (map VarN vars))
145 let fields' = Map.fromList (zip (map fst fields) (map VarN vars))
146− let recordType = record fields' (TermN EmptyRecord1)
146+ let recordType = RecordN fields' EmptyRecordN
147 return (ex vars (CAnd (fieldCons ++ [CEqual Error.Record region recordType tipe])))
147 return (ex vars (CAnd (fieldCons ++ [CEqual Error.Record region recordType tipe])))
149 C.Let defs body ->
149 C.Let defs body ->
@@ -171,7 +171,7 @@ constrainApp
171 -> C.Expr
171 -> C.Expr
172 -> [C.Expr]
172 -> [C.Expr]
174− -> IO TypeConstraint
174+ -> IO Constraint
175constrainApp env region f args tipe =
175constrainApp env region f args tipe =
176 do funcVar <- mkVar Nothing
176 do funcVar <- mkVar Nothing
177 funcCon <- constrain env f (VarN funcVar)
177 funcCon <- constrain env f (VarN funcVar)
@@ -202,7 +202,7 @@ argConstraints
202 -> Variable
202 -> Variable
204 -> [C.Expr]
204 -> [C.Expr]
205− -> IO ([Variable], [TypeConstraint], [TypeConstraint], [TypeConstraint], Maybe R.Region, Variable)
205+ -> IO ([Variable], [Constraint], [Constraint], [Constraint], Maybe R.Region, Variable)
206argConstraints env name region totalArgs overallVar index args =
206argConstraints env name region totalArgs overallVar index args =
207 case args of
207 case args of
@@ -255,7 +255,7 @@ constrainBinop
255 -> C.Expr
255 -> C.Expr
256 -> C.Expr
256 -> C.Expr
258− -> IO TypeConstraint
258+ -> IO Constraint
259constrainBinop env region op leftExpr@(A.A leftRegion _) rightExpr@(A.A rightRegion _) tipe =
259constrainBinop env region op leftExpr@(A.A leftRegion _) rightExpr@(A.A rightRegion _) tipe =
260 do leftVar <- mkVar Nothing
260 do leftVar <- mkVar Nothing
261 rightVar <- mkVar Nothing
261 rightVar <- mkVar Nothing
@@ -284,7 +284,7 @@ constrainBinop env region op leftExpr@(A.A leftRegion _) rightExpr@(A.A rightReg
284-- CONSTRAIN LISTS
284-- CONSTRAIN LISTS
287−constrainList :: Env.Env -> R.Region -> [C.Expr] -> Type -> IO TypeConstraint
287+constrainList :: Env.Env -> R.Region -> [C.Expr] -> Type -> IO Constraint
288constrainList env region exprs tipe =
288constrainList env region exprs tipe =
289 do (exprInfo, exprCons) <-
289 do (exprInfo, exprCons) <-
290 unzip <$> mapM elementConstraint exprs
290 unzip <$> mapM elementConstraint exprs
@@ -312,7 +312,7 @@ constrainIf
312 -> [(C.Expr, C.Expr)]
312 -> [(C.Expr, C.Expr)]
313 -> C.Expr
313 -> C.Expr
315− -> IO TypeConstraint
315+ -> IO Constraint
316constrainIf env region branches finally tipe =
316constrainIf env region branches finally tipe =
317 do let (conditions, branchExprs) =
317 do let (conditions, branchExprs) =
318 second (++ [finally]) (unzip branches)
318 second (++ [finally]) (unzip branches)
@@ -371,7 +371,7 @@ constrainCase
371 -> C.Expr
371 -> C.Expr
372 -> [(P.Canonical, C.Expr)]
372 -> [(P.Canonical, C.Expr)]
374− -> IO TypeConstraint
374+ -> IO Constraint
375constrainCase env region expr branches tipe =
375constrainCase env region expr branches tipe =
376 do exprVar <- mkVar Nothing
376 do exprVar <- mkVar Nothing
377 exprCon <- constrain env expr (VarN exprVar)
377 exprCon <- constrain env expr (VarN exprVar)
@@ -411,9 +411,9 @@ data Pair = Pair
412 :: R.Region
412 :: R.Region
413 -> (Int -> R.Region -> Error.Hint)
413 -> (Int -> R.Region -> Error.Hint)
414− -> (Variable -> TypeConstraint)
414+ -> (Variable -> Constraint)
415 -> [(Variable, R.Region)]
415 -> [(Variable, R.Region)]
416− -> IO ([Variable], [TypeConstraint])
416+ -> IO ([Variable], [Constraint])
417pairCons region pairHint varToCon items =
417pairCons region pairHint varToCon items =
419 pairToCon (Pair index var1 var2 subregion) =
419 pairToCon (Pair index var1 var2 subregion) =
@@ -488,12 +488,12 @@ expandPattern def@(C.Def facts lpattern expr maybeType) =
489data Info =
489data Info =
491− { iSchemes :: [TypeScheme]
491+ { iSchemes :: [Scheme]
492 , iRigid :: [Variable]
492 , iRigid :: [Variable]
493 , iFlex :: [Variable]
493 , iFlex :: [Variable]
494 , iHeaders :: Map.Map Text (A.Located Type)
494 , iHeaders :: Map.Map Text (A.Located Type)
495− , iC2 :: TypeConstraint
495+ , iC2 :: Constraint
496− , iC1 :: TypeConstraint
496+ , iC1 :: Constraint
@@ -566,7 +566,7 @@ data ArgInfo =
569−constrainAnnDefHelp :: C.Expr -> ST.Canonical -> ArgInfo -> IO TypeConstraint
569+constrainAnnDefHelp :: C.Expr -> ST.Canonical -> ArgInfo -> IO Constraint
570constrainAnnDefHelp expr tipe (ArgInfo name defRegion env args vars) =
570constrainAnnDefHelp expr tipe (ArgInfo name defRegion env args vars) =
571 case (expr, tipe) of
571 case (expr, tipe) of
572 (A.A _ (C.Lambda arg result), ST.Lambda argType resultType) ->
572 (A.A _ (C.Lambda arg result), ST.Lambda argType resultType) ->