Slide 1

Slide 1 text

PureScript Get Started CT Wu wu_ct wuct

Slide 2

Slide 2 text

Some learning resources • PureScript by Example (free e-book) • Learn You a Haskell for Great Good (free e-book) • Haskell Book ($59, the best e-book IMO) • egghead.io (free online videos) • purescript-users.ml/ (Discourse) • Functional programming on slack (#purescript, #purescript-beginner) • https://www.facebook.com/groups/PureScript.tw (Facebook group)

Slide 3

Slide 3 text

Tools • purs - The PureScript compiler itself • pulp - A CLI tool which automates many of the tasks • psc-package - A package manager for PureScript • To install them all: • npm i -g purescript pulp psc-package-bin-simple • yarn global add purescript pulp psc-package-bin- simple

Slide 4

Slide 4 text

Init a project

Slide 5

Slide 5 text

Install a package

Slide 6

Slide 6 text

Open REPL

Slide 7

Slide 7 text

Open REPL

Slide 8

Slide 8 text

Simple Types

Slide 9

Slide 9 text

Records

Slide 10

Slide 10 text

Functions

Slide 11

Slide 11 text

Type Annotation

Slide 12

Slide 12 text

Type Signature Notation in PureScript “::” is for type annotations "PureScript" !:: String New types can be created via type constructors ["PureScript"] !:: Array String ![["Pure"], ["Script"!]] !:: Array (Array String)

Slide 13

Slide 13 text

Type Signature Notation in PureScript → is an infix type constructor for functions String → Number A function with multiple → is a curried function String → String → String

Slide 14

Slide 14 text

Type Signature Notation in PureScript ∀ (forall) is the universal quantifier and lowercase letters stand for type variables ∀ a. a → a 㱺 expresses constraints on type variables ∀ a. Monoid a ⇒ a !-> a !-> a

Slide 15

Slide 15 text

Q & A

Slide 16

Slide 16 text

Learn once, apply everywhere. wu_ct wuct