From 3175ae85d62ff6f692b8cc127f56c6569041d788 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Mon, 1 May 2017 18:15:14 -0400 Subject: - WIP: Some initial implementations for some re-written infrastructure. --- new-luxc/source/luxc/module/descriptor/common.lux | 38 +++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 new-luxc/source/luxc/module/descriptor/common.lux (limited to 'new-luxc/source/luxc/module/descriptor/common.lux') diff --git a/new-luxc/source/luxc/module/descriptor/common.lux b/new-luxc/source/luxc/module/descriptor/common.lux new file mode 100644 index 000000000..60a313115 --- /dev/null +++ b/new-luxc/source/luxc/module/descriptor/common.lux @@ -0,0 +1,38 @@ +(;module: + lux + (lux (data [text] + (text format + ["l" lexer "l/" Monad]) + [char] + (coll [list "L/" Functor])))) + +(type: #export Signal Text) + +(do-template [ ] + [(def: #export Signal (|> char;char char;as-text))] + + [cons-signal +5] + [nil-signal +6] + [stop-signal +7] + ) + +(do-template [ ] + [(def: #export Signal )] + + [ident-separator ";"] + ) + +(def: #export (encode-list encode-elem types) + (All [a] (-> (-> a Text) (List a) Text)) + (format (|> (L/map encode-elem types) + (text;join-with cons-signal)) + nil-signal)) + +(def: #export (decode-list decode-elem) + (All [a] (-> (l;Lexer a) (l;Lexer (List a)))) + (l;alt (<| (l;after (l;text nil-signal)) + (l/wrap [])) + (<| (l;seq decode-elem) + (l;after (l;text cons-signal)) + (decode-list decode-elem)))) + -- cgit v1.2.3