-
Notifications
You must be signed in to change notification settings - Fork 192
Update Chapter 12 #29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The theme of this chapter, "Callback Hell", isn't a problem anymore for modern JS with async function copyFile(file1, file2) {
var fs = require('fs');
let data = await fs.readFile(file1, { encoding: 'utf-8' })
fs.writeFile(file2, data, { encoding: 'utf-8' })
}
copyFile('file1.txt', 'file2.txt')
.catch(e => {
console.log('There was a problem with copyFile: ' + e.message);
}); So I think a better focus of this chapter is "Asynchronous Effects". Some I'm hesitant to update these remaining sections to working code, since
I think @drewolson's blog posts on Drew, how do you feel about us using your writing for the PureScript book? |
I'd be honored if you'd like to use my writing for the book. I'm also happy to write more on specific topics (and cross-post to my blog) that you're interested in covering. Somehow this notification just showed up for me, apologies on the slow reply. |
I'd like to get preapproval from at least one @purescript-contrib member before jumping into the Chapter 12 overhaul. @drewolson No worries about a late reply. I just edited the post yesterday with the blog proposal and tagged mention. |
@hdgarrood What are your thoughts on this proposal to rewrite Ch12 based on Drew's post? |
This chapter could also benefit by incorporating @JordanMartinez 's guide on Aff too (purescript-contrib/purescript-aff#191). I think our goal should be to have:
|
Your proposal sounds good to me. I agree that the "callback hell" issue discussed feels a bit dated these days, and that @drewolson's posts would be a good introduction. In the vast majority of cases, there's not really any reason to use ContT for asynchronous code, since Aff exists, so I'm not sure ContT deserves as much coverage in the book as it has currently. I'm not sure that @JordanMartinez's guide fits in the book, though; it focuses a lot on the fact that monads don't compose, which probably ought to be beyond the scope of the book, and shouldn't be necessary to teach people the basics of what Aff is and how to use it anyway. |
@hdgarrood Not necessarily. There's a number of things my guide covers. Only one part of that is the
I think the only thing not covered is how killing fibers works. |
Sure, but more isn't necessarily better. I definitely don't think we should cover the entire Aff API in the book; for example, I think we have about 280k lines of PureScript across our various projects in my day job, and I don't think we use Fiber explicitly at all. Ideally I don't think the chapter should end up very much larger than how it is now. |
@hdgarrood Good points!
|
No description provided.
The text was updated successfully, but these errors were encountered: