Skip to content

beerose/wroc-ts-08-talk

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
title
Persistent data structures thanks to recursive type aliases

the talk

How

with a kickass 15 minute presentation, entirely in VSCode.

Why

It's well known that mutability is evil and often troublesome, but you can stop shallow copying arrays (or god-forbid deep copying) every time you want to change them. Let me show you how.

Immutable data structures are the tool for the job when immutability is required.
Time to add them to our toolset.

Persistent data structures are good to know when your product needs time-travel capabilities (like text inputs -- they are pretty bad if CTRL+Z doesn't work).

TODO: Make "Why" shorter?

What

  • What does the persistent data structure mean?
  • Meet Cons List
    • How it looks in TypeScript 3.7
    • How it looked before TS3.7
    • Functions operating on ConsList
      • (big reveal) Instances of fp-ts typeclasses
    • Benchmarks of Cons List vs Array operations

Benchmarks

Mutable operations vs cons

Opeation ops/s
array.unshift(50) 99953.939
array.push(50) 70675.276
cons(50, list) 5822999.798

Immutable operation vs cons

Operation ops/s
[50, ...array] 12680.588
cons(50, list) 5485947.933

Array.prototype.map vs map

Operation ops/s
array.map(x => x * 2) 4389.837
map(list, x => x * 2) 662.805

quick reminders

Controls

  {
    "key": "cmd+alt+left",
    "command": "workbench.action.previousEditor"
  },
  {
    "key": "cmd+alt+right",
    "command": "workbench.action.nextEditor"
  },
  {
    "key": "cmd+shift+q",
    "command": "quokka.toggle",
    "when": "editorTextFocus"
  },

Move quickly through the slides with

  • Cmd + Alt + LeftArrowView: Open Previous Editor
  • Cmd + Alt + RightArrowView: Open Next Editor

Run TypeScript slides with

  • Cmd + Shift + QQuokka.js: Toggle (Start/Stop) on Current File

Minimize distractions and maximize screen space

  • Cmd + B(built-in) View: Toggle Side Bar Visibility

Use regions to hide imports and code pasted from previous slides

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published