Live data from Hacker News

Becoming Productive in Haskell

mechanical-elephant.com

141–150 of 213 posts

Re: Becoming Productive in Haskell

#141

The author's comments on noise chime true with me: every time I give Haskell a try I end up struggling with frustrating and opaque vocabulary, sometimes completely at odds with the way other languages use them: e.g. C++ also has functors, and they're completely unrelated to Haskell functors. I really like the author's suggestion of mentally translating Functor to Mappable. Are there any other synonyms for other Haske…

actually, Scala is in some ways similar in that it has higher kinded types allowing you to abstract over functors/monads/traversables

for expressions in scala are monadic comprehension and implicit parameters are analogous to typeclass constraints.

Re: Becoming Productive in Haskell

#142

Scripting languages try to seduce you to just fiddle around until the output looks like something you want. While that quickly gives you some results, I think it's a huge roadblock in the mid- to longterm. Especially when programmers are only familiar with "easy" scripting languages, there are rarely insights about the general approach to the problem until the project already grew to become an abomination. While fidd…

>While fiddling around is still somewhat possible in Haskell, the language itself makes it quite difficult. Haskell kind of forces you right at the beginning to pause and think "Well, what is it that I'm actually trying to do here?"... Wouldn't Scripting languages allows one to gradually build that understanding. Suppose you end up with a lot of complex code? Ditch it and build it from scratch. Usually takes around 1…

The nice thing about Haskell is that the type system lets you work at a higher level of abstraction. One of the problems with dynamically typed languages is that even though they let you create abstractions they are bad at error detection. For example, if you have a function that expects non-null inputs and you pass null to it the error is only going to be caught when you try to call a method on the null. On the other hand, in a statically typed language you get an error message poining directly to the real source of the issue.

Another othing Haskell gets right is the support for parametric polymorphism (generics). You are forbidden from manipulating generic parameters other than passing them around so there is less room for error. This "theorems for free" is what makes things like monads "tick".

That said, one thing that is in vogue right now is adding optional type systems and runtime contracts to scripting languages. Its still a bit of a research area but I think it has a very promising future.

Re: Becoming Productive in Haskell

#143
post #139

Could you guys explain to me what Haskell would be mostly useful for. For instance, can it be used to make a web app backend or a GUI app? Or is it mostly for mathematical calculations and such. I tried to pick up Haskell once, but I guess I just couldn't get it. I mean, I got the core concepts, wrote a bunch of starter code, like prime checker and the like. But after going through several tutorial chapters, I still…

> Could you guys explain to me what Haskell would be mostly useful for. For instance, can it be used to make a web app backend or a GUI app?

Yes, and yes.

> Also, can you recommend a good book or resource that uses real world examples to teach Haskell?

The obvious thing to recommend here is Real World Haskell [0], which directly addresses some of the areas you raise.

Also, Write Yourself a Scheme in 48 Hours [1] is more in-depth and real-world than most tutorials (writing a Scheme interpreter isn't exactly a common real-world application, but its more real-world scale than most tutorials address, and it uses a lot of things that are of concern in many real-world apps.)

[0] http://book.realworldhaskell.org/read/

[1] http://en.wikibooks.org/wiki/Write_Yourself_a_Scheme_in_48_H...

Re: Becoming Productive in Haskell

#144
post #118

Earlier quoted context omitted.

Absolutely, Haskell has a richness of concepts to it that's entirely in a class of its own... but that being said, Haskell is to programming what sex is to life (for a woman... because men's natural enjoyment of sex throws off my following analogy). Granted there is richness and joy in finally discovering it, one needs to realize it's important that one isn't forced into it too early. Haskell demands a lot of thinkin…

