private static PrettyPrinter.Node Build(SupercombinatorDefinition <Name> scDef)
        {
            var header = new[] { scDef.Name }.Concat(scDef.Parameters).Select(x => Str(x.Value));
            var headerNode = Interleave(Str(" "), header);

            var body = scDef.Body.Accept(ExpressionPrinter.Instance, null);

            return(Append(headerNode, Str(" = "), Indent(body)));
        }
Ejemplo n.º 2
0
 public bool Equals(SupercombinatorDefinition <TId>?other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(Name.Equals(other.Name) && Parameters.Equals(other.Parameters) && Body.Equals(other.Body));
 }
 public static string Print(SupercombinatorDefinition <Name> scDef)
 {
     return(PrettyPrinter.Display(Build(scDef)));
 }