https://github.com/nh2/haskellerz-async-tutorial-2020
Async tutorial (my HaskellerZ 2020 talk)
https://github.com/nh2/haskellerz-async-tutorial-2020
Last synced: about 1 month ago
JSON representation
Async tutorial (my HaskellerZ 2020 talk)
- Host: GitHub
- URL: https://github.com/nh2/haskellerz-async-tutorial-2020
- Owner: nh2
- Created: 2020-04-30T15:50:31.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-04-30T19:32:04.000Z (about 5 years ago)
- Last Synced: 2025-04-09T04:12:54.552Z (2 months ago)
- Language: Haskell
- Homepage:
- Size: 8.79 KB
- Stars: 13
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
`async` tutorial 2020 ([HaskellerZ talk](https://www.meetup.com/HaskellerZ/events/270136648/))
=======================================_by Niklas Hambüchen_
This provides the files we will start with in the tutorial.
You can clone this repo and then follow along the talk.
# Relevant links
* New async docs (to be part of next `async` release): https://nh2.me/async-docs
* [Pooled concurrency in `unliftio`](http://hackage.haskell.org/package/unliftio-0.2.12.1/docs/UnliftIO-Async.html#g:9)
* Concurrent stream processing: [`conduit-concurrent-map`](https://hackage.haskell.org/package/conduit-concurrent-map)### Notes during the tutorial
Look at the `live-tutorial` branch to see how the code evolved.
* Tutorial template: https://github.com/nh2/haskellerz-async-tutorial-2020
* remind me to stop when following with code
* make a function that simulates downloading (`getURL`)
* go through https://nh2.me/async-docs
* aborting on failure by default -- silent failure is bad
* introduce the important `async` properties
* insert simulated connection failure for `url1`
* show how exceptions get raised on `wait` (switch to fail for `url2`)
* show higher-level functions (resume going through docs)
* exceptions
* why we have to think about exceptions
* synchronous and asynchronous, examples (`timeout`)
* `bracket`
* how the RTS works (N-on-M green threading)
* plain `forkIO`
* examples of why it is bad
* `unliftio`
* resource considerations
* semaphore
* pooled concurrency in `unliftio`: http://hackage.haskell.org/package/unliftio-0.2.12.1/docs/UnliftIO-Async.html#g:9
* simple example: https://gist.github.com/nh2/1500af99cfe6a8f45848d8c1e92ad9ba
* streaming processing
* head-of-line blocking
* `conduit-concurrent-map`: https://github.com/nh2/conduit-concurrent-map
* Alexey to metion starting overhead#### Summary of what you should remember
* How does concurrency work in Haskell?
* What are the underlying primitives?
* What does async do?
* what functions to use in practice?
* What are common mistakes?