News for hackers. Stuff that matters.
Re:Coconut: Pythonic functional programming by weberc2 on Thursday January 03, 2019 @10:28AM (#18815765)
Haskell is functionally pure with a syntax that I just can't bring myself to call readable. It's also very complex--which string type do I use? Which prelude? Which compiler extensions? Which build tools? Which testing library? I think if someone went and made a Haskell-lite and really focused on polishing the experience (including a familiar syntax, simple/straightforward tooling, relaxing the functional purity requirement, etc) it would be a great advancement.
Re:Coconut: Pythonic functional programming by dpratt71 on Thursday January 03, 2019 @02:32PM (#18818392)
> which string type do I use?

I think this issue is way overblown. The reasons for choosing a particular string representation in Haskell are analogous to the reasons to choose among e.g. byte arrays, streams, string builders, etc. in mainstream programming languages.

> Which prelude?

There is a standard prelude. Unless you actively choose another one, that's the one you'll get.

> Which compiler extensions?

If you want to use certain advanced language features, enable the appropriate extensions.

> Which testing library?

Many mainstream programming platforms (e.g. .NET) have multiple popular testing libraries to choose from. Is this a bad thing?

Re:Coconut: Pythonic functional programming by ggm on Thursday January 03, 2019 @11:15PM (#18821920)
> Which compiler extensions?

If you want to use certain advanced language features, enable the appropriate extensions.

Your answers typify a level of comprehension of Haskell which appears to occupy the same brain space empathy would do. The whole POINT is that there are complex language features which have to be enabled if you want them: how does anyone know a priori in a new situation what to enable and what to disable? What side effects? What consequences?

I loved learning Haskell but to pretend it's syntactic simplicity translates to simple in all things is to misunderstand.

Gcc has a million compiler -W options do you think every C programmer knows them all? Do you think that every cat user knows why we joke about cat -v?

You have mastered Haskell and forgotten what lack of complete understanding means to anyone else. Mastering FORTRAN or pascal or lisp was trivial by comparison.

Mastering the underlying concepts of recursion, and tail recursion, and typing systems, and then integrating optional language features is not trivial.

Re:Coconut: Pythonic functional programming by dpratt71 on Friday January 04, 2019 @08:40AM (#18823915)
There's a lot here I would like to respond to, but I'll limit myself to a couple points:

> The whole POINT is that there are complex language features which have to be enabled if you want them

Yes, "if you want them". If you value having a simpler language, don't use them. And Haskell is hardly unique in this regard. You've mentioned GCC, but I think the Babel transpiler is another good example.

> You have mastered Haskell and forgotten what lack of complete understanding means to anyone else.

I've managed to teach my daughter some Haskell, who had no prior exposure to programming languages whatsoever, so I doubt your assertion is entirely true.

The hardest programming language I ever learned was the first one. Each one after that was easier than the one before...until I got to Haskell. It was so different that I was forced to go back to a more fundamental understanding of the nature of code and computation and start from there. It felt pretty challenging, especially at first, but I think that had more to do with my perspective and experience coming into it than the language itself (and the fact that I had a family and career at that point didn't help).

Re:Coconut: Pythonic functional programming by weberc2 on Thursday January 03, 2019 @07:15PM (#18820758)
These were examples of the choices one has to make when using Haskell; it is far from exhaustive. The point is that IMO Haskell undervalues consistency and standardization.
Re:Coconut: Pythonic functional programming by dpratt71 on Thursday January 03, 2019 @08:24PM (#18821184)
I can only directly address the examples you've given. If you disagree with how I've characterized those examples, I'd be interested to know why. If you have other examples, I'd be interested to hear them.

Haskell has its weaknesses, e.g. the lack of quality tooling available as compared to mainstream programming languages.

But I disagree that Haskell is complex, at least as a criticism. When expressing concepts of a similar complexity, I find Haskell to be particularly concise and expressive as compared to most other programming languages I am familiar with.

And if Haskell undervalues consistency and standardization, I would like to know as compared to what? The only programming languages that I know of where there are not many reasonable choices for e.g. a testing framework are those that either (a) haven't been around that long, or (b) haven't seen wide adoption.

Re:Coconut: Pythonic functional programming by capitalsigma on Thursday January 03, 2019 @10:13PM (#18821679)
I have never seen non-trivial Haskell that didn't enable at least 1 compiler extension. Laziness is difficult to reason about. Purity makes easy things hard in exchange for making hard things easy. You can't even make it through the standard library documentation without bumping into category theory.

Haskell is many things. Simple is not one of them.

Re:Coconut: Pythonic functional programming by johnday on Friday January 04, 2019 @12:39PM (#18825913)
> I have never seen non-trivial Haskell that didn't enable at least 1 compiler extension.

Language extensions are idiomatic Haskell. There is only one mainstream compiler used everywhere. Widely used extensions are a natural result when the compiler, as a testbed, can outpace the language standard.

Enabling extensions is as trivial as including a standard library package. (In fact, the extensions are often better documented than the standard library, as you hint to.)

Re:Coconut: Pythonic functional programming by weberc2 on Thursday January 03, 2019 @11:35PM (#18821988)
Honestly, I’m content to agree to disagree. I’ve had this conversation too often to repeat it here. The criticisms aren’t novel; I’m sure they’re easily found elsewhere on the Internet.
Re:Coconut: Pythonic functional programming by elviejo on Thursday January 03, 2019 @11:23AM (#18816254)
I agree and the closest thing I've found to a Haskell lite is F#.
Re:Coconut: Pythonic functional programming by debatem1 on Thursday January 03, 2019 @11:49AM (#18816525)
Ocaml is, imo, a pretty and not utterly impractical language as well.
Re:Coconut: Pythonic functional programming by TylerE on Thursday January 03, 2019 @11:59AM (#18816641)
Does it still do the thing where it doesn't have operator overloading?

Made math code oh so ugly.

Re:Coconut: Pythonic functional programming by lenticular on Thursday January 03, 2019 @12:30PM (#18816973)
Ocaml has no ability to do ad-hoc polymorphism at all (but it does have parametric polymorphism), which affects more things than operators, so that's why not only have the weird math operators, but things like string_of_int.

This will change at some point though. Modular implicits are coming to Ocaml. These are similar but much simpler than Scala's implicits, and allow the same kinds of patterns. If Ocaml gets that and eventually gains a bigger community with better library coverage, it's something I would consider using heavily.

Re:Coconut: Pythonic functional programming by TylerE on Thursday January 03, 2019 @02:28PM (#18818344)
That would indeed be good yeah - it sounds like a small thing but it really would help code readability quite a bit, especially when dealing with stuff like bignums.
Re:Coconut: Pythonic functional programming by weberc2 on Thursday January 03, 2019 @11:54AM (#18816585)
I knew the thread would head in this direction. :) Unfortunately, those languages' syntaxes are only marginally better and they have more complexity than I care for (especially objects and inheritance).
Re:Coconut: Pythonic functional programming by gmfawcett on Thursday January 03, 2019 @12:34PM (#18817022)
Given your "especially" comment -- you might be mis-remembering something about OCaml? It's true that it has these features, but in practice they are almost never used. The object system is useful if your program's design really needs open recursion / inheritance. But it's far more common to build an OCaml program using other constructs (modules and simple data types).

That's not to say that there isn't any complexity in OCaml. The type system and module/functor system have a daunting number of features. But most applications stick to a much simpler subset of the language, which is quite straightforward and easy to reason about.

Re:Coconut: Pythonic functional programming by weberc2 on Thursday January 03, 2019 @12:54PM (#18817236)
Granted objects are rare and this isn't one of the things I consider to be significant grievance about OCaml. :)
Re:Coconut: Pythonic functional programming by gmfawcett on Thursday January 03, 2019 @02:58PM (#18818653)
Fair enough. :)
Re:Coconut: Pythonic functional programming by ummonk on Thursday January 03, 2019 @10:02PM (#18821634)
Also has a syntax reskin in the form of ReasonML
Re:Coconut: Pythonic functional programming by eli_gottlieb on Thursday January 03, 2019 @11:57AM (#18816628)
Please don't relax the functional purity requirement. Instead, just use an algebraic effects library in place of monads as the "sin bin", guaranteeing that anything fitting the requirements to be an effect commutes with other effects, but still requiring them to be marked in the type.
Re:Coconut: Pythonic functional programming by weberc2 on Thursday January 03, 2019 @12:26PM (#18816945)
That's not meaningful to me (I'm a Haskell novice), but the thing I care about is that the compiler doesn't reject correct code (and no, "correctness" is not defined by the compiler, it's defined by the desired behavior). Whether that property comes from relaxing functional purity or some library, I don't much care.
Re:Coconut: Pythonic functional programming by eli_gottlieb on Thursday January 03, 2019 @12:47PM (#18817151)
There's a language community investigating those ideas here: https://www.eff-lang.org/ . As they brag:

>Effects are thus first-class citizens of Eff and can be seamlessly combined. There is no need for the do notation, no need for monad transformers, and no need to reshuffle your whole program just to read a global flag.

Re:Coconut: Pythonic functional programming by johnwyles on Thursday January 03, 2019 @12:35PM (#18817031)
On that topic Haskell is soooooooooo much more readable than clojure to me
Re:Coconut: Pythonic functional programming by StreamBright on Thursday January 03, 2019 @04:00PM (#18819222)
I guess it is just a matter of taste. Clojure is the reason I have been writing software and it helped me to achieve things that would be very difficult without. It just has the right set of tools for a guy like me with systems engineering background. I find it much more understandable to use map + reduce than for loops, async instead of fork + threading code. The out of the box performance of JVM is also one reason I keep using Clojure.
Re:Coconut: Pythonic functional programming by mclehman on Thursday January 03, 2019 @01:57PM (#18818009)
Could you elaborate on this? Personally, I like the idea of Haskell about as much as I like the idea of Clojure, but Haskell has never quite clicked for me.

I don't think it's necessarily readability holding me back from Haskell, but I do find Clojure to be highly readable which really helped me get up to speed with it quickly. I'm curious what you find more readable about Haskell.

Re:Coconut: Pythonic functional programming by nightski on Thursday January 03, 2019 @03:26PM (#18818964)
Haskell has a higher learning curve. It takes effort to pick it up. There is no learn Haskell in 5 minutes. But it's syntax is incredibly consistent and beautiful once learned.

Clojure has an incredibly simple syntax, but that isn't so much because it removed the complexity but rather that it just moved it away from the syntax imho.

Re:Coconut: Pythonic functional programming by johnday on Friday January 04, 2019 @12:41PM (#18825936)
> There is no learn Haskell in 5 minutes.

True, but there is a learn Haskell in 10 minutes...

https://wiki.haskell.org/Learn_Haskell_in_10_minutes

Re:Coconut: Pythonic functional programming by lenticular on Thursday January 03, 2019 @03:52PM (#18819167)
If you spend enough time in Clojure, it becomes quite readable. With threading macros and the like, there's no real reason you need many more parens that a language like Python.
Re:Coconut: Pythonic functional programming by StreamBright on Thursday January 03, 2019 @04:00PM (#18819232)
It is kind of funny when I make my programmer friends count parenthesis in their code vs my Clojure.
Re:Coconut: Pythonic functional programming by tigershark on Thursday January 03, 2019 @11:29PM (#18821966)
I guess no one of your friends uses F#
Re:Coconut: Pythonic functional programming by StreamBright on Friday January 04, 2019 @03:48PM (#18827453)
Not really, but I like OcaML.
Re:Coconut: Pythonic functional programming by jhuni on Thursday January 03, 2019 @08:28PM (#18821208)
I can confirm, I have been writing Clojure for seven years. Its pretty nice to look at now.