News for hackers. Stuff that matters.
Re:Why I never finish my Haskell programs by pash on Monday September 03, 2018 @06:49PM (#17905375)
I think many beginning Haskellers have this problem. To overcome it, my advice is to write Haskell code with the knowledge that you can re-write it more readily than you can re-write code in many other languages. Write the code that fits the immediate application, and rely on the type-checker to make it straightforward to refactor when the need arises.

I think that’s what many experienced Haskellers would say is the language’s best attribute for getting things done, that the type system makes it possible to refactor even a large program with the confidence that all the parts you replace will slot perfectly back into the original structure. Or that changing the core structure itself will result in a new structure that has all the right slots for all the various bits and pieces that need to slot into it. Having the confidence that you will be able to refactor painlessly, you should be less concerned with finding the perfect abstraction up front. Write code, make it work, then make it better.

And as others have mentioned, yes, the right abstraction and appropriate level of generality will become easier to recognize as you write more Haskell. Go with the first decent implementation you can come up with, and as you gain experience that first implementation will more and more often turn out to be a good one. In the meantime, run HLint and read more Haskell code, and you’ll quickly pick up most of the generalizations that really make sense to use in typical applications. The more experienced you get, the more confident you should become that significant time spent generalizing code to no real purpose is pointless and tends to result in code that both reads worse and runs worse than what you started with.

Re:Why I never finish my Haskell programs by nextos on Monday September 03, 2018 @10:03PM (#17906109)
In my case, I think it's because large programs always end up containing subproblems that can be better expressed in other paradigms than functional. And it becomes frustrating when I can't shoehorn them to the Haskell way of doing things.

My favorite languages are, for this reason, multi-paradigm: Common Lisp, Mozart/Oz, Scala and C++. It's a bit like building La Sagrada Familia (and that's why it's depicted in the cover of CTM). If you want a superb solution, you end up using many styles like Gaudí did.

But I reckon the future will move towards more provably correct solutions, and we will be using things closer to e.g. Idris. Hopefully that's orthogonal with homoiconicity.

Re:Why I never finish my Haskell programs by tincholio on Tuesday September 04, 2018 @01:31AM (#17906852)
I agree with your sentiment, but I find the analogy to La Sagrada Familia funny, in that is has still not been finished, it's a black hole for money, and you can see, clearly, it's a hodge-podge of styles... All characteristics that might not be good for your software project.
Re:Why I never finish my Haskell programs by nextos on Tuesday September 04, 2018 @10:05AM (#17909104)
It's not my analogy, it's CTM's [1]. A book that has cult status in some CS circles.

[1] https://www.info.ucl.ac.be/~pvr/book.html

Re:Why I never finish my Haskell programs by m_mueller on Tuesday September 04, 2018 @02:58AM (#17907138)
which large software project has ever been ‚completed‘?
Re:Why I never finish my Haskell programs by lasagnaphil on Tuesday September 04, 2018 @03:26AM (#17907230)
A lot of single-player (not online serviced) computer games could be regarded as ‘completed’: once they’re out on the store shelves, it’s pretty much done (although with the rise of Steam and continuous updates this is less of a case)

That’s probably why many game programmers are more pragmatic in their programming practices: they have a concrete deadline to pursue, with a predictable subset of hardware for their program to run...

Re:Why I never finish my Haskell programs by m_mueller on Tuesday September 04, 2018 @05:00AM (#17907621)
point taken, a lot of software in the pre internet era could be considered completed - on the other hand there's always still going to be issues, so you could also claim that these projects are just abandoned.

In general I think software is more like a house than an art piece - it keeps adapting as long as people use it.

Re:Why I never finish my Haskell programs by _0ffh on Tuesday September 04, 2018 @03:52AM (#17907344)
Strike the "large" in that sentence. I somewhat think that writing software is like painting. At some point you decide to stop, but you're never truly done. Also cf. Leonardo da Vinci: "Art is never finished, only abandoned."
Re:Why I never finish my Haskell programs by m_mueller on Tuesday September 04, 2018 @05:02AM (#17907635)
interesting, I didn't even read your comment before writing my last reply, which says very much the same, just with less da Vinci in it ;)
Re:Why I never finish my Haskell programs by vfclists on Tuesday September 04, 2018 @04:27AM (#17907494)
Mozart/Oz??? I never heard of it. Now there is another rabbit cave to spelunk in my search for the perfect programming language.
Re:Why I never finish my Haskell programs by Fiahil on Tuesday September 04, 2018 @05:30AM (#17907740)
It's an academic-only language, mostly used for teaching students about programming. Anyone sane would not use it in production, as the output would likely be "ill-typed".
Re:Why I never finish my Haskell programs by nextos on Tuesday September 04, 2018 @10:08AM (#17909127)
There's also AliceML, an evolution of SML with Oz-like semantics. Sadly not in very active development.
Re:Why I never finish my Haskell programs by mikhailfranco on Tuesday September 04, 2018 @02:42PM (#17911662)
So you're saying: don't use an unfinished programming language to write unfinished programs ;)
Re:Why I never finish my Haskell programs by hohenheim on Tuesday September 04, 2018 @02:29AM (#17907024)
Completely agree with you, and I like to add that this is true for any programming language really. Often I find people, specially juniors, obsessed with how they solve a problem and design patterns used than actually solving a problem. To be honest I was once such a person.

The best advice, as you stated it, is to go with the first instinct, and then refine it, IF needed. It might turn out that the code you wrote was redundant anyway.

Re:Why I never finish my Haskell programs by KurtMueller on Monday September 03, 2018 @07:18PM (#17905490)
I know Elm isn't the same as Haskell, but these points are also used as a selling point for Elm. And more often than not, as with Haskell, the type system makes it possible to refactor a large program with the confidence that all the parts you replace will slot perfectly back into the original structure OR the compiler will yell at you until it does :).
Re:Why I never finish my Haskell programs by chongli on Monday September 03, 2018 @09:28PM (#17905985)
The drawback with Elm is that it has a trigger-happy BDFL who doesn't care about breaking everything all the time. Haskell has a long history and has broken very few things over the years (n+k patterns come to mind).
Re:Why I never finish my Haskell programs by girvo on Tuesday September 04, 2018 @03:57AM (#17907370)
It’s an unstable pre-1.0 language that hasn’t even finished its core API.
Re:Why I never finish my Haskell programs by SanFranManDan on Monday September 03, 2018 @10:36PM (#17906218)
Started looking at Elm this weekend as a possibility for it to compile into other languages (javascript/elixir). Its too bad every release requires most packages to be rewritten. The good news is that releases are getting slower and slower, so you might go a year without any releases (even minor version patches). I guess that counts as LTS.

Elm would be so awesome if they just forked it at 0.19 and said "no more breaking releases". But I doubt that will ever happen.

Re:Why I never finish my Haskell programs by always_good on Tuesday September 04, 2018 @03:16AM (#17907188)
Well, Elm is clearly still figuring out its core APIs. 0.19 refactored a lot of things into https://package.elm-lang.org/packages/elm/browser/1.0.0/, for example. And Elm's package.json equivalent was completely changed. And major questions like server-side rendering aren't even answered yet.

Seems like the opposite of a good time to release 1.0.

Of course, this means most people won't have an appetite for unstable Elm, but that's nothing new. Complaining that something is still 0.x unstable seems odd to me beyond the selfish "I wish I had it sooner."

A lot of HN's comments around Elm remind me of when I was a kid absolutely livid at Bungie for not releasing Halo 2 sooner. Doesn't Bungie know my summer just started? I don't want a fucking beta, Bungie! Me want game now! Bungie must be incompetent because everyone on my gaming forum wants it now as well!