JSFoo Pune 2020

On component architecture, performance, security for front-end, and emerging trends

Tickets

Purescript - JS you can reason about

Submitted by Paul Viktor (@paulvictor) on Friday, 7 February 2020

Duration of the session: 30 mins full talk Status: Confirmed & Scheduled

View proposal in schedule

Abstract

The talk gives an introduction to Purescript. Purescript is a pure functional language which compiles to Javascript and has support for pretty advanced features that a programmer can expect, like higher kinded types, poly kinded types, row polymorphism, and good type inference. It interops seamlessly with Javascript and can be used to write concise, elegant and expressive code which can run on any JS engine. The ideas used in the language are very similar to Haskell, another pure functional language. It doesn’t have a runtime and the generated JS code is very clear and is easy to look at and debug. Purescript helps prevent a huge class of run time bugs. The type system is very strong and aids type inference and also code suggestion. So it helps manage huge codebases by separating effectful code from pure code and keeps effects at its edges and very minimal.
The intended audience is anyone who is familiar with Javascript and is looking for ways to write better code.

Outline

Topics

  1. What is purescript?
    * Differences with Typescript
    * Differences with Elm
    * Differences with ClojureScript
  2. Why you should consider types and what are the advantages.
  3. Overview of types in purescript
    * Sums & Products
    * Records
    * Composing sums and product types
  4. Functions - How to
    * Pattern matching
    * Lambda syntax
    * case statements
    * Guards
  5. Crash course on Functors, Applicatives, Monads, Semigroups, Monoids
    * Functor
    * Applicative
    * Monad
    - do blocks
    * Semigroups
    * Monoids
    * Alternatives
  6. Scrap your null‘s
    * The Maybe type
  7. Chaining computations stopping at the first error
    * The Either type
    * Validation applicative
  8. Effects (running synchronous actions)
  9. Async Callbacks a.k.a Aff
  10. Composition
    * Function Composition
    * Effectful Composition
  11. JS Interop
    * foreign import
    * foreign export
    * working with JS objects
  12. Immutablilty as the only option
    * record update syntax
    * lenses & prisms
  13. Overview of purescript web frameworks
    * purescript-react
    * purescript-flare
    * purescript-presto
    * purescript-virtual-dom
    * purescript-halogen
    * purescript-pux
  14. Purescript at Juspay

Requirements

Speaker bio

I have been working with Purescript and Haskell and have previously worked on Node.js and Scala in the past. The thing I admire in purescript is its simplicity, elegance and a unified way of expressing seemingly varied concepts. Like everyone, the syntax and operators were scary at first and the type system too rigid, complaining at every small change, but have started enjoying Purescript and its hard for me to imagine writing code in any programming language which may not be as expressive as Purescript in terms of ideas and abstractions.

Links

Comments

  •   Zainab Bawa (@zainabbawa) Reviewer 16 hours ago

    Feedback from the rehearsal:

    1. Change the narrative to the story of Juspay and PureScript. This will help the audience connect better.
    2. Add examples from JusPay’s use of PureScript throughout the event.
    3. Keep the talk fairly introductory in terms of concepts. Repeat concepts, if you must. Audience will grasp better.
    4. Remove the section about monads and functors. This will help reduce time. Plus, this amount of depth will lose the audience.
    5. Across the presentation, show comparisons and code samples of how PureScript helped you better than other options.

    Submit revised slides by 24 February.

Login with Twitter or Google to leave a comment