1 package org.simantics.scl.compiler.internal.codegen.types;
3 import org.cojen.classfile.TypeDesc;
4 import org.simantics.scl.compiler.elaboration.modules.TypeConstructor;
5 import org.simantics.scl.compiler.types.Type;
6 import org.simantics.scl.compiler.types.Types;
7 import org.simantics.scl.compiler.types.kinds.Kinds;
9 public class MaybeType extends TypeConstructor {
10 public static final MaybeType INSTANCE = new MaybeType();
13 super(Types.MAYBE, Kinds.STAR_TO_STAR);
15 setType(Types.con(Types.BUILTIN, "Maybe"), Types.var(Kinds.STAR));
16 documentation = "Represents an optional value.";
20 public TypeDesc construct(JavaTypeTranslator translator, Type[] parameters) {
21 return JavaTypeTranslator.toObjectType(translator.toTypeDesc(parameters[0]));