From b1d166bcf88c24c2a1847866d1cf4e944fb80788 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Wed, 29 Apr 2015 23:58:19 -0400 Subject: - Made a slight correction to the Syntax type when it comes to records (slot-names are no longer Text, but Syntax). - lux/type;bound? no longer does further derefs to check for bound-ness? - Improved the way 2 type-vars are type-checked. - When cleaning type-vars, the dereffed typed is no longer cleaned again. --- src/lux/type.clj | 50 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/lux/type.clj b/src/lux/type.clj index 73b244569..684ff374d 100644 --- a/src/lux/type.clj +++ b/src/lux/type.clj @@ -114,7 +114,7 @@ (&/T "lux;Tag" Ident) (&/T "lux;Form" Syntax*List) (&/T "lux;Tuple" Syntax*List) - (&/T "lux;Record" (&/V "lux;AppT" (&/T List (&/V "lux;TupleT" (&/|list Text Syntax*)))))) + (&/T "lux;Record" (&/V "lux;AppT" (&/T List (&/V "lux;TupleT" (&/|list Syntax* Syntax*)))))) )))) (def Syntax @@ -141,14 +141,7 @@ (if-let [type (->> state (&/get$ &/$TYPES) (&/get$ &/$MAPPINGS) (&/|get id))] (matchv ::M/objects [type] [["lux;Some" type*]] - (matchv ::M/objects [type*] - [["lux;VarT" ?id]] - (&/run-state (&/try-all% (&/|list (bound? ?id) - (return false))) - state) - - [_] - (return* state true)) + (return* state true) [["lux;None" _]] (return* state false)) @@ -222,8 +215,7 @@ (matchv ::M/objects [type] [["lux;VarT" ?id]] (if (= ?tid ?id) - (|do [=type (deref ?id)] - (clean* ?tid =type)) + (deref ?id) (return type)) [["lux;LambdaT" [?arg ?return]]] @@ -514,12 +506,36 @@ [["lux;VarT" ?eid] ["lux;VarT" ?aid]] (if (= ?eid ?aid) (return (&/T fixpoints nil)) - (&/try-all% (&/|list (|do [ebound (deref ?eid)] - (check* fixpoints ebound actual)) - (|do [abound (deref ?aid)] - (check* fixpoints expected abound)) - (|do [_ (set-var ?eid actual)] - (return (&/T fixpoints nil)))))) + ;; (&/try-all% (&/|list (|do [ebound (deref ?eid)] + ;; (check* fixpoints ebound actual)) + ;; (|do [abound (deref ?aid)] + ;; (check* fixpoints expected abound)) + ;; (|do [_ (set-var ?eid actual)] + ;; (return (&/T fixpoints nil))))) + (|do [ebound (&/try-all% (&/|list (|do [ebound (deref ?eid)] + (return (&/V "lux;Some" ebound))) + (return (&/V "lux;None" nil)))) + abound (&/try-all% (&/|list (|do [abound (deref ?aid)] + (return (&/V "lux;Some" abound))) + (return (&/V "lux;None" nil))))] + (matchv ::M/objects [ebound abound] + [["lux;None" _] ["lux;None" _]] + (|do [_ (set-var ?eid actual)] + (return (&/T fixpoints nil))) + + [["lux;Some" etype] ["lux;None" _]] + (check* fixpoints etype actual) + ;; (|do [_ (set-var ?aid etype)] + ;; (return (&/T fixpoints nil))) + + [["lux;None" _] ["lux;Some" atype]] + (check* fixpoints expected atype) + ;; (|do [_ (set-var ?eid atype)] + ;; (return (&/T fixpoints nil))) + + [["lux;Some" etype] ["lux;Some" atype]] + (check* fixpoints etype atype))) + ) [["lux;VarT" ?id] _] (&/try-all% (&/|list (|do [_ (set-var ?id actual)] -- cgit v1.2.3