Package hydra.typing
Class InferenceResult
- java.lang.Object
-
- hydra.typing.InferenceResult
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<InferenceResult>
public class InferenceResult extends java.lang.Object implements java.io.Serializable, java.lang.Comparable<InferenceResult>
The result of applying inference rules to a term.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classInferenceResult.BuilderA fluent builder forInferenceResult.
-
Field Summary
Fields Modifier and Type Field Description static NameCLASS_CONSTRAINTSName of thehydra.typing.InferenceResult.classConstraintsfield.java.util.Map<Name,TypeVariableConstraints>classConstraintsClass constraints discovered during inference (e.g., Ord constraints from Map.lookup)InferenceContextcontextThe updated InferenceContext after inference (carries fresh-variable counter and trace)static NameCONTEXTName of thehydra.typing.InferenceResult.contextfield.TypeSubstsubstThe type substitution resulting from unificationstatic NameSUBSTName of thehydra.typing.InferenceResult.substfield.TermtermThe term which was inferredstatic NameTERMName of thehydra.typing.InferenceResult.termfield.TypetypeThe inferred type of the termstatic NameTYPEName of thehydra.typing.InferenceResult.typefield.static NameTYPE_Name of thehydra.typing.InferenceResulttype.
-
Constructor Summary
Constructors Constructor Description InferenceResult(Term term, Type type, TypeSubst subst, java.util.Map<Name,TypeVariableConstraints> classConstraints, InferenceContext context)Constructs an immutableInferenceResult.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static InferenceResult.Builderbuilder()Creates a new fluent builder forInferenceResult.intcompareTo(InferenceResult other)booleanequals(java.lang.Object other)inthashCode()java.lang.StringtoString()InferenceResultwithClassConstraints(java.util.Map<Name,TypeVariableConstraints> classConstraints)Returns a copy of thisInferenceResultwithclassConstraintsreplaced.InferenceResultwithContext(InferenceContext context)Returns a copy of thisInferenceResultwithcontextreplaced.InferenceResultwithSubst(TypeSubst subst)Returns a copy of thisInferenceResultwithsubstreplaced.InferenceResultwithTerm(Term term)Returns a copy of thisInferenceResultwithtermreplaced.InferenceResultwithType(Type type)Returns a copy of thisInferenceResultwithtypereplaced.
-
-
-
Field Detail
-
TYPE_
public static final Name TYPE_
Name of thehydra.typing.InferenceResulttype.
-
TERM
public static final Name TERM
Name of thehydra.typing.InferenceResult.termfield.
-
TYPE
public static final Name TYPE
Name of thehydra.typing.InferenceResult.typefield.
-
SUBST
public static final Name SUBST
Name of thehydra.typing.InferenceResult.substfield.
-
CLASS_CONSTRAINTS
public static final Name CLASS_CONSTRAINTS
Name of thehydra.typing.InferenceResult.classConstraintsfield.
-
CONTEXT
public static final Name CONTEXT
Name of thehydra.typing.InferenceResult.contextfield.
-
term
public final Term term
The term which was inferred
-
type
public final Type type
The inferred type of the term
-
subst
public final TypeSubst subst
The type substitution resulting from unification
-
classConstraints
public final java.util.Map<Name,TypeVariableConstraints> classConstraints
Class constraints discovered during inference (e.g., Ord constraints from Map.lookup)
-
context
public final InferenceContext context
The updated InferenceContext after inference (carries fresh-variable counter and trace)
-
-
Constructor Detail
-
InferenceResult
public InferenceResult(Term term, Type type, TypeSubst subst, java.util.Map<Name,TypeVariableConstraints> classConstraints, InferenceContext context)
Constructs an immutableInferenceResult.- Parameters:
term- The term which was inferredtype- The inferred type of the termsubst- The type substitution resulting from unificationclassConstraints- Class constraints discovered during inference (e.g., Ord constraints from Map.lookup)context- The updated InferenceContext after inference (carries fresh-variable counter and trace)
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
compareTo
public int compareTo(InferenceResult other)
- Specified by:
compareToin interfacejava.lang.Comparable<InferenceResult>
-
withTerm
public InferenceResult withTerm(Term term)
Returns a copy of thisInferenceResultwithtermreplaced.
-
withType
public InferenceResult withType(Type type)
Returns a copy of thisInferenceResultwithtypereplaced.
-
withSubst
public InferenceResult withSubst(TypeSubst subst)
Returns a copy of thisInferenceResultwithsubstreplaced.
-
withClassConstraints
public InferenceResult withClassConstraints(java.util.Map<Name,TypeVariableConstraints> classConstraints)
Returns a copy of thisInferenceResultwithclassConstraintsreplaced.
-
withContext
public InferenceResult withContext(InferenceContext context)
Returns a copy of thisInferenceResultwithcontextreplaced.
-
builder
public static InferenceResult.Builder builder()
Creates a new fluent builder forInferenceResult.
-
-