aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/base.lux
diff options
context:
space:
mode:
authorEduardo Julian2017-05-09 17:48:27 -0400
committerEduardo Julian2017-05-09 17:48:27 -0400
commitdd5220e13b03c8f85972feac535a34ef64525222 (patch)
tree2ac08a118eaa63f11c2397a08eaca74d199f2d1e /new-luxc/source/luxc/base.lux
parent7b74c1258f345d576b0c798303b0ed28f1734368 (diff)
- Added tests for some kinds of analysis.
- WIP: Porting more code.
Diffstat (limited to 'new-luxc/source/luxc/base.lux')
-rw-r--r--new-luxc/source/luxc/base.lux27
1 files changed, 22 insertions, 5 deletions
diff --git a/new-luxc/source/luxc/base.lux b/new-luxc/source/luxc/base.lux
index bc05afea4..3a085e07e 100644
--- a/new-luxc/source/luxc/base.lux
+++ b/new-luxc/source/luxc/base.lux
@@ -5,7 +5,14 @@
text/format
["E" error])
[macro #+ Monad<Lux>]
- (type ["TC" check])))
+ (type ["TC" check]))
+ (luxc (lang ["la" analysis])))
+
+(type: #export Eval
+ (-> Type Code (Lux Top)))
+
+(type: #export Analyser
+ (-> Eval Code (Lux la;Analysis)))
(type: #export Path Text)
@@ -47,7 +54,17 @@
(#E;Success [(set@ #;type-context context' compiler)
output]))))
-(def: #export (pl::put key val table)
+(def: #export (pl-contains? key mappings)
+ (All [a] (-> Text (List [Text a]) Bool))
+ (case mappings
+ #;Nil
+ false
+
+ (#;Cons [k v] mappings')
+ (or (T/= key k)
+ (pl-contains? key mappings'))))
+
+(def: #export (pl-put key val table)
(All [a] (-> Text a (List [Text a]) (List [Text a])))
(case table
#;Nil
@@ -58,9 +75,9 @@
(#;Cons [key val]
table')
(#;Cons [k' v']
- (pl::put key val table')))))
+ (pl-put key val table')))))
-(def: #export (pl::get key table)
+(def: #export (pl-get key table)
(All [a] (-> Text (List [Text a]) (Maybe a)))
(case table
#;Nil
@@ -69,7 +86,7 @@
(#;Cons [k' v'] table')
(if (T/= key k')
(#;Some v')
- (pl::get key table'))))
+ (pl-get key table'))))
(def: #export (with-source-code source action)
(All [a] (-> [Cursor Text] (Lux a) (Lux a)))