@@ -35,73 +35,73 @@ type RTV =
35 Map.Map N.Name Type
35 Map.Map N.Name Type
38−constrain :: RTV -> Can.Expr -> Expectation -> IO Constraint
38+constrain :: RTV -> Can.Expr -> Expected Type -> IO Constraint
39−constrain rtv (A.At region expression) expectation =
39+constrain rtv (A.At region expression) expected =
40 case expression of
40 case expression of
41 Can.VarLocal name ->
41 Can.VarLocal name ->
42− return (CLookup region name expectation)
42+ return (CLookup region name expected)
44 Can.VarTopLevel _ name ->
44 Can.VarTopLevel _ name ->
45− return (CLookup region name expectation)
45+ return (CLookup region name expected)
47 Can.VarKernel _ _ ->
47 Can.VarKernel _ _ ->
48 return CTrue
48 return CTrue
50 Can.VarForeign _ name annotation ->
50 Can.VarForeign _ name annotation ->
51− return $ CInstance region (FuncName name) annotation expectation
51+ return $ CInstance region (FuncName name) annotation expected
53 Can.VarOperator op _ _ annotation ->
53 Can.VarOperator op _ _ annotation ->
54− return $ CInstance region (OpName op) annotation expectation
54+ return $ CInstance region (OpName op) annotation expected
56 Can.Str _ ->
56 Can.Str _ ->
57− return $ CEqual region String Type.string expectation
57+ return $ CEqual region String Type.string expected
59 Can.Chr _ ->
59 Can.Chr _ ->
60− return $ CEqual region Char Type.char expectation
60+ return $ CEqual region Char Type.char expected
62 Can.Int _ ->
62 Can.Int _ ->
63 do var <- mkFlexNumber
63 do var <- mkFlexNumber
64− return $ exists [var] $ CEqual region C.Number (VarN var) expectation
64+ return $ exists [var] $ CEqual region C.Number (VarN var) expected
66 Can.Float _ ->
66 Can.Float _ ->
67− return $ CEqual region Float Type.float expectation
67+ return $ CEqual region Float Type.float expected
69 Can.List elements ->
69 Can.List elements ->
70− constrainList rtv region elements expectation
70+ constrainList rtv region elements expected
72 Can.Negate expr ->
72 Can.Negate expr ->
73 do numberVar <- mkFlexNumber
73 do numberVar <- mkFlexNumber
74 let numberType = VarN numberVar
74 let numberType = VarN numberVar
75 numberCon <- constrain rtv expr (FromContext region Negate numberType)
75 numberCon <- constrain rtv expr (FromContext region Negate numberType)
76− let negateCon = CEqual region C.Number numberType expectation
76+ let negateCon = CEqual region C.Number numberType expected
77 return $ exists [numberVar] $ CAnd [ numberCon, negateCon ]
77 return $ exists [numberVar] $ CAnd [ numberCon, negateCon ]
79 Can.Binop op _ _ annotation leftExpr rightExpr ->
79 Can.Binop op _ _ annotation leftExpr rightExpr ->
80− constrainBinop rtv region op annotation leftExpr rightExpr expectation
80+ constrainBinop rtv region op annotation leftExpr rightExpr expected
82 Can.Lambda args _ body ->
82 Can.Lambda args _ body ->
83− constrainLambda rtv region args body expectation
83+ constrainLambda rtv region args body expected
85 Can.Call func args ->
85 Can.Call func args ->
86− constrainCall rtv region func args expectation
86+ constrainCall rtv region func args expected
88 Can.If branches finally ->
88 Can.If branches finally ->
89− constrainIf rtv region branches finally expectation
89+ constrainIf rtv region branches finally expected
91 Can.Case expr branches ->
91 Can.Case expr branches ->
92− constrainCase rtv region expr branches expectation
92+ constrainCase rtv region expr branches expected
94 Can.Let def body ->
94 Can.Let def body ->
95 constrainDef rtv def
95 constrainDef rtv def
96− =<< constrain rtv body expectation
96+ =<< constrain rtv body expected
98 Can.LetRec defs body ->
98 Can.LetRec defs body ->
99 constrainRecursiveDefs rtv defs
99 constrainRecursiveDefs rtv defs
100− =<< constrain rtv body expectation
100+ =<< constrain rtv body expected
102 Can.LetDestruct pattern _ expr body ->
102 Can.LetDestruct pattern _ expr body ->
103 constrainDestruct rtv region pattern expr
103 constrainDestruct rtv region pattern expr
104− =<< constrain rtv body expectation
104+ =<< constrain rtv body expected
106 Can.Accessor field ->
106 Can.Accessor field ->
107 do extVar <- mkFlexVar
107 do extVar <- mkFlexVar
@@ -110,7 +110,7 @@ constrain rtv (A.At region expression) expectation =
110 let fieldType = VarN fieldVar
110 let fieldType = VarN fieldVar
111 let recordType = RecordN (Map.singleton field fieldType) extType
111 let recordType = RecordN (Map.singleton field fieldType) extType
112 return $ exists [ fieldVar, extVar ] $
112 return $ exists [ fieldVar, extVar ] $
113− CEqual region (Accessor field) (FunN recordType fieldType) expectation
113+ CEqual region (Accessor field) (FunN recordType fieldType) expected
115 Can.Access expr field ->
115 Can.Access expr field ->
116 do extVar <- mkFlexVar
116 do extVar <- mkFlexVar
@@ -125,31 +125,31 @@ constrain rtv (A.At region expression) expectation =
125 return $ exists [ fieldVar, extVar ] $
125 return $ exists [ fieldVar, extVar ] $
127 [ recordCon
127 [ recordCon
128− , CEqual region (Access field) recordType expectation
128+ , CEqual region (Access field) recordType expected
131 Can.Update expr fields ->
131 Can.Update expr fields ->
132− constrainUpdate rtv region expr fields expectation
132+ constrainUpdate rtv region expr fields expected
134 Can.Record fields ->
134 Can.Record fields ->
135− constrainRecord rtv region fields expectation
135+ constrainRecord rtv region fields expected
137 Can.Unit ->
137 Can.Unit ->
138− return $ CEqual region Unit UnitN expectation
138+ return $ CEqual region Unit UnitN expected
140 Can.Tuple a b maybeC ->
140 Can.Tuple a b maybeC ->
141− constrainTuple rtv region a b maybeC expectation
141+ constrainTuple rtv region a b maybeC expected
143 Can.Shader _uid _src glType ->
143 Can.Shader _uid _src glType ->
144− constrainShader region glType expectation
144+ constrainShader region glType expected
148-- CONSTRAIN LAMBDA
148-- CONSTRAIN LAMBDA
151−constrainLambda :: RTV -> R.Region -> [Can.Arg] -> Can.Expr -> Expectation -> IO Constraint
151+constrainLambda :: RTV -> R.Region -> [Can.Arg] -> Can.Expr -> Expected Type -> IO Constraint
152−constrainLambda rtv region args body expectation =
152+constrainLambda rtv region args body expected =
153 do (Args vars tipe resultType (Pattern.State headers pvars revCons)) <-
153 do (Args vars tipe resultType (Pattern.State headers pvars revCons)) <-
154 constrainArgs args
154 constrainArgs args
@@ -165,7 +165,7 @@ constrainLambda rtv region args body expectation =
165 , _headerCon = CAnd (reverse revCons)
165 , _headerCon = CAnd (reverse revCons)
166 , _bodyCon = bodyCon
166 , _bodyCon = bodyCon
168− , CEqual region Lambda tipe expectation
168+ , CEqual region Lambda tipe expected
@@ -173,8 +173,8 @@ constrainLambda rtv region args body expectation =
173-- CONSTRAIN CALL
173-- CONSTRAIN CALL
176−constrainCall :: RTV -> R.Region -> Can.Expr -> [Can.Expr] -> Expectation -> IO Constraint
176+constrainCall :: RTV -> R.Region -> Can.Expr -> [Can.Expr] -> Expected Type -> IO Constraint
177−constrainCall rtv region func args expectation =
177+constrainCall rtv region func args expected =
178 do let maybeFuncName = getFuncName func
178 do let maybeFuncName = getFuncName func
180 funcVar <- mkFlexVar
180 funcVar <- mkFlexVar
@@ -188,7 +188,7 @@ constrainCall rtv region func args expectation =
188 unzip3 <$> Index.indexedTraverse (constrainArg rtv region maybeFuncName) args
188 unzip3 <$> Index.indexedTraverse (constrainArg rtv region maybeFuncName) args
190 let arityType = foldr FunN resultType argTypes
190 let arityType = foldr FunN resultType argTypes
191− let resultCon = CEqual region (CallResult maybeFuncName) resultType expectation
191+ let resultCon = CEqual region (CallResult maybeFuncName) resultType expected
193 return $ exists (funcVar:resultVar:argVars) $
193 return $ exists (funcVar:resultVar:argVars) $
@@ -250,8 +250,8 @@ getFuncName (A.At _ expr) =
250-- CONSTRAIN BINOP
250-- CONSTRAIN BINOP
253−constrainBinop :: RTV -> R.Region -> N.Name -> Can.Annotation -> Can.Expr -> Can.Expr -> Expectation -> IO Constraint
253+constrainBinop :: RTV -> R.Region -> N.Name -> Can.Annotation -> Can.Expr -> Can.Expr -> Expected Type -> IO Constraint
254−constrainBinop rtv region op annotation leftExpr rightExpr expectation =
254+constrainBinop rtv region op annotation leftExpr rightExpr expected =
255 do leftVar <- mkFlexVar
255 do leftVar <- mkFlexVar
256 rightVar <- mkFlexVar
256 rightVar <- mkFlexVar
257 answerVar <- mkFlexVar
257 answerVar <- mkFlexVar
@@ -270,7 +270,7 @@ constrainBinop rtv region op annotation leftExpr rightExpr expectation =
271 , leftCon
271 , leftCon
272 , rightCon
272 , rightCon
273− , CEqual region (CallResult (Just (OpName op))) answerType expectation
273+ , CEqual region (CallResult (Just (OpName op))) answerType expected
@@ -278,8 +278,8 @@ constrainBinop rtv region op annotation leftExpr rightExpr expectation =
278-- CONSTRAIN LISTS
278-- CONSTRAIN LISTS
281−constrainList :: RTV -> R.Region -> [Can.Expr] -> Expectation -> IO Constraint
281+constrainList :: RTV -> R.Region -> [Can.Expr] -> Expected Type -> IO Constraint
282−constrainList rtv region entries expectation =
282+constrainList rtv region entries expected =
283 do entryVar <- mkFlexVar
283 do entryVar <- mkFlexVar
284 let entryType = VarN entryVar
284 let entryType = VarN entryVar
285 let listType = AppN ModuleName.list N.list [entryType]
285 let listType = AppN ModuleName.list N.list [entryType]
@@ -290,7 +290,7 @@ constrainList rtv region entries expectation =
290 return $ exists [entryVar] $
290 return $ exists [entryVar] $
292 [ CAnd entryCons
292 [ CAnd entryCons
293− , CEqual region List listType expectation
293+ , CEqual region List listType expected
@@ -303,15 +303,15 @@ constrainListEntry rtv region tipe index expr =
303-- CONSTRAIN IF EXPRESSIONS
303-- CONSTRAIN IF EXPRESSIONS
306−constrainIf :: RTV -> R.Region -> [(Can.Expr, Can.Expr)] -> Can.Expr -> Expectation -> IO Constraint
306+constrainIf :: RTV -> R.Region -> [(Can.Expr, Can.Expr)] -> Can.Expr -> Expected Type -> IO Constraint
307−constrainIf rtv region branches final expectation =
307+constrainIf rtv region branches final expected =
308 do let boolExpect = FromContext region IfCondition Type.bool
308 do let boolExpect = FromContext region IfCondition Type.bool
309 let (conditions, exprs) = foldr (\(c,e) (cs,es) -> (c:cs,e:es)) ([],[final]) branches
309 let (conditions, exprs) = foldr (\(c,e) (cs,es) -> (c:cs,e:es)) ([],[final]) branches
311 condCons <-
311 condCons <-
312 traverse (\c -> constrain rtv c boolExpect) conditions
312 traverse (\c -> constrain rtv c boolExpect) conditions
314− case expectation of
314+ case expected of
315 FromAnnotation name arity _ tipe ->
315 FromAnnotation name arity _ tipe ->
316 do branchCons <- Index.indexedForA exprs $ \index expr ->
316 do branchCons <- Index.indexedForA exprs $ \index expr ->
317 constrain rtv expr (FromAnnotation name arity (TypedIfBranch index) tipe)
317 constrain rtv expr (FromAnnotation name arity (TypedIfBranch index) tipe)
@@ -332,7 +332,7 @@ constrainIf rtv region branches final expectation =
333 [ CAnd condCons
333 [ CAnd condCons
334 , CAnd branchCons
334 , CAnd branchCons
335− , CEqual region If branchType expectation
335+ , CEqual region If branchType expected
@@ -340,17 +340,17 @@ constrainIf rtv region branches final expectation =
340-- CONSTRAIN CASE EXPRESSIONS
340-- CONSTRAIN CASE EXPRESSIONS
343−constrainCase :: RTV -> R.Region -> Can.Expr -> [Can.CaseBranch] -> Expectation -> IO Constraint
343+constrainCase :: RTV -> R.Region -> Can.Expr -> [Can.CaseBranch] -> Expected Type -> IO Constraint
344−constrainCase rtv region expr branches expectation =
344+constrainCase rtv region expr branches expected =
345 do ptrnVar <- mkFlexVar
345 do ptrnVar <- mkFlexVar
346 let ptrnType = VarN ptrnVar
346 let ptrnType = VarN ptrnVar
347 exprCon <- constrain rtv expr (NoExpectation ptrnType)
347 exprCon <- constrain rtv expr (NoExpectation ptrnType)
349− case expectation of
349+ case expected of
350 FromAnnotation name arity _ tipe ->
350 FromAnnotation name arity _ tipe ->
351 do branchCons <- Index.indexedForA branches $ \index branch ->
351 do branchCons <- Index.indexedForA branches $ \index branch ->
352 constrainCaseBranch rtv branch
352 constrainCaseBranch rtv branch
353− (PatternExpectation region (PCaseMatch index) ptrnType)
353+ (PFromContext region (PCaseMatch index) ptrnType)
354 (FromAnnotation name arity (TypedCaseBranch index) tipe)
354 (FromAnnotation name arity (TypedCaseBranch index) tipe)
356 return $ exists [ptrnVar] $ CAnd (exprCon:branchCons)
356 return $ exists [ptrnVar] $ CAnd (exprCon:branchCons)
@@ -361,18 +361,18 @@ constrainCase rtv region expr branches expectation =
362 branchCons <- Index.indexedForA branches $ \index branch ->
362 branchCons <- Index.indexedForA branches $ \index branch ->
363 constrainCaseBranch rtv branch
363 constrainCaseBranch rtv branch
364− (PatternExpectation region (PCaseMatch index) ptrnType)
364+ (PFromContext region (PCaseMatch index) ptrnType)
365 (FromContext region (CaseBranch index) branchType)
365 (FromContext region (CaseBranch index) branchType)
367 return $ exists [ptrnVar,branchVar] $
367 return $ exists [ptrnVar,branchVar] $
369 [ exprCon
369 [ exprCon
370 , CAnd branchCons
370 , CAnd branchCons
371− , CEqual region Case branchType expectation
371+ , CEqual region Case branchType expected
375−constrainCaseBranch :: RTV -> Can.CaseBranch -> PatternExpectation -> Expectation -> IO Constraint
375+constrainCaseBranch :: RTV -> Can.CaseBranch -> PExpected Type -> Expected Type -> IO Constraint
376constrainCaseBranch rtv (Can.CaseBranch pattern _ expr) pExpect bExpect =
376constrainCaseBranch rtv (Can.CaseBranch pattern _ expr) pExpect bExpect =
377 do (Pattern.State headers pvars revCons) <-
377 do (Pattern.State headers pvars revCons) <-
378 Pattern.add pattern pExpect Pattern.emptyState
378 Pattern.add pattern pExpect Pattern.emptyState
@@ -385,13 +385,13 @@ constrainCaseBranch rtv (Can.CaseBranch pattern _ expr) pExpect bExpect =
385-- CONSTRAIN RECORD
385-- CONSTRAIN RECORD
388−constrainRecord :: RTV -> R.Region -> Map.Map N.Name Can.Expr -> Expectation -> IO Constraint
388+constrainRecord :: RTV -> R.Region -> Map.Map N.Name Can.Expr -> Expected Type -> IO Constraint
389−constrainRecord rtv region fields expectation =
389+constrainRecord rtv region fields expected =
390 do dict <- traverse (constrainField rtv) fields
390 do dict <- traverse (constrainField rtv) fields
392 let getType (_, t, _) = t
392 let getType (_, t, _) = t
393 let recordType = RecordN (Map.map getType dict) EmptyRecordN
393 let recordType = RecordN (Map.map getType dict) EmptyRecordN
394− let recordCon = CEqual region Record recordType expectation
394+ let recordCon = CEqual region Record recordType expected
396 let vars = Map.foldr (\(v,_,_) vs -> v:vs) [] dict
396 let vars = Map.foldr (\(v,_,_) vs -> v:vs) [] dict
397 let cons = Map.foldr (\(_,_,c) cs -> c:cs) [recordCon] dict
397 let cons = Map.foldr (\(_,_,c) cs -> c:cs) [recordCon] dict
@@ -411,8 +411,8 @@ constrainField rtv expr =
411-- CONSTRAIN RECORD UPDATE
411-- CONSTRAIN RECORD UPDATE
414−constrainUpdate :: RTV -> R.Region -> Can.Expr -> Map.Map N.Name Can.Expr -> Expectation -> IO Constraint
414+constrainUpdate :: RTV -> R.Region -> Can.Expr -> Map.Map N.Name Can.Expr -> Expected Type -> IO Constraint
415−constrainUpdate rtv region expr fields expectation =
415+constrainUpdate rtv region expr fields expected =
416 do sharedVar <- mkFlexVar
416 do sharedVar <- mkFlexVar
417 let sharedType = VarN sharedVar
417 let sharedType = VarN sharedVar
@@ -425,7 +425,7 @@ constrainUpdate rtv region expr fields expectation =
426 let getType (_, t, _) = t
426 let getType (_, t, _) = t
427 let newRecordType = RecordN (Map.map getType newDict) sharedType
427 let newRecordType = RecordN (Map.map getType newDict) sharedType
428− let newCon = CEqual region Record newRecordType expectation
428+ let newCon = CEqual region Record newRecordType expected
430 let vars = Map.foldr (\(v,_,_) vs -> v:vs) (sharedVar : Map.elems oldVars) newDict
430 let vars = Map.foldr (\(v,_,_) vs -> v:vs) (sharedVar : Map.elems oldVars) newDict
431 let cons = Map.foldr (\(_,_,c) cs -> c:cs) [newCon] newDict
431 let cons = Map.foldr (\(_,_,c) cs -> c:cs) [newCon] newDict
@@ -437,8 +437,8 @@ constrainUpdate rtv region expr fields expectation =
437-- CONSTRAIN TUPLE
437-- CONSTRAIN TUPLE
440−constrainTuple :: RTV -> R.Region -> Can.Expr -> Can.Expr -> Maybe Can.Expr -> Expectation -> IO Constraint
440+constrainTuple :: RTV -> R.Region -> Can.Expr -> Can.Expr -> Maybe Can.Expr -> Expected Type -> IO Constraint
441−constrainTuple rtv region a b maybeC expectation =
441+constrainTuple rtv region a b maybeC expected =
442 do aVar <- mkFlexVar
442 do aVar <- mkFlexVar
443 bVar <- mkFlexVar
443 bVar <- mkFlexVar
444 let aType = VarN aVar
444 let aType = VarN aVar
@@ -450,7 +450,7 @@ constrainTuple rtv region a b maybeC expectation =
450 case maybeC of
450 case maybeC of
451 Nothing ->
451 Nothing ->
452 do let tupleType = TupleN aType bType Nothing
452 do let tupleType = TupleN aType bType Nothing
453− let tupleCon = CEqual region Tuple tupleType expectation
453+ let tupleCon = CEqual region Tuple tupleType expected
454 return $ exists [ aVar, bVar ] $ CAnd [ aCon, bCon, tupleCon ]
454 return $ exists [ aVar, bVar ] $ CAnd [ aCon, bCon, tupleCon ]
456 Just c ->
456 Just c ->
@@ -460,7 +460,7 @@ constrainTuple rtv region a b maybeC expectation =
460 cCon <- constrain rtv c (NoExpectation cType)
460 cCon <- constrain rtv c (NoExpectation cType)
462 let tupleType = TupleN aType bType (Just cType)
462 let tupleType = TupleN aType bType (Just cType)
463− let tupleCon = CEqual region Tuple tupleType expectation
463+ let tupleCon = CEqual region Tuple tupleType expected
465 return $ exists [ aVar, bVar, cVar ] $ CAnd [ aCon, bCon, cCon, tupleCon ]
465 return $ exists [ aVar, bVar, cVar ] $ CAnd [ aCon, bCon, cCon, tupleCon ]
@@ -469,8 +469,8 @@ constrainTuple rtv region a b maybeC expectation =
469-- CONSTRAIN SHADER
469-- CONSTRAIN SHADER
472−constrainShader :: R.Region -> Shader.Shader -> Expectation -> IO Constraint
472+constrainShader :: R.Region -> Shader.Shader -> Expected Type -> IO Constraint
473−constrainShader region (Shader.Shader attributes uniforms varyings) expectation =
473+constrainShader region (Shader.Shader attributes uniforms varyings) expected =
474 do attrVar <- mkFlexVar
474 do attrVar <- mkFlexVar
475 unifVar <- mkFlexVar
475 unifVar <- mkFlexVar
476 let attrType = VarN attrVar
476 let attrType = VarN attrVar
@@ -484,7 +484,7 @@ constrainShader region (Shader.Shader attributes uniforms varyings) expectation
486 return $ exists [ attrVar, unifVar ] $
486 return $ exists [ attrVar, unifVar ] $
487− CEqual region Shader shaderType expectation
487+ CEqual region Shader shaderType expected
490toShaderRecord :: Map.Map N.Name Shader.Type -> Type -> Type
490toShaderRecord :: Map.Map N.Name Shader.Type -> Type -> Type
@@ -517,7 +517,7 @@ constrainDestruct rtv region pattern expr bodyCon =
517 let patternType = VarN patternVar
517 let patternType = VarN patternVar
519 (Pattern.State headers pvars revCons) <-
519 (Pattern.State headers pvars revCons) <-
520− Pattern.add pattern (NoPatternExpectation patternType) Pattern.emptyState
520+ Pattern.add pattern (PNoExpectation patternType) Pattern.emptyState
522 exprCon <-
522 exprCon <-
523 constrain rtv expr (FromContext region Destructure patternType)
523 constrain rtv expr (FromContext region Destructure patternType)
@@ -563,9 +563,9 @@ constrainDef rtv def bodyCon =
563 (TypedArgs tipe resultType (Pattern.State headers pvars revCons)) <-
563 (TypedArgs tipe resultType (Pattern.State headers pvars revCons)) <-
564 constrainTypedArgs newRtv name typedArgs srcResultType
564 constrainTypedArgs newRtv name typedArgs srcResultType
566− let expectation = FromAnnotation name (length typedArgs) TypedBody resultType
566+ let expected = FromAnnotation name (length typedArgs) TypedBody resultType
567 exprCon <-
567 exprCon <-
568− constrain newRtv expr expectation
568+ constrain newRtv expr expected
@@ -709,7 +709,7 @@ argsHelp args state =
710 (Args vars tipe result newState) <-
710 (Args vars tipe result newState) <-
711 argsHelp otherArgs =<<
711 argsHelp otherArgs =<<
712− Pattern.add pattern (NoPatternExpectation argType) state
712+ Pattern.add pattern (PNoExpectation argType) state
714 return (Args (argVar:vars) (FunN argType tipe) result newState)
714 return (Args (argVar:vars) (FunN argType tipe) result newState)
@@ -740,10 +740,10 @@ typedArgsHelp rtv name args resultType state =
741 (Can.TypedArg index srcType pattern@(A.At region _)) : otherArgs ->
741 (Can.TypedArg index srcType pattern@(A.At region _)) : otherArgs ->
742 do argType <- Instantiate.fromSrcType rtv srcType
742 do argType <- Instantiate.fromSrcType rtv srcType
743− let expect = PatternExpectation region (PTypedArg name index) argType
743+ let expected = PFromContext region (PTypedArg name index) argType
745 (TypedArgs tipe result newState) <-
745 (TypedArgs tipe result newState) <-
746 typedArgsHelp rtv name otherArgs resultType =<<
746 typedArgsHelp rtv name otherArgs resultType =<<
747− Pattern.add pattern expect state
747+ Pattern.add pattern expected state
749 return (TypedArgs (FunN argType tipe) result newState)
749 return (TypedArgs (FunN argType tipe) result newState)