HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
MattWindsor91
roslyn
C#2017–2018
MattWindsor91 / roslyn

roslyn

Experimental concepts for C# using Roslyn

3Distinct people
4Mentions
0Explicit recommenders
79GitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

Experimental concepts for C# using Roslyn

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 5:04:57 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by month4 dated mentions

Observed mentions: 2017-01-11 11:11:16 UTC to 2018-02-06 12:13:16 UTC.

012017-01-01 00:00:00 UTC to 2017-02-01 00:00:00 UTC (exclusive): 1 mentions; 1 submissions, 0 commentsJan 20172017-02-01 00:00:00 UTC to 2017-03-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2017-03-01 00:00:00 UTC to 2017-04-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2017-04-01 00:00:00 UTC to 2017-05-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2017-05-01 00:00:00 UTC to 2017-06-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2017-06-01 00:00:00 UTC to 2017-07-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2017-07-01 00:00:00 UTC to 2017-08-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 commentsJul 20172017-08-01 00:00:00 UTC to 2017-09-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2017-09-01 00:00:00 UTC to 2017-10-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2017-10-01 00:00:00 UTC to 2017-11-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2017-11-01 00:00:00 UTC to 2017-12-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2017-12-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2018-01-01 00:00:00 UTC to 2018-02-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2018-02-01 00:00:00 UTC to 2018-03-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 commentsFeb 2018

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
Jan 20172017-01-01 00:00:00 UTC2017-02-01 00:00:00 UTC110
Feb 20172017-02-01 00:00:00 UTC2017-03-01 00:00:00 UTC101
Mar 20172017-03-01 00:00:00 UTC2017-04-01 00:00:00 UTC000
Apr 20172017-04-01 00:00:00 UTC2017-05-01 00:00:00 UTC000
May 20172017-05-01 00:00:00 UTC2017-06-01 00:00:00 UTC000
Jun 20172017-06-01 00:00:00 UTC2017-07-01 00:00:00 UTC000
Jul 20172017-07-01 00:00:00 UTC2017-08-01 00:00:00 UTC000
Aug 20172017-08-01 00:00:00 UTC2017-09-01 00:00:00 UTC101
Sep 20172017-09-01 00:00:00 UTC2017-10-01 00:00:00 UTC000
Oct 20172017-10-01 00:00:00 UTC2017-11-01 00:00:00 UTC000
Nov 20172017-11-01 00:00:00 UTC2017-12-01 00:00:00 UTC000
Dec 20172017-12-01 00:00:00 UTC2018-01-01 00:00:00 UTC000
Jan 20182018-01-01 00:00:00 UTC2018-02-01 00:00:00 UTC000
Feb 20182018-02-01 00:00:00 UTC2018-03-01 00:00:00 UTC101

What Hacker News says

