aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/platform/compiler/default/phase/analysis/primitive.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/lux/platform/compiler/default/phase/analysis/primitive.lux')
-rw-r--r--stdlib/source/lux/platform/compiler/default/phase/analysis/primitive.lux29
1 files changed, 29 insertions, 0 deletions
diff --git a/stdlib/source/lux/platform/compiler/default/phase/analysis/primitive.lux b/stdlib/source/lux/platform/compiler/default/phase/analysis/primitive.lux
new file mode 100644
index 000000000..bd42825d3
--- /dev/null
+++ b/stdlib/source/lux/platform/compiler/default/phase/analysis/primitive.lux
@@ -0,0 +1,29 @@
+(.module:
+ [lux (#- nat int rev)
+ [control
+ monad]]
+ ["." // (#+ Analysis Operation)
+ [".A" type]
+ ["/." //]])
+
+## [Analysers]
+(do-template [<name> <type> <tag>]
+ [(def: #export (<name> value)
+ (-> <type> (Operation Analysis))
+ (do ///.Monad<Operation>
+ [_ (typeA.infer <type>)]
+ (wrap (#//.Primitive (<tag> value)))))]
+
+ [bit Bit #//.Bit]
+ [nat Nat #//.Nat]
+ [int Int #//.Int]
+ [rev Rev #//.Rev]
+ [frac Frac #//.Frac]
+ [text Text #//.Text]
+ )
+
+(def: #export unit
+ (Operation Analysis)
+ (do ///.Monad<Operation>
+ [_ (typeA.infer Any)]
+ (wrap (#//.Primitive #//.Unit))))