4 ms·
Your last complaint is not fundamental to the language: it's just a matter of library design. I guess Haskellers don't like state very much in any guise, so hav
by tikhonj 14y ago
Your last complaint is not fundamental to the language: it's just a matter of library design. I guess Haskellers don't like state very much in any guise, so having awkward syntax for it is only natural. Both programs are fundamentally ugly, so having it be superficially ugly as well is no big loss.
However, if you really wanted to, you could have almost C-like syntax[1]. The demo in that particular blog post has its own issues, but there is no fundamental reason why you couldn't apply some of those ideas to the normal ST API. I suspect that people simply don't care enough.
[1]: http://augustss.blogspot.co.il/2007/08/programming-in-c-ummm-haskell-heres.html http://augustss.blogspot.co.il/2007/08/programming-in-c-ummm...
- Chris_Newton 14y agoBoth programs are fundamentally ugly, so having it be superficially ugly as well is no big loss. Perhaps we’ll just have to amicably disagree on that point. I think making code superficially ugly is a huge barrier to adoption that has held back otherwise good ideas throughout the history of programming. Many an innovative programming style or technique has languished in obscurity until some new language came along and made the idea special and provided dedicated tools to support it. Then it becomes accessible enough for new programmers to experiment with the idea, and the code becomes readable enough to use the idea in production, and over time it starts to change how we think about programming. We push the envelope, probably developing some ingenious and useful but horrible abuses of the idea along the way, until we figure out how to make those new ideas available in a cleaner and more widely accessible way and the cycle begins again. I suspect that people simply don't care enough. Most people are programming in languages that don’t have the problem in the first place, so they don’t need to care.
- flyinRyan 14y ago> I think making code superficially ugly is a huge barrier to adoption that has held back otherwise good ideas throughout the history of programming. Haskell tries to make elegant code look nice and inelegant code look ugly. When you see something ugly like the example above this is a sign that there would be some more elegant way of writing it. That certainly holds in this case as you don't need an mutation to do the fib sequence.