Re:Why Are So Many Developers Hating on Object-Oriented Prog...
by ferzul on Friday August 23, 2019 @09:38PM
(#20784583)
module Main {
IO<Void> main() {
Integer n <- read$(getLine) // or: fmap(read)(getLine)
print(fib(n))
}
Integer fib(Integer n) {
Integer go(Integer !n, Integer !a, Integer !b) {
if (n==0) {
return 0
} else {
return go(n-1, b, a+b)
}
}
}
}
pros: it looks plausibly like Java.
cons: all the things that haskell syntax makes easy like partial application become obscure at best. omg, i'm dying in squiggly and round brackets, what is this, lisp? there's too much stuff that has to become ad hoc builtin syntax, like <$> becomes $(...). i don't know if you can program applicatively with this syntax, but i doubt you could have invented it.
Re:Why Are So Many Developers Hating on Object-Oriented Prog...
by Multicomp on Friday August 23, 2019 @10:08PM
(#20784735)
Based on your last paragraph, it sounds like you are describing F#.
F# is an immutable by default functional-first programming language in .net.
Re:Why Are So Many Developers Hating on Object-Oriented Prog...
by ferzul on Friday August 23, 2019 @09:44PM
(#20784612)
in retrospect, i wonder if you're proposing an alternative (lazy) language on the ghc runtime with the ghc calling convention, that can share types and code, so you effectively have a lazy java-like language with ghc interop?
Unrelated: Haskell needs a more approachable alternative syntax. People bash VB.NET - but it’s a great way to transition people from beginner and PHB-friendly languages (where people completely unfamiliar with a language can still generally understand what’s going on, like Fortran, COBOL, the BASIC family, etc) into an environment where the full .NET library is available before fully transitioning to the alien-seeming curly-braced C#.
...even as a C# programmer, I prefer writing functional-style code with immutable data. I’m not so far as to write the core of a program using Reactive Extensions - but things like Linq - for example.