From 74a835634fc9ee5457f3cc7109af069dad9f2d2f Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Wed, 11 Oct 2017 18:57:44 -0400 Subject: - Migrated new-luxc to latest version of stdlib. - Some refactoring. --- new-luxc/source/luxc/analyser/inference.lux | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'new-luxc/source/luxc/analyser/inference.lux') diff --git a/new-luxc/source/luxc/analyser/inference.lux b/new-luxc/source/luxc/analyser/inference.lux index 8390a890c..9b2411249 100644 --- a/new-luxc/source/luxc/analyser/inference.lux +++ b/new-luxc/source/luxc/analyser/inference.lux @@ -1,11 +1,12 @@ (;module: lux (lux (control monad) - (data text/format + (data [maybe] + text/format (coll [list "L/" Functor])) [macro #+ Monad] [type] - (type ["TC" check])) + (type ["tc" check])) (luxc ["&" base] (lang ["la" analysis #+ Analysis]) (analyser ["&;" common]))) @@ -74,23 +75,23 @@ (&common;with-var (function [[var-id varT]] (do Monad - [[outputT argsA] (apply-function analyse (assume (type;apply (list varT) funcT)) args)] + [[outputT argsA] (apply-function analyse (maybe;assume (type;apply (list varT) funcT)) args)] (do @ - [? (&;within-type-env - (TC;bound? var-id)) + [? (&;with-type-env + (tc;bound? var-id)) ## Quantify over the type if genericity/parametricity ## is discovered. outputT' (if ? - (&;within-type-env - (TC;clean var-id outputT)) + (&;with-type-env + (tc;clean var-id outputT)) (wrap (type;univ-q +1 (replace-var var-id +1 outputT))))] (wrap [outputT' argsA]))))) (#;ExQ _) (do Monad - [[ex-id exT] (&;within-type-env - TC;existential)] - (apply-function analyse (assume (type;apply (list exT) funcT)) args)) + [[ex-id exT] (&;with-type-env + tc;existential)] + (apply-function analyse (maybe;assume (type;apply (list exT) funcT)) args)) ## Arguments are inferred back-to-front because, by convention, ## Lux functions take the most important arguments *last*, which -- cgit v1.2.3