News for hackers. Stuff that matters.
Re:Why I’m Learning Perl 6 by IceDane on Wednesday July 26, 2017 @07:25AM (#14855250)
> 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.

Re:Why I’m Learning Perl 6 by nilved on Wednesday July 26, 2017 @08:50AM (#14855729)
By "right library" do you mean Servant? (I'm interested.)
Re:Why I’m Learning Perl 6 by mrkgnao on Wednesday July 26, 2017 @02:20PM (#14858733)
Here's an overview I wrote a while back.

https://news.ycombinator.com/item?id=14149200

Re:Why I’m Learning Perl 6 by IceDane on Wednesday July 26, 2017 @08:57AM (#14855772)
Yep. Servant is great.
Re:Why I’m Learning Perl 6 by weberc2 on Wednesday July 26, 2017 @10:30AM (#14856443)
Does Haskell have thread multiplexing?
Re:Why I’m Learning Perl 6 by bgamari on Wednesday July 26, 2017 @10:55AM (#14856678)
Yes, as well as excellent abstractions for putting those threads to work. See [parallel](https://hackage.haskell.org/package/parallel), [async](https://hackage.haskell.org/package/async), and [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) is extremely competitive.
Re:Why I’m Learning Perl 6 by mrkgnao on Wednesday July 26, 2017 @02:20PM (#14858738)
HN doesn't support full Markdown. :(
Re:Why I’m Learning Perl 6 by kbenson on Wednesday July 26, 2017 @02:41PM (#14858938)
I 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.

Re:Why I’m Learning Perl 6 by weberc2 on Wednesday July 26, 2017 @04:53PM (#14860244)
I thought CommonMark was the attempt to standardize Markdown. Besides that, every markdown implementation I've touched since before CommonMark supported [text](url) format.
Re:Why I’m Learning Perl 6 by kbenson on Wednesday July 26, 2017 @05:38PM (#14860612)
Actually, I'm totally wrong. I thought this wasn't part of the original spec for some reason, but it's totally in Gruber's list of features and works in Markdown.pl, I just missed it when checking to confirm originally (I saw automatic links and missed the other links feature).

Thanks for causing me to look again (I used babelmark[1] to check what versions supported it and noticed all of them do, including Markdown.pl). I dislike putting out wrong information. :/

1: http://johnmacfarlane.net/babelmark2/?text=%5Btext%5D(url)

Re:Why I’m Learning Perl 6 by mrkgnao on Wednesday July 26, 2017 @02:42PM (#14858946)
That's the way I format my bigger HN comments. Didn't know [this](wasn't) part of the Markdown standard, though. Thanks!
Re:Why I’m Learning Perl 6 by kbenson on Wednesday July 26, 2017 @05:39PM (#14860617)
Actually, see your sibling comment. I was incorrect. That is a standard Markdown feature.
Re:Why I’m Learning Perl 6 by evincarofautumn on Wednesday July 26, 2017 @10:43AM (#14856572)
Yep. “forkIO” creates a lightweight thread. There are also things like “forkOS” to create a heavyweight thread and “forkOn” to pin a lightweight thread to a particular capability (core, more or less).
Re:Why I’m Learning Perl 6 by aaron-lebo on Wednesday July 26, 2017 @07:28AM (#14855262)
edit: dumb snark, but the replies are useful
Re:Why I’m Learning Perl 6 by IceDane on Wednesday July 26, 2017 @07:35AM (#14855297)
No 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.
Re:Why I’m Learning Perl 6 by aaron-lebo on Wednesday July 26, 2017 @07:40AM (#14855315)
You'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)?

Re:Why I’m Learning Perl 6 by szemet on Wednesday July 26, 2017 @08:31AM (#14855613)
"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

[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_gui...

Re:Why I’m Learning Perl 6 by IceDane on Wednesday July 26, 2017 @07:46AM (#14855351)
The 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/ [2] https://www.stackage.org/package/async [3] https://www.stackage.org/package/stm [4] http://chimera.labs.oreilly.com/books/1230000000929/index.ht...

Re:Why I’m Learning Perl 6 by dungle6 on Wednesday July 26, 2017 @08:27AM (#14855590)
I 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.