1 of 11

PureScript and React.js

Teodor Szente

Web Developer at OkapiDev

Follow me on github.com/teosz

Date or Conference

Short Title

Author (Institution)

Logo Image Here

2 of 11

Haskell - why it?

“C++ is tricky the way driving on ice is tricky. But Haskell is tricky the way doing integrals is tricky”

  • Purely functional language
  • Advanced type system:
    • Safety
    • Abstract Data Types
    • Generalization
    • Polymorphic recursion

more here - http://qr.ae/RCSSJD

Date or Conference

Short Title

Author (Institution)

Logo Image Here

3 of 11

main = doprint "What is your name?"� name <- getLine� print ("Hello " ++ name ++ "!")

Date or Conference

Short Title

Author (Institution)

Logo Image Here

4 of 11

Purescript

Almost Haskell compile to Javascript

Most important differences:

  • Evaluation
  • Define collection syntax
  • Defining Operators

all here - https://github.com/purescript/purescript/wiki/Differences-from-Haskell

Date or Conference

Short Title

Author (Institution)

Logo Image Here

5 of 11

Purescript

module Main where

import Prelude

import Control.Monad.Eff.Console (log)

data Person = Person String Int

showPerson :: Person -> String

showPerson (Person name age) =

name ++ ", aged " ++ show age

person :: Person

person = Person "John Smith" 30

main = log (showPerson person)

Date or Conference

Short Title

Author (Institution)

Logo Image Here

6 of 11

Purescript Thermite

Is a simple PureScript wrapper for ReactJS.It does not (and does not aim to) provide all of the functionality of ReactJS, but instead to provide a clean API to the most commonly-used parts of its API.

Date or Conference

Short Title

Author (Institution)

Logo Image Here

7 of 11

Date or Conference

Short Title

Author (Institution)

Logo Image Here

8 of 11

But I want to use awesome stuff from react ecosystem

Date or Conference

Short Title

Author (Institution)

Logo Image Here

9 of 11

Alternative

Normal react stack with data processing in purescript

Date or Conference

Short Title

Author (Institution)

Logo Image Here

10 of 11

Demo #2

Date or Conference

Short Title

Author (Institution)

Logo Image Here

11 of 11

Q&A

Don’t be shy

Date or Conference

Short Title

Author (Institution)

Logo Image Here