News for hackers. Stuff that matters.
Re:Go and Assembly by Peaker on Thursday February 07, 2013 @10:25AM (#5182498)
Except for his bullet about compiler speed, which might be faster than GHC, all of his bullets apply to GHC Haskell too.
Re:Go and Assembly by jerf on Thursday February 07, 2013 @11:36AM (#5182996)
Having used both a bit (Haskell substantially, still fiddling with Go), there's no "might" about it. But then, "Go compiles quickly" was an explicit design goal from day one. "GHC compiles quickly" is certainly much further down on the list of GHC design goals.

Otherwise, Go & Haskell are very different languages. In the grand CLispScript landscape, Go is sort of close to Haskell because of the interface/typeclass similarity, but pushed apart by the fact that Go's strong type system has some serious weak points in it by Haskell standards, for instance, there's no equivalent to a TChan a -> TChan a function as there is no way to have a function that is ignorant of "a" but can pass it through as the same type. Go forces it to collapse to interface{}, which is roughly equivalent to Data.Dynamic in Haskell. (If you want to search for it, Go calls it's equivalent to Data.Dynamic.fromDyn a "type assertion". There's two ways to use it, one that is the rough equivalent of fromDyn in that it returns whether the conversion worked and maybe the converted value, and one mode in which it does the Data.Maybe.fromJust for you, complete with violent crashing behavior if you're wrong.)

Re:Go and Assembly by Tyr42 on Thursday February 07, 2013 @10:47AM (#5182696)
Wait, even "Go comes with a complete set of documentation available from the command line". I use hoogle from the command line, is there anything else for Haskell?
Re:Go and Assembly by Peaker on Thursday February 07, 2013 @11:11AM (#5182862)
Hoogle type search is great: Give a type, get back names implementing that type or a generalization of it.

There's the haddock auto-generated documentation from cabal (if you enable it). Not sure if that qualifies for "available from the command line".

Re:Go and Assembly by burntsushi on Thursday February 07, 2013 @08:05PM (#5185636)
> all of his bullets apply to GHC Haskell too

No chance. Using the `go` tool to install packages is at least an order of magnitude less annoying than using `cabal`.

Re:Go and Assembly by Peaker on Friday February 08, 2013 @04:33AM (#5187036)
When did you last use `cabal`?

Cabal works much better now, and most of the problems were due to over-conservative version ranges combined with an over-eager reinstallation policy that overwrote packages in a breaking way. That was fixed about 6 months ago, IIRC.

Re:Go and Assembly by burntsushi on Friday February 08, 2013 @06:34PM (#5190792)
A few weeks ago.

And I'm not really referring to its weird behavior. To use cabal, you have to write a cabal file to specify dependencies, build instructions, etc. With the `go` tool, no such meta data is required. Everything that is needed to build a package is inferred from the source by the `go` tool. This is what makes it less annoying than most other distribution tools.

Of course, most other distribution tools support a larger number of options, so perhaps its not a fair comparison. But that is irrelevant to typical workflow annoyances.

Re:Go and Assembly by Peaker on Saturday February 09, 2013 @05:40PM (#5194381)
Well, how can it infer the dependency on particular versions? Or on particular implementations of some interface you're using?
Re:Go and Assembly by burntsushi on Monday February 11, 2013 @04:32PM (#5203419)
It doesn't. Hence:

> Of course, most other distribution tools support a larger number of options, so perhaps its not a fair comparison. But that is irrelevant to typical workflow annoyances.

If you need to stick to a particular version of a software package, the common workflow involves using existing tools. (i.e., fork.)

Re:Go and Assembly by papsosouid on Thursday February 07, 2013 @12:26PM (#5183325)
I write haskell code all day. I spend my day writing it at work (with occasional HN breaks obviously) and then I go home and write personal projects in it. I advocate haskell on a semi-regular basis. I certainly fall on the pro-haskell side of things. But GHC absolutely does not meet all those bullet points.

Compiler speed is not some minor difference, it is absolutely massive. Build times of 30 seconds vs 2 seconds, and that is without counting the 10 seconds of cabal resolving dependencies.

>Go comes with a complete set of documentation available from the command line

GHC does not come with command line docs.

>All Go code is statically compiled so deployment is trivial

GHC links in C libs dynamically, and as far as I can figure there is no way to get static linking working, so I have to have all the same C libs installed on my production servers as my build server. With go you can just upload your binary to a bare bones server and it works.

>but it also has a tool to clean up code: gofmt

GHC has nothing like this.

>And there's also go fix which can automatically convert Go code designed for earlier versions to newer versions

Or this.

Haskell is a great language, but it does not match go's toolchain.

Re:Go and Assembly by Peaker on Thursday February 07, 2013 @04:02PM (#5184481)
> Compiler speed is not some minor difference, it is absolutely massive. Build times of 30 seconds vs 2 seconds, and that is without counting the 10 seconds of cabal resolving dependencies

I simply did not play with Go to know the compilation speeds. I believe you that it is a massive difference, and it is indeed a major Go advantage.

> GHC does not come with command line docs.

The haddocks are available from the command line. So I don't know what this means. Hoogle is available from the command line.

> GHC links in C libs dynamically

Ah, I see. Did you try -optl-static? I haven't, but it might work.

> GHC has nothing like this.

There are tools to format Haskell code by certain conventions on hackage.

Re:Go and Assembly by tikhonj on Thursday February 07, 2013 @05:39PM (#5184989)
This is a complete aside, but what are the good tools for formatting Haskell code? I've been using stylish-haskell, but it's somewhat limited and barfs on certain Unicode identifiers I like to use. (I should probably file a bug report for that...)
Re:Go and Assembly by Peaker on Friday February 08, 2013 @04:32AM (#5187034)
Don't know anything better than stylish-haskell, but AFAIK it fits the bullet point completely.
Re:Go and Assembly by papsosouid on Monday February 11, 2013 @10:30AM (#5201235)
>Hoogle is available from the command line.

Hoogle is roughly the equivalent. It doesn't come with ghc though, and the rather lengthy dependency list has caused problems getting it installed before. Is there a command line only version that doesn't need all the web stuff?

>Did you try -optl-static?

Yeah, no such luck. It turns out go can't do this either though, so that one shouldn't have been on the list in the first place.

>There are tools to format Haskell code by certain conventions on hackage.

The "being included with the compiler" aspect is pretty big here. People are much more likely to format their code if they already have the tool to do it. I'm not sure what you mean by tools available on hackage though. Stylish-haskell is about it, and all it does is align and sort imports/pragmas. Gofmt can basically rewrite go code however you want it to. Sort of like if hlint were built in to stylish haskell and did the replacements instead of suggesting them.

Re:Go and Assembly by car54whereareu on Thursday February 07, 2013 @12:54PM (#5183497)
Actually if you import "net" go links to libc.so and some others.
Re:Go and Assembly by stock_toaster on Thursday February 07, 2013 @01:09PM (#5183581)
I believe "net" does so for native dns lookups. You can disable that by building go with 'CGO_ENABLED=0', if desired.
Re:Go and Assembly by 4ad on Friday February 08, 2013 @06:31PM (#5190781)
That is correct. It uses libc for resolving names because systems might be configured to use NIS or LDAP before DNS. With cgo disabled it defaults to using its own DNS resolver and resolv.conf.
Re:Go and Assembly by papsosouid on Thursday February 07, 2013 @01:33PM (#5183707)
Ah, if the original bulletpoints for go are wrong then ghc may be more comparable than I figured. Can you statically link go binaries? As in, if I am using a go postgresql binding, can I build a binary with libpq (the postgresql C library) linked in statically, so it can be deployed on servers with no postgresql libraries installed?
Re:Go and Assembly by cdoxsey on Thursday February 07, 2013 @01:50PM (#5183819)
From what I understand cgo doesn't currently support static linking like this.