@@ -726,22 +726,22 @@ data TypedArgs =
726726
727727constrainTypedArgs :: Map.Map N.Name Type -> N.Name -> [(Can.Pattern, Can.Type)] -> Can.Type -> IO TypedArgs
728728constrainTypedArgs rtv name args srcResultType =
729− do resultType <- Instantiate.fromSrcType rtv srcResultType
730− typedArgsHelp rtv name Index.first args resultType Pattern.emptyState
729+ typedArgsHelp rtv name Index.first args srcResultType Pattern.emptyState
731730
732731
733−typedArgsHelp :: Map.Map N.Name Type -> N.Name -> Index.ZeroBased -> [(Can.Pattern, Can.Type)] -> Type -> Pattern.State -> IO TypedArgs
734−typedArgsHelp rtv name index args resultType state =
732+typedArgsHelp :: Map.Map N.Name Type -> N.Name -> Index.ZeroBased -> [(Can.Pattern, Can.Type)] -> Can.Type -> Pattern.State -> IO TypedArgs
733+typedArgsHelp rtv name index args srcResultType state =
735734 case args of
736735 [] ->
737− return $ TypedArgs resultType resultType state
736+ do resultType <- Instantiate.fromSrcType rtv srcResultType
737+ return $ TypedArgs resultType resultType state
738738
739739 (pattern@(A.At region _), srcType) : otherArgs ->
740740 do argType <- Instantiate.fromSrcType rtv srcType
741741 let expected = PFromContext region (PTypedArg name index) argType
742742
743− (TypedArgs tipe result newState) <-
744− typedArgsHelp rtv name (Index.next index) otherArgs resultType =<<
743+ (TypedArgs tipe resultType newState) <-
744+ typedArgsHelp rtv name (Index.next index) otherArgs srcResultType =<<
745745 Pattern.add pattern expected state
746746
747− return (TypedArgs (FunN argType tipe) result newState)
747+ return (TypedArgs (FunN argType tipe) resultType newState)