Skip to content

Instantly share code, notes, and snippets.

@SteveGilham
Created May 14, 2015 18:59
Show Gist options
  • Select an option

  • Save SteveGilham/25700d6a45f480c4266a to your computer and use it in GitHub Desktop.

Select an option

Save SteveGilham/25700d6a45f480c4266a to your computer and use it in GitHub Desktop.
internal static class $Program
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
internal static FSharpFunc<int, int> add2@11;
[DebuggerBrowsable(DebuggerBrowsableState.Never), DebuggerNonUserCode, CompilerGenerated]
internal static int init@;
public static void main@()
{
int n = 2;
$Program.add2@11 = new Program.add2@11(n);
FSharpList<object> fSharpList = FSharpList<object>.Cons(new Program.clo@20(), FSharpList<object>.Cons(new Program.clo@20-1(), FSharpList<object>.Cons(Program.add2, FSharpList<object>.Cons(new Program.clo@20-2(), FSharpList<object>.Empty))));
FSharpFunc<object, Unit> action = new Program.clo@21-3();
FSharpList<object> fSharpList2 = fSharpList;
SeqModule.Iterate<object>(action, (IEnumerable<object>)fSharpList2);
ExtraTopLevelOperators.PrintFormatLine<Unit>(new PrintfFormat<Unit, TextWriter, Unit, Unit, Unit>("-------------------"));
FSharpList<object> fSharpList3 = FSharpList<object>.Cons(new Program.clo@25-4(), FSharpList<object>.Cons(new Program.clo@25-5(), FSharpList<object>.Cons(Program.add2, FSharpList<object>.Cons(new Program.clo@25-6(), FSharpList<object>.Empty))));
FSharpFunc<object, Unit> action2 = new Program.clo@26-7();
FSharpList<object> fSharpList4 = fSharpList3;
SeqModule.Iterate<object>(action2, (IEnumerable<object>)fSharpList4);
}
}
[CompilationMapping(SourceConstructFlags.Module)]
public static class Program
{
[Serializable]
internal class add2@11 : FSharpFunc<int, int>
{
[DebuggerBrowsable(DebuggerBrowsableState.Never), DebuggerNonUserCode, CompilerGenerated]
public int n;
internal add2@11(int n)
{
this.n = n;
}
public override int Invoke(int x)
{
return Program.addN(this.n, x);
}
}
[Serializable]
internal class clo@20 : FSharpFunc<FSharpList<object>, FSharpList<object>>
{
internal clo@20()
{
}
public override FSharpList<object> Invoke(FSharpList<object> m)
{
return Program.mhead(m);
}
}
[Serializable]
internal class clo@20-1 : OptimizedClosures.FSharpFunc<int, int, int>
{
internal clo@20-1()
{
}
public override int Invoke(int n, int x)
{
return Program.addN(n, x);
}
}
[Serializable]
internal class clo@20-2 : FSharpFunc<object, Unit>
{
internal clo@20-2()
{
}
public override Unit Invoke(object x)
{
Program.emitString<object>(x);
return null;
}
}
[Serializable]
internal class clo@21-3 : FSharpFunc<object, Unit>
{
internal clo@21-3()
{
}
public override Unit Invoke(object x)
{
Program.emitString<object>(x);
return null;
}
}
[Serializable]
internal class clo@25-4 : FSharpFunc<FSharpList<object>, FSharpList<object>>
{
internal clo@25-4()
{
}
public override FSharpList<object> Invoke(FSharpList<object> m)
{
return Program.mhead(m);
}
}
[Serializable]
internal class clo@25-5 : OptimizedClosures.FSharpFunc<int, int, int>
{
internal clo@25-5()
{
}
public override int Invoke(int n, int x)
{
return Program.addN(n, x);
}
}
[Serializable]
internal class clo@25-6 : FSharpFunc<object, Unit>
{
internal clo@25-6()
{
}
public override Unit Invoke(object x)
{
Program.emitString<object>(x);
return null;
}
}
[Serializable]
internal class clo@26-7 : FSharpFunc<object, Unit>
{
internal clo@26-7()
{
}
public override Unit Invoke(object x)
{
Program.emitString<object>(x);
return null;
}
}
[CompilationMapping(SourceConstructFlags.Value)]
public static FSharpFunc<int, int> add2
{
get
{
return $Program.add2@11;
}
}
public static FSharpList<object> mhead(FSharpList<object> m)
{
return FSharpList<object>.Cons(m.Head, FSharpList<object>.Empty);
}
[CompilationArgumentCounts(new int[] {1,1})]
public static int addN(int n, int x)
{
return x + n;
}
public static void emitString<a>(a x)
{
SoapFormatter sf = new SoapFormatter();
MemoryStream sink = new MemoryStream();
sf.Serialize(sink, x);
FSharpFunc<string, Unit> fSharpFunc = ExtraTopLevelOperators.PrintFormatLine<FSharpFunc<string, Unit>>(new PrintfFormat<FSharpFunc<string, Unit>, TextWriter, Unit, Unit, string>("%s"));
a a = x;
string fullName = a.GetType().FullName;
fSharpFunc.Invoke(fullName);
FSharpFunc<string, Unit> fSharpFunc2 = ExtraTopLevelOperators.PrintFormatLine<FSharpFunc<string, Unit>>(new PrintfFormat<FSharpFunc<string, Unit>, TextWriter, Unit, Unit, string>("%s"));
string @string = Encoding.Default.GetString(sink.ToArray());
fSharpFunc2.Invoke(@string);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment