package org.simantics.scl.compiler.internal.codegen.types; import org.cojen.classfile.TypeDesc; import org.simantics.scl.compiler.elaboration.modules.TypeConstructor; import org.simantics.scl.compiler.types.Type; import org.simantics.scl.compiler.types.Types; import org.simantics.scl.compiler.types.kinds.Kinds; public class MaybeType extends TypeConstructor { public static final MaybeType INSTANCE = new MaybeType(); private MaybeType() { super(Types.MAYBE, Kinds.STAR_TO_STAR); isOpen = false; setType(Types.con(Types.BUILTIN, "Maybe"), Types.var(Kinds.STAR)); documentation = "Represents an optional value."; } @Override public TypeDesc construct(JavaTypeTranslator translator, Type[] parameters) { return JavaTypeTranslator.toObjectType(translator.toTypeDesc(parameters[0])); } }