5 ms·
> Why is this important? Concurrency is hard and if you want M:N thread multiplexing (i.e. WEB SCALE CODE, where application threads aren’t pinned to pthreads)
by IceDane 9y ago
> Why is this important? Concurrency is hard and if you want M:N thread multiplexing (i.e. WEB SCALE CODE, where application threads aren’t pinned to pthreads) your options today are precisely Erlang, Go, .NET, and Perl 6.
I guess the author doesn't know about Haskell? The concurrency story for Haskell is great, and using the right library, you can literally just define types for the routes for your backend and then ask it to generate JS for your frontend.
- aaron-lebo 9y agoedit: dumb snark, but the replies are useful
- IceDane 9y agoNo need for the snark. This isn't fanboyism, though I gladly admit that I'm fond of Haskell. I'm not just namedropping Haskell "just because". He claims those languages are the only one that have green threads. He's wrong. I corrected that.
- aaron-lebo 9y agoYou're right, that was overly snarky, but your post does come off as use Haskell -> magic. The concurrency stories for Erlang and Go are front and center, very well defined, and obvious. How do you get similar functionality in Haskell (specifically, what libraries do what you are talking about)?
- IceDane 9y agoThe library I was referring to is called servant[1]. It's a library for writing backends and clients in Haskell. I mentioned it because he said something about "webscale", but it doesn't have anything to do with concurrency. The go-to library for nice Haskell concurrency is probably async[2], which you can combine with stm[3] for very nice guarantees. If you're interested, there is a very nice, free book[4] on the subject. [1] https://haskell-servant.github.io/ https://haskell-servant.github.io/ [2] https://www.stackage.org/package/async https://www.stackage.org/package/async [3] https://www.stackage.org/package/stm https://www.stackage.org/package/stm [4] http://chimera.labs.oreilly.com/books/1230000000929/index.html http://chimera.labs.oreilly.com/books/1230000000929/index.ht...
- dungle6 9y agoI have no idea where this incredulity even comes from you tools, nor the claim from TFA which was patently absurd. Pretty much every fucking major language not listed has green threads if not built into the core (Python, Ruby) provided as a well known library (Java, C++). And any new language it's pretty much table stakes. The article claim is so ridiculous it's not even wrong and you go on to snark about a Haskell counterexample. What a complete asshole.
- szemet 9y ago"The concurrency stories for Erlang and Go are front and center, very well defined, and obvious." GHC Haskell basically have the same concurrency story (since ghc 7.0.1 - 16 November 2010 [1]): - You can start ten or even hundred thousands of threads - Inside them you can program like having synchronous I/O - And the runtime handles it efficiently (with epoll/kqueue/...) The difference is that haskell is less opinionated on the high level concurrency primitives, so you have many choices (sometimes with multiple different library implementations) like: locking, explicit async code, transactional memory, channels... https://hackage.haskell.org/packages/#cat:Concurrency https://hackage.haskell.org/packages/#cat:Concurrency [1] Release Notes: "On POSIX platforms, there is a new I/O manager based on epoll/kqueue/poll, which allows multithreaded I/O code to scale to a much larger number (100k+) of threads" https://downloads.haskell.org/~ghc/7.0.1/docs/html/users_guide/release-7-0-1.html https://downloads.haskell.org/~ghc/7.0.1/docs/html/users_gui...
- nilved 9y agoBy "right library" do you mean Servant? (I'm interested.)
- weberc2 9y agoDoes Haskell have thread multiplexing?
- bgamari 9y agoYes, as well as excellent abstractions for putting those threads to work. See [parallel](https://hackage.haskell.org/package/parallel https://hackage.haskell.org/package/parallel), [async](https://hackage.haskell.org/package/async https://hackage.haskell.org/package/async), and [monad-par](https://hackage.haskell.org/package/monad-par https://hackage.haskell.org/package/monad-par) for a few examples. If you just need a web server [Warp](https://hackage.haskell.org/package/warp https://hackage.haskell.org/package/warp) is extremely competitive.
- mrkgnao 9y agoHN doesn't support full Markdown. :(
- kbenson 9y agoI think you're thinking of CommonMark. That link format isn't valid in canonical Markdown either (just to some of the common variants that also went by "Markdown"). I was always partial to the variants that could do citations well. They would automatically link-ify items postfixed by [1] etc with the link included at the citation at the bottom. I implemented a customer facig newsletter system at one job using that, where it automatically made the emails multipart when markdown was submitted, with the text part being raw Markdown. When using citations, it's still very readable.