aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/shedlang/compiler/types/Effect.java2
-rw-r--r--src/main/java/org/shedlang/compiler/types/EffectParam.java24
2 files changed, 25 insertions, 1 deletions
diff --git a/src/main/java/org/shedlang/compiler/types/Effect.java b/src/main/java/org/shedlang/compiler/types/Effect.java
index 01ba00a3..cb47c81f 100644
--- a/src/main/java/org/shedlang/compiler/types/Effect.java
+++ b/src/main/java/org/shedlang/compiler/types/Effect.java
@@ -1,4 +1,4 @@
package org.shedlang.compiler.types;
-public sealed interface Effect extends TypeLevelValue permits EffectUnion, IoEffect, NoneEffect, UserDefinedEffect {
+public sealed interface Effect extends TypeLevelValue permits EffectParam, EffectUnion, IoEffect, NoneEffect, UserDefinedEffect {
}
diff --git a/src/main/java/org/shedlang/compiler/types/EffectParam.java b/src/main/java/org/shedlang/compiler/types/EffectParam.java
new file mode 100644
index 00000000..e8ae6121
--- /dev/null
+++ b/src/main/java/org/shedlang/compiler/types/EffectParam.java
@@ -0,0 +1,24 @@
+package org.shedlang.compiler.types;
+
+public record EffectParam(Scope scope, String name) implements Effect {
+ public static EffectParam forFunction(
+ NamespaceName namespaceName,
+ String functionName,
+ String name
+ ) {
+ return new EffectParam(new Scope.Function(namespaceName, functionName), name);
+ }
+
+ public static EffectParam forStructType(SimpleStructType structType, String name) {
+ return new EffectParam(new Scope.Struct(structType), name);
+ }
+
+ public static EffectParam forSumType(SimpleSumType sumType, String name) {
+ return new EffectParam(new Scope.Sum(sumType), name);
+ }
+
+ @Override
+ public String describe() {
+ return name;
+ }
+}