> (for a woman... because men's natural enjoyment of sex throws off my following analogy) Pro tip: If your analogy needs a disclaimer that perpetuates gender stereotypes for it to work, then its probably sexist.

The parenthetical statement by ffn, although a bit tongue-in-cheek, is largely "men want sex more than women." Which, judging by the statistical consumption of porn across the world, is resoundingly true. I get your point about not perpetuating gender stereotypes, but the whole spirit of that movement (feminism, equality, what have you) is to not perpetuate gender stereotype types where they are irrelevant - as in when sex is not directly involved (e.g. leading a corporation, programming a computer, playing with children, etc.)... But you will literally not find a field where sex is more directly involved than sex itself. Granted there are always exceptions, but the statement that "man want sex more than woman" is sexist the same way "man is physically larger than woman" or "woman have higher % body fat than man" is sexist.

In other words, it's sexist in the sense that we recognize there is a biological difference between the sexes - we're not applying it to infer men are automatically rapists, or women are automatically unable to make executive decision. So maybe instead of playing around with labeling terms that carry a lot of negative connotations, you can actually consider the circumstance and context of what is being said before you label.

Re: Becoming Productive in Haskell

#145
post #139

Could you guys explain to me what Haskell would be mostly useful for. For instance, can it be used to make a web app backend or a GUI app? Or is it mostly for mathematical calculations and such. I tried to pick up Haskell once, but I guess I just couldn't get it. I mean, I got the core concepts, wrote a bunch of starter code, like prime checker and the like. But after going through several tutorial chapters, I still…

Haskell is a bit weird in that there are no niches where its a total killer-app and has the best libraries for everything. What its really good at is that it has a very solid type system and the core language is very clean, which encourages the use of powerful abstractions (for example: coroutine libraries for async IO, parser combinators, etc).

Out of the things you mentioned, server-side programming is the one where Haskell fits best. Server-side programming is more amenable to unusual languages because you get to choose your own platform and there are plenty of mature web frameworks you can use (too many of them, I might say). It might be worth a try to experiment writing code in a more type-safe language. Even the simple things like algebraic-data-types are things I miss a lot when working on other languages.

Re: Becoming Productive in Haskell

#146

Earlier quoted context omitted.

Functors and monads are somewhat not going to change their names, partly because Haskell derives from math and those are what they're called over there. But foldl' is horrible, I agree.

foldl' is a consistent and meaningful name. fold performs a fold without specifying an order[1], foldl folds from the left, and foldl' is a non-lazy version of of foldl . 1: fold :: (Foldable t,Monoid m) => t m -> m

Is there a spec that leaves the order unspecified? Having it not be a right fold would be quite nutty. It is a right fold in implementation.

Re: Becoming Productive in Haskell

#147
post #139

Could you guys explain to me what Haskell would be mostly useful for. For instance, can it be used to make a web app backend or a GUI app? Or is it mostly for mathematical calculations and such. I tried to pick up Haskell once, but I guess I just couldn't get it. I mean, I got the core concepts, wrote a bunch of starter code, like prime checker and the like. But after going through several tutorial chapters, I still…

> Could you guys explain to me what Haskell would be mostly useful for. For instance, can it be used to make a web app backend or a GUI app? Yes, and yes. > Also, can you recommend a good book or resource that uses real world examples to teach Haskell? The obvious thing to recommend here is Real World Haskell [0], which directly addresses some of the areas you raise. Also, Write Yourself a Scheme in 48 Hours [1] is m…

Thanks, I think Real World Haskell was the resource I was looking for. I'll try to get through it in the next month and see how it goes.

Re: Becoming Productive in Haskell

#148

Earlier quoted context omitted.

> (for a woman... because men's natural enjoyment of sex throws off my following analogy) Pro tip: If your analogy needs a disclaimer that perpetuates gender stereotypes for it to work, then its probably sexist.

The parenthetical statement by ffn, although a bit tongue-in-cheek, is largely "men want sex more than women." Which, judging by the statistical consumption of porn across the world, is resoundingly true. I get your point about not perpetuating gender stereotypes, but the whole spirit of that movement (feminism, equality, what have you) is to not perpetuate gender stereotype types where they are irrelevant - as in wh…

so men want sex more than women because of some statistic that you didn't even bother to fully pull out of your ass? nice

Re: Becoming Productive in Haskell

#149
post #43

The author's comments on noise chime true with me: every time I give Haskell a try I end up struggling with frustrating and opaque vocabulary, sometimes completely at odds with the way other languages use them: e.g. C++ also has functors, and they're completely unrelated to Haskell functors. I really like the author's suggestion of mentally translating Functor to Mappable. Are there any other synonyms for other Haske…

> sometimes completely at odds with the way other languages use them: e.g. C++ also has functors, and they're completely unrelated to Haskell functors. Really, this should be considered as C++ perverting the existing terminology from category-theory for Functors. > I really like the author's suggestion of mentally translating Functor to Mappable. Are there any other synonyms for other Haskell terms of art? I think th…

> > sometimes completely at odds with the way other languages use them: e.g. C++ also has functors, and they're completely unrelated to Haskell functors.

> Really, this should be considered as C++ perverting the existing terminology from category-theory for Functors.

Only if you assume that category theory is the correct source of meaning of such terminology. But Wikipedia, for example, lists functor as being ambiguous - there's the category theory version, and there's the programming version, which is a function object. It lists a bunch of languages (C++, C#, D, Eiffel, Java, JavaScript, Scheme, Lisp, ObjectiveC, Perl, PHP, PowerShell, Python, and Ruby) that support some variant on this theme. It seems rather arrogant to say that the category theory definition is the one that should be the one we mean when discussing a programming language, rather than the one used by a large number of programming languages.

Re: Becoming Productive in Haskell

#150
post #8

Great article. I do think a better "Getting started with Haskell" guide is Chris Allen's: https://github.com/bitemyapp/learnhaskell OP's article is still a great way of wetting appetite, and sharing insights; but moving on from there is better facilitated by Chris Allen's recommendations. There is also the IDE issue; FPComplete has a web-based IDE that is good for beginners, and it is possible to setup Emacs to be a…

I think you meant "whetting". :)

I don't know about that. Haskell can be rather sink-or-swim...

;-)

Post reply on HN