Live data from Hacker News

Rust as a gateway drug to Haskell

xion.io

41–50 of 218 posts

Re: Rust as a gateway drug to Haskell

#41
post #36
post #23

Earlier quoted context omitted.

Haskell definitely allows imperative programming, it's just not particularly good at it.

What is it lacking for imperative programming? I find it to be immensely good at it!

Don't know... mutable collections? A way to make sure things are evaluated without writing seq every other line?

Re: Rust as a gateway drug to Haskell

#42
post #18

Earlier quoted context omitted.

Hence a reason why so many people are sticking to ML despite the lack of social momentum.

ocaml is a great language in its own right too; the only haskell features I find myself really missing are do notation and operator overloading.

Some people also complain about a tiny set of syntactic issues. Other than that I like both ml and ocaml.

Re: Rust as a gateway drug to Haskell

#43
post #29

Earlier quoted context omitted.

The benchmarks game falls squarely under the umbrella of "short, simple programs", not the sort of real-world stuff where you would benefit from having a language that scales well. That said, Haskell performs pretty well in the toy benchmarks anyway. Your comparison between Haskell and Go is about market size, not language design. I suspect you would have a similarly hard time finding Rust devs as Haskell devs (i.e.…

> .. you can write vastly more complicated programs that are, say, 80% as fast as hand-optimized C for only 10% of the effort of hand-optimized C. I don't mean to be personal, but your quantative claim smells a little like unsubstantiated BS. Do you have any data to back it up? > That said, Haskell performs pretty well in the toy benchmarks anyway. Currently, "pretty well" looks like GHC performance is 50% to 10% of…

The make errors are a bit weird because the programs build on my machine no problem.

In parts haskells slowness seems to be because no one cares enough to work on it. Can't say for sure, though, so maybe I just should try a task and implement it to see how fast it'd be without amazing optimization foo.

Although of course these benchmarks aren't really representative of the real world because they'd just end up as a c ffi call in most languages if they actually were that performance critical.

Re: Rust as a gateway drug to Haskell

#44
post #28
post #22

Haskell/GHC will soon have an extension for linear types, which will bring the languages much closer: http://blog.tweag.io/posts/2017-03-13-linear-types.html

Yeah right. If only the standard library (the base package) could immediately be converted to use linear types and we can all benefit from that! (Hint: it won't. Even the fairly no-brainer AMP and BBP took an absurdly long time. This is extremely slow by Rust standards. The Haskell community might, but the stewards of the standard libraries don't have the move-fast-and-break-things attitude.)

Did rust ever have a large scale breaking change? Anyway, the linear type proposal is designed to be completely backwards compatible so that shouldn't be as big of an issue.

Re: Rust as a gateway drug to Haskell

#45

Something that I found about going from Haskell to Rust was that Rust provides many powerful abstractions without compromising on performance. It was very frustrating to try reasoning about performance in Haskell due to its laziness. Every language has quirks about how to write performant code, but Haskell is notorious in my mind for being quite easy to write obscenely slow code in.

I don't use Haskell but didn't I read recently that the latest version of Haskell addresses this common concern by allowing you to turn off laziness altogether so everything evaluates eagerly?

Re: Rust as a gateway drug to Haskell

#46
post #41
post #36

Earlier quoted context omitted.

What is it lacking for imperative programming? I find it to be immensely good at it!

Don't know... mutable collections? A way to make sure things are evaluated without writing seq every other line?

Mutable hashtables: https://hackage.haskell.org/package/hashtables

Mutable arrays: https://hackage.haskell.org/package/vector-0.12.0.1/docs/Dat...

Strict by default: Put {#- Language Strict #-} at the top of files where necessary but usually you'd just use bangpatterns and unbox-strict-fields.

Re: Rust as a gateway drug to Haskell

#47
post #18

Earlier quoted context omitted.

ocaml is a great language in its own right too; the only haskell features I find myself really missing are do notation and operator overloading.

Some people also complain about a tiny set of syntactic issues. Other than that I like both ml and ocaml.

Having learned ML languages via Caml Light, I never understood what those complaints are about.

Maybe the only thing I would complain would be the separation between integer and floating point math.

Re: Rust as a gateway drug to Haskell

#48

Earlier quoted context omitted.

This is what's really nice about Nim. It writes like Python, but is fast like Rust. Ran across Option in it the other day, though it's not used heavily. I really wish there was something like Haskell but with a runtime like Nim or Go. Perhaps that is OCaml?

Have you looked at Swift? It's pretty similar to Rust, but eschews all the lifetime stuff in favour of a runtime that does reference counting.

Actually Swift 4.0 just got some memory ownership support, with more to come later.

Re: Rust as a gateway drug to Haskell

#49
post #44
post #28

Earlier quoted context omitted.

Yeah right. If only the standard library (the base package) could immediately be converted to use linear types and we can all benefit from that! (Hint: it won't. Even the fairly no-brainer AMP and BBP took an absurdly long time. This is extremely slow by Rust standards. The Haskell community might, but the stewards of the standard libraries don't have the move-fast-and-break-things attitude.)

Did rust ever have a large scale breaking change? Anyway, the linear type proposal is designed to be completely backwards compatible so that shouldn't be as big of an issue.

Yes I know it's completely backwards compatible. But in practice if the standard libraries don't change, (a) there won't be a ready source of inspiration and examples to copy from; (b) actually the feature is really geared more towards libraries than applications, so it's less useful if the base library doesn't adopt it wholeheartedly.

Re: Rust as a gateway drug to Haskell

#50

Something that I found about going from Haskell to Rust was that Rust provides many powerful abstractions without compromising on performance. It was very frustrating to try reasoning about performance in Haskell due to its laziness. Every language has quirks about how to write performant code, but Haskell is notorious in my mind for being quite easy to write obscenely slow code in.

I don't use Haskell but didn't I read recently that the latest version of Haskell addresses this common concern by allowing you to turn off laziness altogether so everything evaluates eagerly?

There is -XStrict, see here for a discussion: https://ghc.haskell.org/trac/ghc/wiki/StrictPragma
Post reply on HN