Re:C# functional language extensions and Erlang-like concurr...
by louthy on Monday January 30, 2017 @05:53PM
(#13525863)
> So, unless you have user-definable monads, where is the improvement?
C# does have user-definable monads. There are many in this project (Option, Either, Try, TryOption, Task, Reader, Writer, State, Parser, ...)
Re:C# functional language extensions and Erlang-like concurr...
by catnaroek on Monday January 30, 2017 @06:50PM
(#13526158)
No, you only have user-definable type constructors that happen to be monads if you jump to a metalanguage. (Whatever formal or informal system you use to reason about C# code.) Inside C#, you don't even have the means to assert that they are monads, let alone take advantage of the fact that they are monads.
Re:C# functional language extensions and Erlang-like concurr...
by louthy on Monday January 30, 2017 @06:58PM
(#13526194)
> you don't even have the means to assert that they are monads, let alone take advantage of the fact that they are monads.
Yes, you can.
Here's an example from version 2.0 of lang-ext (which is WIP and will be released soon) [1]:
[1] https://github.com/louthy/language-ext/blob/type-classes/Lan...
Re:C# functional language extensions and Erlang-like concurr...
by catnaroek on Monday January 30, 2017 @07:00PM
(#13526213)
That just shows that the result of specializing the monad laws to one specific type constructor, holds. But the monad laws themselves are inexpressible in a general form.
If you can't even postulate a theory (the monad signature and its equational laws), it doesn't make sense to talk about what models of the theory exist (concrete instances).
This has absolutely nothing to do with functional programming.
> delegates, lambdas, list comprehensions, anonymous types
Syntactic sugar.
> higher-order functions, true closures
Java has them too. They're called “objects”.
> a sprinkle of monads
Every higher-order language with strict evaluation (which includes every object-oriented language) already has at least one monad, whose use is pervasive and inescapable.
So, unless you have user-definable monads, where is the improvement?