4 sources
> If you're going to dismiss safety issues in your approach with "Yes, it’s possible for programmers to write bugs." then there's no point having the conversation, because that's an equally good argument for not having a type system at all. Absolute nonsense. I didn't dismiss safety issues at all. I dismissed your claim that having to specify a `struct` constraint somehow makes the feature unworthy. C# has null, that's a fact of life, it's not dismissive to realise that a (granted, very annoying) part of the job of writing C# is dealing with null. So, using this doesn't make this technique any less safe than any other way of writing code in C#. So, yes, programmers will occasionally write null-dereference bugs in C# - that's the price we pay for bad language implementation decisions. Stating "that's an equally good argument for not ha
Read the rest
ving a type system at all." is clearly hyperbolic nonsense. > If we were willing to be unsafe we could just cast to the desired type. But it isn't unsafe! Not specifying a `struct` constraint is a bug. If you provide the constraint then it's safe. Trying to compare that to a dynamic cast where you have no type-system enforcement to one where you do is just idiotic. > I'd sooner pass the module dictionary explicitly, like one does in ML, than adopt a technique that would normalize having "default(...)" in my codebase. At no point was this trying to force you to use this technique. It was a reply to "Once you've got return type polymorphism, you really start to miss it in other languages. The simplest example possible is mempty". I use this technique very successfully a lot, and the exact mechanism (of using `default`) is in the process of being wrapped up into a new type-classes grammar for C# [1]. So, I guess you'd probably prefer to wait for that... [1] https://github.com/MattWindsor91/roslyn/blob/master/concepts...
In Return type polymorphism in Haskell
There's a great proposal for adding type classes to C# here: https://github.com/MattWindsor91/roslyn/blob/master/concepts... And I discuss some ways that could be integrated with the extension everything proposal here: https://github.com/dotnet/csharplang/issues/164 The problem with both is that there's a new notion of "shape" or "concept" that's different from interfaces. It would be nice to just use interfaces for this (which is what I hint at in the video), but that comes with its own downsides and limitations.
In A Preview of C# 8 [video]
You can almost do this in C# now [1]. It's ad-hoc polymorphism rather than full on type-classes, but it does facilitate generic programming in a way that I've not seen used in anger before. For example, here's a definition of a super generic function that takes a functor of string and maps it to a functor of int. public static FB ParseInts<Functor, FA, FB>(FA input) where Functor : struct, Functor<FA, FB, string, int> => default(Functor).Map(input, Int32.Parse); The secret to it working is the constraint that constrains Functor generic argument to be a struct and a Functor<FA, FB, string, int>. The struct bit means I can call default(Functor) and get a valid reference back (because structs can't be null). I can then call it with a List: var list = List("100", "50", "25"); Lst<int> res1 = ParseInts<FLst<str
Read the rest
ing, int>, Lst<string>, Lst<int>>(list); Or an Option: Option<int> res2 = ParseInts<FOption<string, int>, Option<string>, Option<int>>(opt); And it will happily map the bound values. FLst and FOption are essentially the 'class instances'. Functor is the 'type class', it's just a C# interface [2]: public interface Functor<FA, FB, A, B> { FB Map(FA ma, Func<A, B> f); } The key thing is that 'this' won't be used, so the first argument is the value to be mapped. FLst looks like this [3]: public struct FLst<A, B> : Functor<Lst<A>, Lst<B>, A, B> { public Lst<B> Map(Lst<A> ma, Func<A, B> f) => ma.Map(f); } And FOption like so [4]: public struct FOption<A, B> : Functor<Option<A>, Option<B>, A, B>, BiFunctor<Option<A>, Option<B>, Unit, A, B> { public Option<B> BiMap(Option<A> ma, Func<Unit, B> fa, Func<A, B> fb) => ma.IsNone ? fa == null ? Option<B>.None : fa(unit) : fb == null ? Option<B>.None : fb(ma.Value); public Option<B> Map(Option<A> ma, Func<A, B> f) => ma.IsSome && f != null ? Optional(f(ma.Value)) : None; } As you can probably tell, the amount of clutter from specifying generic type-parameters that the compiler could (relatively) easily work out on its own, is pretty annoying. Which limits it's usefulness somewhat. But if you want to write truly generic code, it's doable (with some caveats of course. you'll notice that the Functor type isn't quite as strict say the definition in Haskell). I'm currently updating my language-ext project to add type-classes [5] and class-instances [6], in the hope that the C# team will take pity on me and make this technique a language feature (it's been seriously turning my head inside out trying to make it work with higher-order types like monads). This is already being investigated by some Roslyn team members [7]. I figured this feature was unlikely to move seriously in the near term without some indication of real world need. [1] https://github.com/louthy/language-ext/blob/type-classes/Lan... [2] https://github.com/louthy/language-ext/blob/type-classes/Lan... [3] https://github.com/louthy/language-ext/blob/type-classes/Lan... [4] https://github.com/louthy/language-ext/blob/type-classes/Lan... [5] https://github.com/louthy/language-ext/tree/type-classes/Lan... [6] https://github.com/louthy/language-ext/tree/type-classes/Lan... [7] https://github.com/MattWindsor91/roslyn/blob/master/concepts...
In The .NET Language Strategy

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.