3 ms·
Hmm, I think you could do something similar to QuickCheck using C# generics. The biggest problem you'd run into is probably the same as Haskell does (the expres
by Locke1689 13y ago
Hmm, I think you could do something similar to QuickCheck using C# generics. The biggest problem you'd run into is probably the same as Haskell does (the expression problem). You can get some ideas from http://www.daimi.au.dk/~madst/ecoop04/index.html http://www.daimi.au.dk/~madst/ecoop04/index.html.
Oh and you could probably always fall back to reflection and attributes, but that's just kind of cheating isn't it? ;)
- solomatov 13y ago>Hmm, I think you could do something similar to QuickCheck using C# generics You can't do this. Quick check can generate type classes instances, for example, for tuples, functions, etc. This is impossible in language like C#.
- SamReidHughes 13y agoNo it's not. The feature C# calls reflection lets you inspect types and generate them automatically.
- solomatov 13y agoIf we use reflection, we might know about error only in runtime. What haskell does is guaranteed to work at compile time. That's why it's so cool.
- Locke1689 13y agoThere are certainly cases which aren't expressible(things which require kinding, for example) but your examples aren't a problem. Both tuples and functions can be represented using System F, and thus can be completely transposed into C# generics. I believe you don't understand C# generics and you should look closer at the fundamental type calculus.