summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRose Hogenson <rosehogenson@posteo.net>2024-08-31 13:08:56 -0700
committerRose Hogenson <rosehogenson@posteo.net>2025-10-04 13:55:40 -0700
commitc48a992a6ed6ebd79c344b37364a680ddd948dea (patch)
tree3df5e6f5b3c4854d25387154731f780b650008d4 /tests
parented48b02873f3ea3cab0107176d00eb00c9519766 (diff)
downloadsml-c48a992a6ed6ebd79c344b37364a680ddd948dea.tar.zst
Combine structs and expressions
Diffstat (limited to 'tests')
-rw-r--r--tests/24-functor.sml17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/24-functor.sml b/tests/24-functor.sml
new file mode 100644
index 0000000..d18337e
--- /dev/null
+++ b/tests/24-functor.sml
@@ -0,0 +1,17 @@
+signature MagicNumber = sig
+ val n : int
+end
+
+functor Exiter(N : MagicNumber) = struct
+ fun exit _ = __builtin "exit" N.n
+end
+
+structure FourtyTwo = struct
+ val a = 16
+ val n = 42
+ val z = 38
+end
+
+structure FourtyTwoExiter = Exiter(FourtyTwo)
+
+val _ = FourtyTwoExiter.exit ()