diff options
Diffstat (limited to '')
-rw-r--r-- | new-luxc/source/luxc/base.lux | 27 |
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))) |