JSFoo Pune 2020


Up next

Purescript - JS you can reason about

Submitted Feb 7, 2020

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.



  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


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.