public override void Write(CodeBuffer buf) { buf.Append("type ").Append(Name).AppendLine(" ="); buf.Indented(() => { for (var i = 0; i < Alternatives.Count; i++) { var altName = Alternatives[i]; if (i > 0) { buf.Append("| ").AppendLine(altName); } else { buf.Indented(() => buf.AppendLine(altName)); } } }); }
public override void Write(CodeBuffer buf) { buf.AppendLine(Type); var headerItems = new List <string>(); headerItems.Add(Name); headerItems.AddRange(Params); headerItems.Add("="); buf.AppendLine(string.Join(' ', headerItems)); buf.Indented(() => buf.AppendLine(Body)); }
public override void Write(CodeBuffer buf) { buf.Append("case ").Append(Exp).AppendLine(" of"); buf.Indent(); foreach (var(pred, body) in Cases) { buf.Append(pred).AppendLine(" ->"); buf.Indented(() => buf.AppendLine(body)); } buf.DeIndent(); }
public override void Write(CodeBuffer buf) { buf.Append("type alias ").Append(Name).AppendLine(" ="); buf.Indented(() => { var i = 0; foreach (var field in Fields) { if (i == 0) { buf.Append("{ "); } else { buf.Append(", "); } buf.Append(field.Key).Append(" : ").AppendLine(field.Value); i++; } buf.AppendLine("}"); }); }
public override void Write(CodeBuffer buf) { buf.AppendLine($"(\\{string.Join(' ', Params)} ->"); buf.Indented(() => buf.AppendLine(Body)); buf.AppendLine(")"); }