This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.Data; | |
using System.Drawing; | |
using System.Linq; | |
using System.Text; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using System.Windows.Forms; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace ConsoleApp8 | |
{ | |
class Program | |
{ | |
class MyCustomException : Exception | |
{ | |
} | |
private static readonly object sync = new object(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using ConsoleApp8; | |
namespace ConsoleApp8 | |
{ | |
class Program | |
{ | |
class MyCustomException : Exception | |
{ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
using System.Reflection; | |
class Program | |
{ | |
class MyClass | |
{ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Diagnostics; | |
using System.Runtime.InteropServices; | |
using System.Threading; | |
namespace ConsoleApplication2 | |
{ | |
class Program | |
{ | |
struct Fuck |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int i = 21; | |
TypedReference tr = __makeref(i); | |
Type t = __reftype(tr); | |
Console.WriteLine(t.ToString()); | |
int rv = __refvalue( tr,int); | |
Console.WriteLine(rv); | |
ArglistTest.DisplayNumbersOnConsole(__arglist(1, 2, 3, 5, 6)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyVoid | |
{ | |
public static readonly MyVoid Instance = new MyVoid(); | |
private MyVoid() | |
{ | |
unsafe | |
{ | |
MyVoid it = this; | |
TypedReference typedReference = __makeref(it); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class ArglistTest | |
{ | |
public static void DisplayNumbersOnConsole(__arglist) | |
{ | |
ArgIterator ai = new ArgIterator(__arglist); | |
while (ai.GetRemainingCount() > 0) | |
{ | |
TypedReference tr = ai.GetNextArg(); | |
Console.WriteLine(TypedReference.ToObject(tr)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Modified from the original https://gist.github.com/louthy/524fbe8965d3a2aae1b576cdd8e971e4 | |
- removed dependency on [language-ext](https://github.com/louthy/language-ext) | |
- separated monadic boilerplate, so you may concentrate on describing the operations and interpretation of the program | |
- removed `IO<A>.Faulted` to simplify the examples. It can be added back in straightforward manner. | |
Useful links: | |
- [John DeGoes: Beyond Free Monads - λC Winter Retreat 2017](https://www.youtube.com/watch?v=A-lmrvsUi2Y) | |
- [Free and tagless compared - how not to commit to a monad too early](https://softwaremill.com/free-tagless-compared-how-not-to-commit-to-monad-too-early) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Fiber | |
{ | |
private readonly Stack<IEnumerator> stackFrame = | |
new Stack<IEnumerator>(); | |
private IEnumerator currentRoutine; | |
public Fiber(IEnumerator entryPoint) | |
{ | |
this.currentRoutine = entryPoint; | |
} |