Пример #1
0
 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);
 }
Пример #2
0
 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);
 }
Пример #3
0
 private static IType UnrollRecursiveType(IType body, Unique unique)
 {
     return body.Replace(
         unique, MakeRecursiveType(unique, body.Rename())
     );
 }
Пример #4
0
 private static IType MakeRecursiveType(Unique unique, IType type)
 {
     return new TApp(TCRec.Instance, new TAbs(unique, type));
 }