@@ -24,7 +24,7 @@ import Type.Type hiding (Descriptor(..))
2424
2525
2626
27−constrain :: Env.Env -> C.Expr -> Type -> IO TypeConstraint
27+constrain :: Env.Env -> C.Expr -> Type -> IO Constraint
2828constrain env annotatedExpr@(A.A region expression) tipe =
2929 case expression of
3030 C.Literal lit ->
@@ -64,11 +64,11 @@ constrain env annotatedExpr@(A.A region expression) tipe =
6464 if Map.null decls then
6565 baseRec
6666 else
67− record (Map.map glToType decls) baseRec
67+ RecordN (Map.map glToType decls) baseRec
6868
6969 attribute = makeRec Lit.attribute attr
7070 uniform = makeRec Lit.uniform unif
71− varying = makeRec Lit.varying (TermN EmptyRecord1)
71+ varying = makeRec Lit.varying EmptyRecordN
7272 in
7373 return (CEqual Error.Shader region (shaderTipe attribute uniform varying) tipe)
7474
@@ -117,7 +117,7 @@ constrain env annotatedExpr@(A.A region expression) tipe =
117117 exists $ \ext ->
118118 do recordCon <- constrain env expr recordType
119119 let maybeBody = C.collectFields expr
120− let desiredType = record (Map.singleton field tipe) ext
120+ let desiredType = RecordN (Map.singleton field tipe) ext
121121 let fieldCon = CEqual (Error.Access maybeBody field) region recordType desiredType
122122 return $ recordCon /\ fieldCon
123123
@@ -125,11 +125,11 @@ constrain env annotatedExpr@(A.A region expression) tipe =
125125 exists $ \t ->
126126 do oldVars <- mapM (\_ -> mkVar Nothing) fields
127127 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)
129129
130130 newVars <- mapM (\_ -> mkVar Nothing) fields
131131 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
133133
134134 cs <- Monad.zipWithM (constrain env) (map snd fields) (map VarN newVars)
135135
@@ -143,7 +143,7 @@ constrain env annotatedExpr@(A.A region expression) tipe =
143143 (map snd fields)
144144 (map VarN vars)
145145 let fields' = Map.fromList (zip (map fst fields) (map VarN vars))
146− let recordType = record fields' (TermN EmptyRecord1)
146+ let recordType = RecordN fields' EmptyRecordN
147147 return (ex vars (CAnd (fieldCons ++ [CEqual Error.Record region recordType tipe])))
148148
149149 C.Let defs body ->
@@ -171,7 +171,7 @@ constrainApp
171171 -> C.Expr
172172 -> [C.Expr]
173173 -> Type
174− -> IO TypeConstraint
174+ -> IO Constraint
175175constrainApp env region f args tipe =
176176 do funcVar <- mkVar Nothing
177177 funcCon <- constrain env f (VarN funcVar)
@@ -202,7 +202,7 @@ argConstraints
202202 -> Variable
203203 -> Int
204204 -> [C.Expr]
205− -> IO ([Variable], [TypeConstraint], [TypeConstraint], [TypeConstraint], Maybe R.Region, Variable)
205+ -> IO ([Variable], [Constraint], [Constraint], [Constraint], Maybe R.Region, Variable)
206206argConstraints env name region totalArgs overallVar index args =
207207 case args of
208208 [] ->
@@ -255,7 +255,7 @@ constrainBinop
255255 -> C.Expr
256256 -> C.Expr
257257 -> Type
258− -> IO TypeConstraint
258+ -> IO Constraint
259259constrainBinop env region op leftExpr@(A.A leftRegion _) rightExpr@(A.A rightRegion _) tipe =
260260 do leftVar <- mkVar Nothing
261261 rightVar <- mkVar Nothing
@@ -284,7 +284,7 @@ constrainBinop env region op leftExpr@(A.A leftRegion _) rightExpr@(A.A rightReg
284284-- CONSTRAIN LISTS
285285
286286
287−constrainList :: Env.Env -> R.Region -> [C.Expr] -> Type -> IO TypeConstraint
287+constrainList :: Env.Env -> R.Region -> [C.Expr] -> Type -> IO Constraint
288288constrainList env region exprs tipe =
289289 do (exprInfo, exprCons) <-
290290 unzip <$> mapM elementConstraint exprs
@@ -312,7 +312,7 @@ constrainIf
312312 -> [(C.Expr, C.Expr)]
313313 -> C.Expr
314314 -> Type
315− -> IO TypeConstraint
315+ -> IO Constraint
316316constrainIf env region branches finally tipe =
317317 do let (conditions, branchExprs) =
318318 second (++ [finally]) (unzip branches)
@@ -371,7 +371,7 @@ constrainCase
371371 -> C.Expr
372372 -> [(P.Canonical, C.Expr)]
373373 -> Type
374− -> IO TypeConstraint
374+ -> IO Constraint
375375constrainCase env region expr branches tipe =
376376 do exprVar <- mkVar Nothing
377377 exprCon <- constrain env expr (VarN exprVar)
@@ -411,9 +411,9 @@ data Pair = Pair
411411pairCons
412412 :: R.Region
413413 -> (Int -> R.Region -> Error.Hint)
414− -> (Variable -> TypeConstraint)
414+ -> (Variable -> Constraint)
415415 -> [(Variable, R.Region)]
416− -> IO ([Variable], [TypeConstraint])
416+ -> IO ([Variable], [Constraint])
417417pairCons region pairHint varToCon items =
418418 let
419419 pairToCon (Pair index var1 var2 subregion) =
@@ -488,12 +488,12 @@ expandPattern def@(C.Def facts lpattern expr maybeType) =
488488
489489data Info =
490490 Info
491− { iSchemes :: [TypeScheme]
491+ { iSchemes :: [Scheme]
492492 , iRigid :: [Variable]
493493 , iFlex :: [Variable]
494494 , iHeaders :: Map.Map Text (A.Located Type)
495− , iC2 :: TypeConstraint
496− , iC1 :: TypeConstraint
495+ , iC2 :: Constraint
496+ , iC1 :: Constraint
497497 }
498498
499499
@@ -566,7 +566,7 @@ data ArgInfo =
566566 }
567567
568568
569−constrainAnnDefHelp :: C.Expr -> ST.Canonical -> ArgInfo -> IO TypeConstraint
569+constrainAnnDefHelp :: C.Expr -> ST.Canonical -> ArgInfo -> IO Constraint
570570constrainAnnDefHelp expr tipe (ArgInfo name defRegion env args vars) =
571571 case (expr, tipe) of
572572 (A.A _ (C.Lambda arg result), ST.Lambda argType resultType) ->