JSFoo Pune 2020

JSFoo Pune 2020

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

Tickets

Loading…

Paul Viktor

@paulvictor

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.

Outline

Topics

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

Comments

{{ gettext('Login to leave a comment') }}

{{ gettext('Post a comment…') }}
{{ gettext('New comment') }}
{{ formTitle }}

{{ errorMsg }}

{{ gettext('No comments posted yet') }}

Hybrid access (members only)

Hosted by

JSFoo is a forum for discussing UI engineering; fullstack development; web applications engineering, performance, security and design; accessibility; and latest developments in #JavaScript. Follow JSFoo on Twitter more