public IType Eval(Unique unique, IType type) { var methodTypes = new Dictionary<string, IType>(); foreach (KeyValuePair<string, IType> kvp in mMethodTypes) { methodTypes.Add(kvp.Key, kvp.Value.Eval(unique, type)); } return new TObj(methodTypes); }
public IType CheckPolymorphicTypeApp( IKind parameterKind, IKind argumentKind, Unique parameter, IType body, IType argument ) { if (!argumentKind.Equals(parameterKind)) { throw new ArgumentException( string.Format( "unexpected {0}, expected {1}", argumentKind.Show(), parameterKind.Show() ) ); } return body.Eval(parameter, argument); }
private static IType UnrollRecursiveType(IType body, Unique unique) { return body.Replace( unique, MakeRecursiveType(unique, body.Rename()) ); }
private static IType MakeRecursiveType(Unique unique, IType type) { return new TApp(TCRec.Instance, new TAbs(unique, type)); }