Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Yes, already having gotten "over the hump" on Haskell, the issue I have with Clojure is that I dig into it (finding it a truly appealing language, and wanting to achieve that sweet spot), but usually walk away thinking it really isn't giving me anything Haskell isn't, and is lacking many of the niceties I've come to rely on. I just have this feeling I would love it if I didn't already know my way around Haskell, but the "benefit-venn-diagram" feels like concentric circles.

If there are some people out there who are well versed in both Haskell + Clojure, I'd love to hear some insight into where Clojure shines, and where you find yourself saying "Clojure is better at this!" in some distinct and meaningful way.



Well, the Clojure repl is way better. Not being pervasively lazy makes it easier to reason about many things. Not strictly boxing IO in the IO monad makes it easier to debug (debug by println is still useful!). Macros are much easier to understand than Template Haskell, and since you don't have real typing you can have heterogeneous collections, or values where the type of one part depends on the value of another part, easily.

Also I think it really is easier to get started with Clojure than with Haskell, even for the (very well thought out!) concurrency primitives, though obviously that doesn't matter if you're already up and running with Haskell.

I use Clojure exclusively at my job, but for some things I really miss something like Haskell's type system, even though I freely admit I don't really understand the type system at its higher levels (specifically related to GADTs, existential types, type familes, etc.). Applicative functors would make some things so much nicer.

and you don't have to understand dependent typing to do it, either. I know there are heterogeneous list implementations for Haskell, but I can never understand how they work.


>since you don't have real typing you can have heterogeneous collections

You can have heterogeneous collections in Haskell, you just have to mean to. :) Check out the the "Obj" example here [1]

[1] http://www.haskell.org/haskellwiki/Existential_types


"I know there are heterogeneous list implementations for Haskell, but I can never understand how they work."


No, there are no heterogeneous list "implementations". There are ways to get the type system to basically use the type-class as the "type" instead of the concrete type (this is how you get heterogeneous lists in languages like C#/Java as well btw). That means the same normal list can hold this heterogeneous data, as could maps, sets, Maybe, anything.


http://hackage.haskell.org/package/HList-0.2.3 sure seems like an "implementation" of heterogeneous lists.


That looks like some kind of research thing, not something anyone is using. And as I say, there is no need to since you can use Existential types or GADTs to type the list on interface instead of representation. And that will give you heterogeneous containers of any kind where as this package you showed would only work for this one kind of package.


Thanks for the answer, exactly what I was looking for.

A few comments:

> Well, the Clojure repl is way better.

I've messed around with it, not enough to know, but wouldn't shock me. `ghci` is pretty decent, but it's not really world-class at anything. iPython is probably the best repl I've ever used for any language.

> Not being pervasively lazy makes it easier to reason about many things.

Agree. This is, indeed, problematic at times.

> Not strictly boxing IO in the IO monad makes it easier to debug (debug by println is still useful!).

Well, Debug.Trace gets you most of what you want there (using unsafePerformIO under the covers), so there is an "escape hatch" for doing printf-style debugging. But it's not quite as smooth as printf in languages that don't sandbox purity so much. On balance, I'd still take the purity (because I do a lot less debugging!), but point granted.

> Macros are much easier to understand than Template Haskell

No experience with macros, but since lisp-like things are so big into macros, sounds plausible.

> and since you don't have real typing you can have heterogeneous collections, or values where the type of one part depends on the value of another part, easily.

I'm not sure I view this as a /virtue/, to be honest. I'd rather have the type checking, and use typeclasses or ADTs to put mixed types into a sequence.

> Also I think it really is easier to get started with Clojure than with Haskell,

Yeah, I think this is undoubtedly true. Haskell veterans often say "whats' the big deal?", but the deal is big. And it's not so much because of "math", in the classical sense, as much as it's about very high, very new, abstractions. Many of them without analogies to things you've done before or things in the "real world". I did ocaml for awhile before I did Haskell, and Haskell was still a pretty big leap.

Anyway, thanks again for the constructive feedback.


As someone who is trying to learn Haskell, my best guess would be: Clojure's "hump" is like 1/1000000 the size of Haskell's "hump".


Not well versed in both, but I think desktop apps are an area where Clojure shines. Let's say I want to write a cross platform desktop GUI app in Haskell. What do I use? wxHaskell seems to be actively maintained, but a lot of the projects listed on http://www.haskell.org/haskellwiki/Applications_and_librarie... appear to be inactive or dead.

With Clojure I have access to Swing (yeah I know...Swing isn't everyone's favorite) without installing any additional libraries. Then there is seesaw which is a very nice layer on top of Swing. To install seesaw I simply edit a text file in my Clojure project and the project management/automation system installs it for me. Very nice.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: