@@ -17,7 +17,6 @@ import qualified Elm.ModuleName as ModuleName
1717import qualified Reporting.Annotation as A
1818import qualified Reporting.Error.Type as E
1919import Reporting.Error.Type (Expected(..), Context(..), SubContext(..), MaybeName(..), Category(..), PExpected(..), PContext(..))
20−import qualified Reporting.Region as R
2120import qualified Type.Constrain.Pattern as Pattern
2221import qualified Type.Instantiate as Instantiate
2322import Type.Type as Type hiding (Descriptor(..))
@@ -149,15 +148,15 @@ constrain rtv (A.At region expression) expected =
149148 Can.Tuple a b maybeC ->
150149 constrainTuple rtv region a b maybeC expected
151150
152− Can.Shader _uid _src glType ->
153− constrainShader region glType expected
151+ Can.Shader _src types ->
152+ constrainShader region types expected
154153
155154
156155
157156-- CONSTRAIN LAMBDA
158157
159158
160−constrainLambda :: RTV -> R.Region -> [Can.Pattern] -> Can.Expr -> Expected Type -> IO Constraint
159+constrainLambda :: RTV -> A.Region -> [Can.Pattern] -> Can.Expr -> Expected Type -> IO Constraint
161160constrainLambda rtv region args body expected =
162161 do (Args vars tipe resultType (Pattern.State headers pvars revCons)) <-
163162 constrainArgs args
@@ -182,7 +181,7 @@ constrainLambda rtv region args body expected =
182181-- CONSTRAIN CALL
183182
184183
185−constrainCall :: RTV -> R.Region -> Can.Expr -> [Can.Expr] -> Expected Type -> IO Constraint
184+constrainCall :: RTV -> A.Region -> Can.Expr -> [Can.Expr] -> Expected Type -> IO Constraint
186185constrainCall rtv region func@(A.At funcRegion _) args expected =
187186 do let maybeName = getName func
188187
@@ -208,7 +207,7 @@ constrainCall rtv region func@(A.At funcRegion _) args expected =
208207 ]
209208
210209
211−constrainArg :: RTV -> R.Region -> MaybeName -> Index.ZeroBased -> Can.Expr -> IO (Variable, Type, Constraint)
210+constrainArg :: RTV -> A.Region -> MaybeName -> Index.ZeroBased -> Can.Expr -> IO (Variable, Type, Constraint)
212211constrainArg rtv region maybeName index arg =
213212 do argVar <- mkFlexVar
214213 let argType = VarN argVar
@@ -241,7 +240,7 @@ getAccessName (A.At _ expr) =
241240-- CONSTRAIN BINOP
242241
243242
244−constrainBinop :: RTV -> R.Region -> Name.Name -> Can.Annotation -> Can.Expr -> Can.Expr -> Expected Type -> IO Constraint
243+constrainBinop :: RTV -> A.Region -> Name.Name -> Can.Annotation -> Can.Expr -> Can.Expr -> Expected Type -> IO Constraint
245244constrainBinop rtv region op annotation leftExpr rightExpr expected =
246245 do leftVar <- mkFlexVar
247246 rightVar <- mkFlexVar
@@ -269,7 +268,7 @@ constrainBinop rtv region op annotation leftExpr rightExpr expected =
269268-- CONSTRAIN LISTS
270269
271270
272−constrainList :: RTV -> R.Region -> [Can.Expr] -> Expected Type -> IO Constraint
271+constrainList :: RTV -> A.Region -> [Can.Expr] -> Expected Type -> IO Constraint
273272constrainList rtv region entries expected =
274273 do entryVar <- mkFlexVar
275274 let entryType = VarN entryVar
@@ -285,7 +284,7 @@ constrainList rtv region entries expected =
285284 ]
286285
287286
288−constrainListEntry :: RTV -> R.Region -> Type -> Index.ZeroBased -> Can.Expr -> IO Constraint
287+constrainListEntry :: RTV -> A.Region -> Type -> Index.ZeroBased -> Can.Expr -> IO Constraint
289288constrainListEntry rtv region tipe index expr =
290289 constrain rtv expr (FromContext region (ListEntry index) tipe)
291290
@@ -294,7 +293,7 @@ constrainListEntry rtv region tipe index expr =
294293-- CONSTRAIN IF EXPRESSIONS
295294
296295
297−constrainIf :: RTV -> R.Region -> [(Can.Expr, Can.Expr)] -> Can.Expr -> Expected Type -> IO Constraint
296+constrainIf :: RTV -> A.Region -> [(Can.Expr, Can.Expr)] -> Can.Expr -> Expected Type -> IO Constraint
298297constrainIf rtv region branches final expected =
299298 do let boolExpect = FromContext region IfCondition Type.bool
300299 let (conditions, exprs) = foldr (\(c,e) (cs,es) -> (c:cs,e:es)) ([],[final]) branches
@@ -331,7 +330,7 @@ constrainIf rtv region branches final expected =
331330-- CONSTRAIN CASE EXPRESSIONS
332331
333332
334−constrainCase :: RTV -> R.Region -> Can.Expr -> [Can.CaseBranch] -> Expected Type -> IO Constraint
333+constrainCase :: RTV -> A.Region -> Can.Expr -> [Can.CaseBranch] -> Expected Type -> IO Constraint
335334constrainCase rtv region expr branches expected =
336335 do ptrnVar <- mkFlexVar
337336 let ptrnType = VarN ptrnVar
@@ -376,7 +375,7 @@ constrainCaseBranch rtv (Can.CaseBranch pattern expr) pExpect bExpect =
376375-- CONSTRAIN RECORD
377376
378377
379−constrainRecord :: RTV -> R.Region -> Map.Map Name.Name Can.Expr -> Expected Type -> IO Constraint
378+constrainRecord :: RTV -> A.Region -> Map.Map Name.Name Can.Expr -> Expected Type -> IO Constraint
380379constrainRecord rtv region fields expected =
381380 do dict <- traverse (constrainField rtv) fields
382381
@@ -402,7 +401,7 @@ constrainField rtv expr =
402401-- CONSTRAIN RECORD UPDATE
403402
404403
405−constrainUpdate :: RTV -> R.Region -> Name.Name -> Can.Expr -> Map.Map Name.Name Can.FieldUpdate -> Expected Type -> IO Constraint
404+constrainUpdate :: RTV -> A.Region -> Name.Name -> Can.Expr -> Map.Map Name.Name Can.FieldUpdate -> Expected Type -> IO Constraint
406405constrainUpdate rtv region name expr fields expected =
407406 do extVar <- mkFlexVar
408407 fieldDict <- Map.traverseWithKey (constrainUpdateField rtv region) fields
@@ -423,7 +422,7 @@ constrainUpdate rtv region name expr fields expected =
423422 return $ exists vars $ CAnd (fieldsCon:con:cons)
424423
425424
426−constrainUpdateField :: RTV -> R.Region -> Name.Name -> Can.FieldUpdate -> IO (Variable, Type, Constraint)
425+constrainUpdateField :: RTV -> A.Region -> Name.Name -> Can.FieldUpdate -> IO (Variable, Type, Constraint)
427426constrainUpdateField rtv region field (Can.FieldUpdate _ expr) =
428427 do var <- mkFlexVar
429428 let tipe = VarN var
@@ -435,7 +434,7 @@ constrainUpdateField rtv region field (Can.FieldUpdate _ expr) =
435434-- CONSTRAIN TUPLE
436435
437436
438−constrainTuple :: RTV -> R.Region -> Can.Expr -> Can.Expr -> Maybe Can.Expr -> Expected Type -> IO Constraint
437+constrainTuple :: RTV -> A.Region -> Can.Expr -> Can.Expr -> Maybe Can.Expr -> Expected Type -> IO Constraint
439438constrainTuple rtv region a b maybeC expected =
440439 do aVar <- mkFlexVar
441440 bVar <- mkFlexVar
@@ -467,8 +466,8 @@ constrainTuple rtv region a b maybeC expected =
467466-- CONSTRAIN SHADER
468467
469468
470−constrainShader :: R.Region -> Shader.Shader -> Expected Type -> IO Constraint
471−constrainShader region (Shader.Shader attributes uniforms varyings) expected =
469+constrainShader :: A.Region -> Shader.Types -> Expected Type -> IO Constraint
470+constrainShader region (Shader.Types attributes uniforms varyings) expected =
472471 do attrVar <- mkFlexVar
473472 unifVar <- mkFlexVar
474473 let attrType = VarN attrVar
@@ -509,7 +508,7 @@ glToType glType =
509508-- CONSTRAIN DESTRUCTURES
510509
511510
512−constrainDestruct :: RTV -> R.Region -> Can.Pattern -> Can.Expr -> Constraint -> IO Constraint
511+constrainDestruct :: RTV -> A.Region -> Can.Pattern -> Can.Expr -> Constraint -> IO Constraint
513512constrainDestruct rtv region pattern expr bodyCon =
514513 do patternVar <- mkFlexVar
515514 let patternType = VarN patternVar