SlideShare a Scribd company logo
1 of 36
Download to read offline
Getting Started with
PureScript
John A. De Goes
Agenda
• Introduction
• What is PureScript
• Syntax & Semantics
• Who Uses PureScript
• Why PureScript
• Ecosystem
• Getting Started
• Node.js
• NPM
• Bower
• PureScript
• Pulp
• Hello World
What is PureScript?
PureScript is a strongly-typed, purely-functional programming
language that compiles to Javascript1
, and is written in and
inspired by Haskell.
1
And C++!
Syntax
import Control.Apply
import Graphics.Canvas.Free
scene =
filled $ closed do
moveTo 0 0
lineTo 50 0
lineTo 25 50
where
closed path = beginPath *> path <* closePath
filled shape = shape <* fill
Semantics
• Type Inference
• Higher-Kinded Polymorphism
• Support for basic Javascript types
• Extensible records
• Extensible effects
• Optimizer rules for generation of efficient Javascript
• Pattern matching
• Simple FFI
• Modules
• Rank N Types
• Do Notation
• Tail-call elimination
• Type Classes
Who Uses PureScript?2
• SlamData
• Xamarin
• DICOM Grid
• Middlebury Interactive Languages
• DICE.fm
• McGraw Hill Financial
2
Cobbled together from various online sources.*
Why PureScript?
Motivation
• You want to or are forced to do front-end or node.js
• You like static typing
• You like functional programming, of the pure variety
• You prefer expressive power over no-frills, opinionated simplicity
• You want to crush Javascript/CoffeeScript/TypeScript/Scala3
beneath your
heel... BWAHAHA!
3
OK, not quite yet.
Why PureScript?
..instead of GHCJS?
• "Haskell in hindsight"
• Strict versus lazy
• Zero runtime
• Clean, easy FFI
• Great re-use of third-party JS
• Simpler language than GHC's quadrillion dialects of Haskell
Ecosystem
Ecosystem
UI Libraries
• purescript-halogen
• purescript-react
• purescript-angular
• purescript-rx
• purescript-flare
• purescript-pux
• purescript-optic-ui
• purescript-behaviors
• purescript-signal
• purescript-thermite
• purescript-frp-rabbit
• purescript-sigment
• purescript-ufi
And even more!
Ecosystem
Testing Libraries
• purescript-test-unit
• purescript-quickcheck
• purescript-quickcheck-laws
• purescript-strongcheck
• purescript-benchotron
• purescript-spec
• purescript-assert
Ecosystem
Preludes4
• purescript-prelude
• purescript-preface
• purescript-batteries
4
Yes, there are multiple!
Ecosystem
Build Tooling
• pulp
• grunt-purescript
• gulp-purescript
• purescript-psa
Ecosystem
Editor / IDE Support
• Atom
• purescript-contrib/atom-language-purescript
• nwolverson/atom-ide-purescript
• Emacs
• dysinger/purescript-mode
• emacs-pe/purescript-mode
• ardumont/psci-mode
• spion/purscheck
• emacs-pe/flycheck-purescript
• epost/psc-ide-emacs
• Sublime Text 2 - PureScript package
• Vim
• purescript-vim
• FrigoEU/psc-ide-vim
• IntelliJ IDEA - ikarienator/pure-idea
• Visual Studio - nwolverson/vscode-ide-purescript
• General
• kRITZCREEK/psc-ide
• To generate TAGS files, use psc-docs --format etags (or --format ctags)
Ecosystem
Library Search
Pursuit
Getting Started
Prerequisites
1. Node.js
2. NPM
3. Bower
4. PureScript
5. Pulp
Getting Started
Prerequisites: Node.js
Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript
engine. Node.js uses an event-driven, non-blocking I/O model
that makes it lightweight and efficient. Node.js' package
ecosystem, npm, is the largest ecosystem of open source libraries
in the world.
Node.js allows full-featured, browser-less Javascript
programs.
Getting Started
Prerequisites: Node.js
• Many Javascript dev tools are written in Javascript and run
on Node.js
• PureScript dev tools are written in PureScript, compiled to
JavaScript
• Bottom Line: You can't live without it (even if you want to!).
Getting Started
Prerequisites: Node.js
• Installers
https://nodejs.org/en/download/
• Homebrew
brew install node
• MacPorts
port install nodejs
• pkgsrc
pkgin -y install nodejs
• Debian / Ubunutu (4.x)
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs
• Debian / Ubuntu (6.x)
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
Getting Started
Prerequisites: NPM
• NPM = Node Package Manager
• Used by Node to manage packages
• Many tools and libraries are distributed through NPM
• Bottom Line: Another thing you can't live without...
Getting Started
Prerequisites: NPM
• NPM comes pre-installed with Node.js but version may be
old
• Self-Updating NPM:
sudo npm install npm -g
Getting Started
Prerequisites: Bower
• A package manager for the web
• Maintains global registry of name -> URL
• Supports repositories & tags
• Supports all types of dependencies (binary, PureScript, etc.)
• Dependencies specified in bower.json file
• Bottom Line: Almost all PureScript libraries are registered with bower,
and almost all PureScript projects maintain dependencies with bower!
Getting Started
Prerequisites: Bower
{
"name": "purescript-library",
"description": "A PureScript library",
"authors": [
"John A. De Goes <john@degoes.net>"
],
"license": "Apache 2",
"version": "0.1.0",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"output"
],
"dependencies": {
"purescript-profunctor-lenses": "^1.0.0-rc.1",
"purescript-free": "^1.0.0-rc.1",
"purescript-console": "^v1.0.0-rc.1",
"purescript-either": "^v1.0.0-rc.1",
"purescript-maybe": "^1.0.0-rc.1",
"purescript-foldable-traversable": "^1.0.0-rc.1",
"purescript-monoid": "^1.0.0-rc.2",
"purescript-bifunctors": "^1.0.0-rc.1",
"purescript-invariant": "^1.0.0-rc.1",
"purescript-prelude": "^1.0.0-rc.4",
"purescript-control": "^1.0.0-rc.1",
"purescript-transformers": "^1.0.0-rc.1"
}
}
Getting Started
Prerequisites: Bower
• Install with NPM
npm install -g bower
Getting Started
Prerequisites: PureScript Compiler
• psc — PureScript compiler
• psc-docs — PureScript documentation generator
• psc-bundle — Bundler & dead-code eliminator
• psci — PureScript Read-Eval-Print-Loop (REPL)
• psc-ide-server — IDE Server
• psc-ide-client — IDE Client
Getting Started
Prerequisites: PureScript Compiler
• Installers
https://github.com/purescript/purescript/releases/latest
• Install with NPM
npm install -g purescript
Getting Started
Prerequisites: Pulp
• Pulp: Popular build tool for PureScript projects
• Knows how to perform magical incantations of psc & related
tools
• Bottom Line: If you can use it to build your project, then do
it!
Getting Started
Prerequisites: Pulp
• Install with NPM
npm install -g pulp
Getting Started
Hello World
1. Create Directory Structure
2. Create Bower File
3. Install Bower Dependencies
4. Write PureScript Main
5. Build & Run
Getting Started
Hello World: Create Directory Structure
bower.json
/src/
/Main.purs
Getting Started
Hello World: Create Bower File
{
"name": "hello world",
"dependencies": {
"purescript-console": "^0.1.1",
"purescript-eff": "^0.1.2",
"purescript-prelude": "^0.1.5"
}
}
Getting Started
Hello World: Install Bower Dependencies
bower install
Getting Started
Hello World: Write PureScript Main
module Main where
import Prelude(Unit)
import Control.Monad.Eff (Eff)
import Control.Monad.Eff.Console (CONSOLE, log)
main :: forall e. Eff (console :: CONSOLE | e) Unit
main = do
log "Hello World!"
Getting Started
Hello World: Build & Run
pulp build
pulp run
Congratulations, You've Started Your Journey Into The
World of PureScript!
Don't Forget the Easy Peasy PureScript Workshop at LambdaConf 2016!
More Resources: http://purescript.org
THE END

More Related Content

What's hot

RSYSLOG v8 improvements and how to write plugins in any language.
RSYSLOG v8 improvements and how to write plugins in any language.RSYSLOG v8 improvements and how to write plugins in any language.
RSYSLOG v8 improvements and how to write plugins in any language.Rainer Gerhards
 
Philly Tech Week Introduction to NodeJS
Philly Tech Week Introduction to NodeJSPhilly Tech Week Introduction to NodeJS
Philly Tech Week Introduction to NodeJSRoss Kukulinski
 
Dive into sentry
Dive into sentryDive into sentry
Dive into sentryLeo Zhou
 
Lisp Meet Up #31, Clake: a GNU make-like build utility in Common Lisp
Lisp Meet Up #31, Clake: a GNU make-like build utility in Common LispLisp Meet Up #31, Clake: a GNU make-like build utility in Common Lisp
Lisp Meet Up #31, Clake: a GNU make-like build utility in Common Lispmasayukitakagi
 
Node.js Workshop - Sela SDP 2015
Node.js Workshop  - Sela SDP 2015Node.js Workshop  - Sela SDP 2015
Node.js Workshop - Sela SDP 2015Nir Noy
 
Create Rest API in Nodejs
Create Rest API in Nodejs Create Rest API in Nodejs
Create Rest API in Nodejs Irfan Maulana
 
Testing Wi-Fi with OSS Tools
Testing Wi-Fi with OSS ToolsTesting Wi-Fi with OSS Tools
Testing Wi-Fi with OSS ToolsAll Things Open
 
Dockercon Swarm Updated
Dockercon Swarm UpdatedDockercon Swarm Updated
Dockercon Swarm UpdatedDocker, Inc.
 
自分をClojure化する方法
自分をClojure化する方法自分をClojure化する方法
自分をClojure化する方法fukamachi
 
Mobile Analytics mit Elasticsearch und Kibana
Mobile Analytics mit Elasticsearch und KibanaMobile Analytics mit Elasticsearch und Kibana
Mobile Analytics mit Elasticsearch und Kibanainovex GmbH
 
Don’t turn your logs into cuneiform
Don’t turn your logs into cuneiformDon’t turn your logs into cuneiform
Don’t turn your logs into cuneiformAndrey Rebrov
 
Ansible+docker (highload++2015)
Ansible+docker (highload++2015)Ansible+docker (highload++2015)
Ansible+docker (highload++2015)Pavel Alexeev
 
vert.x 3.1 - be reactive on the JVM but not only in Java
vert.x 3.1 - be reactive on the JVM but not only in Javavert.x 3.1 - be reactive on the JVM but not only in Java
vert.x 3.1 - be reactive on the JVM but not only in JavaClément Escoffier
 
Kubernetes #4 volume &amp; stateful set
Kubernetes #4   volume &amp; stateful setKubernetes #4   volume &amp; stateful set
Kubernetes #4 volume &amp; stateful setTerry Cho
 
vert.x 소개 및 개발 실습
vert.x 소개 및 개발 실습vert.x 소개 및 개발 실습
vert.x 소개 및 개발 실습John Kim
 

What's hot (18)

RSYSLOG v8 improvements and how to write plugins in any language.
RSYSLOG v8 improvements and how to write plugins in any language.RSYSLOG v8 improvements and how to write plugins in any language.
RSYSLOG v8 improvements and how to write plugins in any language.
 
Philly Tech Week Introduction to NodeJS
Philly Tech Week Introduction to NodeJSPhilly Tech Week Introduction to NodeJS
Philly Tech Week Introduction to NodeJS
 
Dive into sentry
Dive into sentryDive into sentry
Dive into sentry
 
Lisp Meet Up #31, Clake: a GNU make-like build utility in Common Lisp
Lisp Meet Up #31, Clake: a GNU make-like build utility in Common LispLisp Meet Up #31, Clake: a GNU make-like build utility in Common Lisp
Lisp Meet Up #31, Clake: a GNU make-like build utility in Common Lisp
 
Node.js Workshop - Sela SDP 2015
Node.js Workshop  - Sela SDP 2015Node.js Workshop  - Sela SDP 2015
Node.js Workshop - Sela SDP 2015
 
Initiation à Ruby on Rails
Initiation à Ruby on RailsInitiation à Ruby on Rails
Initiation à Ruby on Rails
 
Create Rest API in Nodejs
Create Rest API in Nodejs Create Rest API in Nodejs
Create Rest API in Nodejs
 
Nodejs vatsal shah
Nodejs vatsal shahNodejs vatsal shah
Nodejs vatsal shah
 
Testing Wi-Fi with OSS Tools
Testing Wi-Fi with OSS ToolsTesting Wi-Fi with OSS Tools
Testing Wi-Fi with OSS Tools
 
Introduction to node.js
Introduction to node.jsIntroduction to node.js
Introduction to node.js
 
Dockercon Swarm Updated
Dockercon Swarm UpdatedDockercon Swarm Updated
Dockercon Swarm Updated
 
自分をClojure化する方法
自分をClojure化する方法自分をClojure化する方法
自分をClojure化する方法
 
Mobile Analytics mit Elasticsearch und Kibana
Mobile Analytics mit Elasticsearch und KibanaMobile Analytics mit Elasticsearch und Kibana
Mobile Analytics mit Elasticsearch und Kibana
 
Don’t turn your logs into cuneiform
Don’t turn your logs into cuneiformDon’t turn your logs into cuneiform
Don’t turn your logs into cuneiform
 
Ansible+docker (highload++2015)
Ansible+docker (highload++2015)Ansible+docker (highload++2015)
Ansible+docker (highload++2015)
 
vert.x 3.1 - be reactive on the JVM but not only in Java
vert.x 3.1 - be reactive on the JVM but not only in Javavert.x 3.1 - be reactive on the JVM but not only in Java
vert.x 3.1 - be reactive on the JVM but not only in Java
 
Kubernetes #4 volume &amp; stateful set
Kubernetes #4   volume &amp; stateful setKubernetes #4   volume &amp; stateful set
Kubernetes #4 volume &amp; stateful set
 
vert.x 소개 및 개발 실습
vert.x 소개 및 개발 실습vert.x 소개 및 개발 실습
vert.x 소개 및 개발 실습
 

Similar to Getting Started with PureScript

FITC - Node.js 101
FITC - Node.js 101FITC - Node.js 101
FITC - Node.js 101Rami Sayar
 
The tools & technologies behind Resin.io
The tools & technologies behind Resin.ioThe tools & technologies behind Resin.io
The tools & technologies behind Resin.ioGreeceJS
 
Leonid Vasilyev "Building, deploying and running production code at Dropbox"
Leonid Vasilyev  "Building, deploying and running production code at Dropbox"Leonid Vasilyev  "Building, deploying and running production code at Dropbox"
Leonid Vasilyev "Building, deploying and running production code at Dropbox"IT Event
 
Practical introduction to dev ops with chef
Practical introduction to dev ops with chefPractical introduction to dev ops with chef
Practical introduction to dev ops with chefLeanDog
 
introduction to node.js
introduction to node.jsintroduction to node.js
introduction to node.jsorkaplan
 
Lions, Tigers and Deers: What building zoos can teach us about securing micro...
Lions, Tigers and Deers: What building zoos can teach us about securing micro...Lions, Tigers and Deers: What building zoos can teach us about securing micro...
Lions, Tigers and Deers: What building zoos can teach us about securing micro...Sysdig
 
Dcjq node.js presentation
Dcjq node.js presentationDcjq node.js presentation
Dcjq node.js presentationasync_io
 
Expert JavaScript Programming
Expert JavaScript ProgrammingExpert JavaScript Programming
Expert JavaScript ProgrammingYoshiki Shibukawa
 
Fluo CICD OpenStack Summit
Fluo CICD OpenStack SummitFluo CICD OpenStack Summit
Fluo CICD OpenStack SummitMiguel Zuniga
 
SCALE12X: Chef for OpenStack
SCALE12X: Chef for OpenStackSCALE12X: Chef for OpenStack
SCALE12X: Chef for OpenStackMatt Ray
 
201304 chef for open stack overview
201304 chef for open stack overview201304 chef for open stack overview
201304 chef for open stack overviewOpenStack Foundation
 
201304 chef for open stack overview
201304 chef for open stack overview201304 chef for open stack overview
201304 chef for open stack overviewOpenStack Foundation
 
Chef for OpenStack: OpenStack Spring Summit 2013
Chef for OpenStack: OpenStack Spring Summit 2013Chef for OpenStack: OpenStack Spring Summit 2013
Chef for OpenStack: OpenStack Spring Summit 2013Matt Ray
 
Open Source Swift Under the Hood
Open Source Swift Under the HoodOpen Source Swift Under the Hood
Open Source Swift Under the HoodC4Media
 
Engage 2019: Introduction to Node-Red
Engage 2019: Introduction to Node-RedEngage 2019: Introduction to Node-Red
Engage 2019: Introduction to Node-RedPaul Withers
 
Holy PowerShell, BATman! - dogfood edition
Holy PowerShell, BATman! - dogfood editionHoly PowerShell, BATman! - dogfood edition
Holy PowerShell, BATman! - dogfood editionDave Diehl
 
Everything-as-code - A polyglot adventure
Everything-as-code - A polyglot adventureEverything-as-code - A polyglot adventure
Everything-as-code - A polyglot adventureQAware GmbH
 
Everything-as-code. A polyglot adventure. #DevoxxPL
Everything-as-code. A polyglot adventure. #DevoxxPLEverything-as-code. A polyglot adventure. #DevoxxPL
Everything-as-code. A polyglot adventure. #DevoxxPLMario-Leander Reimer
 

Similar to Getting Started with PureScript (20)

FITC - Node.js 101
FITC - Node.js 101FITC - Node.js 101
FITC - Node.js 101
 
The tools & technologies behind Resin.io
The tools & technologies behind Resin.ioThe tools & technologies behind Resin.io
The tools & technologies behind Resin.io
 
Leonid Vasilyev "Building, deploying and running production code at Dropbox"
Leonid Vasilyev  "Building, deploying and running production code at Dropbox"Leonid Vasilyev  "Building, deploying and running production code at Dropbox"
Leonid Vasilyev "Building, deploying and running production code at Dropbox"
 
Practical introduction to dev ops with chef
Practical introduction to dev ops with chefPractical introduction to dev ops with chef
Practical introduction to dev ops with chef
 
Intro to CakePHP
Intro to CakePHPIntro to CakePHP
Intro to CakePHP
 
introduction to node.js
introduction to node.jsintroduction to node.js
introduction to node.js
 
Lions, Tigers and Deers: What building zoos can teach us about securing micro...
Lions, Tigers and Deers: What building zoos can teach us about securing micro...Lions, Tigers and Deers: What building zoos can teach us about securing micro...
Lions, Tigers and Deers: What building zoos can teach us about securing micro...
 
Dcjq node.js presentation
Dcjq node.js presentationDcjq node.js presentation
Dcjq node.js presentation
 
Expert JavaScript Programming
Expert JavaScript ProgrammingExpert JavaScript Programming
Expert JavaScript Programming
 
Fluo CICD OpenStack Summit
Fluo CICD OpenStack SummitFluo CICD OpenStack Summit
Fluo CICD OpenStack Summit
 
SCALE12X: Chef for OpenStack
SCALE12X: Chef for OpenStackSCALE12X: Chef for OpenStack
SCALE12X: Chef for OpenStack
 
Chef For OpenStack Overview
Chef For OpenStack OverviewChef For OpenStack Overview
Chef For OpenStack Overview
 
201304 chef for open stack overview
201304 chef for open stack overview201304 chef for open stack overview
201304 chef for open stack overview
 
201304 chef for open stack overview
201304 chef for open stack overview201304 chef for open stack overview
201304 chef for open stack overview
 
Chef for OpenStack: OpenStack Spring Summit 2013
Chef for OpenStack: OpenStack Spring Summit 2013Chef for OpenStack: OpenStack Spring Summit 2013
Chef for OpenStack: OpenStack Spring Summit 2013
 
Open Source Swift Under the Hood
Open Source Swift Under the HoodOpen Source Swift Under the Hood
Open Source Swift Under the Hood
 
Engage 2019: Introduction to Node-Red
Engage 2019: Introduction to Node-RedEngage 2019: Introduction to Node-Red
Engage 2019: Introduction to Node-Red
 
Holy PowerShell, BATman! - dogfood edition
Holy PowerShell, BATman! - dogfood editionHoly PowerShell, BATman! - dogfood edition
Holy PowerShell, BATman! - dogfood edition
 
Everything-as-code - A polyglot adventure
Everything-as-code - A polyglot adventureEverything-as-code - A polyglot adventure
Everything-as-code - A polyglot adventure
 
Everything-as-code. A polyglot adventure. #DevoxxPL
Everything-as-code. A polyglot adventure. #DevoxxPLEverything-as-code. A polyglot adventure. #DevoxxPL
Everything-as-code. A polyglot adventure. #DevoxxPL
 

More from John De Goes

Refactoring Functional Type Classes
Refactoring Functional Type ClassesRefactoring Functional Type Classes
Refactoring Functional Type ClassesJohn De Goes
 
One Monad to Rule Them All
One Monad to Rule Them AllOne Monad to Rule Them All
One Monad to Rule Them AllJohn De Goes
 
Error Management: Future vs ZIO
Error Management: Future vs ZIOError Management: Future vs ZIO
Error Management: Future vs ZIOJohn De Goes
 
Atomically { Delete Your Actors }
Atomically { Delete Your Actors }Atomically { Delete Your Actors }
Atomically { Delete Your Actors }John De Goes
 
The Death of Final Tagless
The Death of Final TaglessThe Death of Final Tagless
The Death of Final TaglessJohn De Goes
 
Scalaz Stream: Rebirth
Scalaz Stream: RebirthScalaz Stream: Rebirth
Scalaz Stream: RebirthJohn De Goes
 
Scalaz Stream: Rebirth
Scalaz Stream: RebirthScalaz Stream: Rebirth
Scalaz Stream: RebirthJohn De Goes
 
ZIO Schedule: Conquering Flakiness & Recurrence with Pure Functional Programming
ZIO Schedule: Conquering Flakiness & Recurrence with Pure Functional ProgrammingZIO Schedule: Conquering Flakiness & Recurrence with Pure Functional Programming
ZIO Schedule: Conquering Flakiness & Recurrence with Pure Functional ProgrammingJohn De Goes
 
Blazing Fast, Pure Effects without Monads — LambdaConf 2018
Blazing Fast, Pure Effects without Monads — LambdaConf 2018Blazing Fast, Pure Effects without Monads — LambdaConf 2018
Blazing Fast, Pure Effects without Monads — LambdaConf 2018John De Goes
 
Scalaz 8: A Whole New Game
Scalaz 8: A Whole New GameScalaz 8: A Whole New Game
Scalaz 8: A Whole New GameJohn De Goes
 
Scalaz 8 vs Akka Actors
Scalaz 8 vs Akka ActorsScalaz 8 vs Akka Actors
Scalaz 8 vs Akka ActorsJohn De Goes
 
Orthogonal Functional Architecture
Orthogonal Functional ArchitectureOrthogonal Functional Architecture
Orthogonal Functional ArchitectureJohn De Goes
 
The Design of the Scalaz 8 Effect System
The Design of the Scalaz 8 Effect SystemThe Design of the Scalaz 8 Effect System
The Design of the Scalaz 8 Effect SystemJohn De Goes
 
Quark: A Purely-Functional Scala DSL for Data Processing & Analytics
Quark: A Purely-Functional Scala DSL for Data Processing & AnalyticsQuark: A Purely-Functional Scala DSL for Data Processing & Analytics
Quark: A Purely-Functional Scala DSL for Data Processing & AnalyticsJohn De Goes
 
Post-Free: Life After Free Monads
Post-Free: Life After Free MonadsPost-Free: Life After Free Monads
Post-Free: Life After Free MonadsJohn De Goes
 
Streams for (Co)Free!
Streams for (Co)Free!Streams for (Co)Free!
Streams for (Co)Free!John De Goes
 
The Easy-Peasy-Lemon-Squeezy, Statically-Typed, Purely Functional Programming...
The Easy-Peasy-Lemon-Squeezy, Statically-Typed, Purely Functional Programming...The Easy-Peasy-Lemon-Squeezy, Statically-Typed, Purely Functional Programming...
The Easy-Peasy-Lemon-Squeezy, Statically-Typed, Purely Functional Programming...John De Goes
 
Halogen: Past, Present, and Future
Halogen: Past, Present, and FutureHalogen: Past, Present, and Future
Halogen: Past, Present, and FutureJohn De Goes
 

More from John De Goes (20)

Refactoring Functional Type Classes
Refactoring Functional Type ClassesRefactoring Functional Type Classes
Refactoring Functional Type Classes
 
One Monad to Rule Them All
One Monad to Rule Them AllOne Monad to Rule Them All
One Monad to Rule Them All
 
Error Management: Future vs ZIO
Error Management: Future vs ZIOError Management: Future vs ZIO
Error Management: Future vs ZIO
 
Atomically { Delete Your Actors }
Atomically { Delete Your Actors }Atomically { Delete Your Actors }
Atomically { Delete Your Actors }
 
The Death of Final Tagless
The Death of Final TaglessThe Death of Final Tagless
The Death of Final Tagless
 
Scalaz Stream: Rebirth
Scalaz Stream: RebirthScalaz Stream: Rebirth
Scalaz Stream: Rebirth
 
Scalaz Stream: Rebirth
Scalaz Stream: RebirthScalaz Stream: Rebirth
Scalaz Stream: Rebirth
 
ZIO Schedule: Conquering Flakiness & Recurrence with Pure Functional Programming
ZIO Schedule: Conquering Flakiness & Recurrence with Pure Functional ProgrammingZIO Schedule: Conquering Flakiness & Recurrence with Pure Functional Programming
ZIO Schedule: Conquering Flakiness & Recurrence with Pure Functional Programming
 
ZIO Queue
ZIO QueueZIO Queue
ZIO Queue
 
Blazing Fast, Pure Effects without Monads — LambdaConf 2018
Blazing Fast, Pure Effects without Monads — LambdaConf 2018Blazing Fast, Pure Effects without Monads — LambdaConf 2018
Blazing Fast, Pure Effects without Monads — LambdaConf 2018
 
Scalaz 8: A Whole New Game
Scalaz 8: A Whole New GameScalaz 8: A Whole New Game
Scalaz 8: A Whole New Game
 
Scalaz 8 vs Akka Actors
Scalaz 8 vs Akka ActorsScalaz 8 vs Akka Actors
Scalaz 8 vs Akka Actors
 
Orthogonal Functional Architecture
Orthogonal Functional ArchitectureOrthogonal Functional Architecture
Orthogonal Functional Architecture
 
The Design of the Scalaz 8 Effect System
The Design of the Scalaz 8 Effect SystemThe Design of the Scalaz 8 Effect System
The Design of the Scalaz 8 Effect System
 
Quark: A Purely-Functional Scala DSL for Data Processing & Analytics
Quark: A Purely-Functional Scala DSL for Data Processing & AnalyticsQuark: A Purely-Functional Scala DSL for Data Processing & Analytics
Quark: A Purely-Functional Scala DSL for Data Processing & Analytics
 
Post-Free: Life After Free Monads
Post-Free: Life After Free MonadsPost-Free: Life After Free Monads
Post-Free: Life After Free Monads
 
Streams for (Co)Free!
Streams for (Co)Free!Streams for (Co)Free!
Streams for (Co)Free!
 
MTL Versus Free
MTL Versus FreeMTL Versus Free
MTL Versus Free
 
The Easy-Peasy-Lemon-Squeezy, Statically-Typed, Purely Functional Programming...
The Easy-Peasy-Lemon-Squeezy, Statically-Typed, Purely Functional Programming...The Easy-Peasy-Lemon-Squeezy, Statically-Typed, Purely Functional Programming...
The Easy-Peasy-Lemon-Squeezy, Statically-Typed, Purely Functional Programming...
 
Halogen: Past, Present, and Future
Halogen: Past, Present, and FutureHalogen: Past, Present, and Future
Halogen: Past, Present, and Future
 

Recently uploaded

My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 

Recently uploaded (20)

My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 

Getting Started with PureScript

  • 2. Agenda • Introduction • What is PureScript • Syntax & Semantics • Who Uses PureScript • Why PureScript • Ecosystem • Getting Started • Node.js • NPM • Bower • PureScript • Pulp • Hello World
  • 3. What is PureScript? PureScript is a strongly-typed, purely-functional programming language that compiles to Javascript1 , and is written in and inspired by Haskell. 1 And C++!
  • 4. Syntax import Control.Apply import Graphics.Canvas.Free scene = filled $ closed do moveTo 0 0 lineTo 50 0 lineTo 25 50 where closed path = beginPath *> path <* closePath filled shape = shape <* fill
  • 5. Semantics • Type Inference • Higher-Kinded Polymorphism • Support for basic Javascript types • Extensible records • Extensible effects • Optimizer rules for generation of efficient Javascript • Pattern matching • Simple FFI • Modules • Rank N Types • Do Notation • Tail-call elimination • Type Classes
  • 6. Who Uses PureScript?2 • SlamData • Xamarin • DICOM Grid • Middlebury Interactive Languages • DICE.fm • McGraw Hill Financial 2 Cobbled together from various online sources.*
  • 7. Why PureScript? Motivation • You want to or are forced to do front-end or node.js • You like static typing • You like functional programming, of the pure variety • You prefer expressive power over no-frills, opinionated simplicity • You want to crush Javascript/CoffeeScript/TypeScript/Scala3 beneath your heel... BWAHAHA! 3 OK, not quite yet.
  • 8. Why PureScript? ..instead of GHCJS? • "Haskell in hindsight" • Strict versus lazy • Zero runtime • Clean, easy FFI • Great re-use of third-party JS • Simpler language than GHC's quadrillion dialects of Haskell
  • 10. Ecosystem UI Libraries • purescript-halogen • purescript-react • purescript-angular • purescript-rx • purescript-flare • purescript-pux • purescript-optic-ui • purescript-behaviors • purescript-signal • purescript-thermite • purescript-frp-rabbit • purescript-sigment • purescript-ufi And even more!
  • 11. Ecosystem Testing Libraries • purescript-test-unit • purescript-quickcheck • purescript-quickcheck-laws • purescript-strongcheck • purescript-benchotron • purescript-spec • purescript-assert
  • 12. Ecosystem Preludes4 • purescript-prelude • purescript-preface • purescript-batteries 4 Yes, there are multiple!
  • 13. Ecosystem Build Tooling • pulp • grunt-purescript • gulp-purescript • purescript-psa
  • 14. Ecosystem Editor / IDE Support • Atom • purescript-contrib/atom-language-purescript • nwolverson/atom-ide-purescript • Emacs • dysinger/purescript-mode • emacs-pe/purescript-mode • ardumont/psci-mode • spion/purscheck • emacs-pe/flycheck-purescript • epost/psc-ide-emacs • Sublime Text 2 - PureScript package • Vim • purescript-vim • FrigoEU/psc-ide-vim • IntelliJ IDEA - ikarienator/pure-idea • Visual Studio - nwolverson/vscode-ide-purescript • General • kRITZCREEK/psc-ide • To generate TAGS files, use psc-docs --format etags (or --format ctags)
  • 16. Getting Started Prerequisites 1. Node.js 2. NPM 3. Bower 4. PureScript 5. Pulp
  • 17. Getting Started Prerequisites: Node.js Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient. Node.js' package ecosystem, npm, is the largest ecosystem of open source libraries in the world. Node.js allows full-featured, browser-less Javascript programs.
  • 18. Getting Started Prerequisites: Node.js • Many Javascript dev tools are written in Javascript and run on Node.js • PureScript dev tools are written in PureScript, compiled to JavaScript • Bottom Line: You can't live without it (even if you want to!).
  • 19. Getting Started Prerequisites: Node.js • Installers https://nodejs.org/en/download/ • Homebrew brew install node • MacPorts port install nodejs • pkgsrc pkgin -y install nodejs • Debian / Ubunutu (4.x) curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash - sudo apt-get install -y nodejs • Debian / Ubuntu (6.x) curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - sudo apt-get install -y nodejs
  • 20. Getting Started Prerequisites: NPM • NPM = Node Package Manager • Used by Node to manage packages • Many tools and libraries are distributed through NPM • Bottom Line: Another thing you can't live without...
  • 21. Getting Started Prerequisites: NPM • NPM comes pre-installed with Node.js but version may be old • Self-Updating NPM: sudo npm install npm -g
  • 22. Getting Started Prerequisites: Bower • A package manager for the web • Maintains global registry of name -> URL • Supports repositories & tags • Supports all types of dependencies (binary, PureScript, etc.) • Dependencies specified in bower.json file • Bottom Line: Almost all PureScript libraries are registered with bower, and almost all PureScript projects maintain dependencies with bower!
  • 23. Getting Started Prerequisites: Bower { "name": "purescript-library", "description": "A PureScript library", "authors": [ "John A. De Goes <john@degoes.net>" ], "license": "Apache 2", "version": "0.1.0", "ignore": [ "**/.*", "node_modules", "bower_components", "output" ], "dependencies": { "purescript-profunctor-lenses": "^1.0.0-rc.1", "purescript-free": "^1.0.0-rc.1", "purescript-console": "^v1.0.0-rc.1", "purescript-either": "^v1.0.0-rc.1", "purescript-maybe": "^1.0.0-rc.1", "purescript-foldable-traversable": "^1.0.0-rc.1", "purescript-monoid": "^1.0.0-rc.2", "purescript-bifunctors": "^1.0.0-rc.1", "purescript-invariant": "^1.0.0-rc.1", "purescript-prelude": "^1.0.0-rc.4", "purescript-control": "^1.0.0-rc.1", "purescript-transformers": "^1.0.0-rc.1" } }
  • 24. Getting Started Prerequisites: Bower • Install with NPM npm install -g bower
  • 25. Getting Started Prerequisites: PureScript Compiler • psc — PureScript compiler • psc-docs — PureScript documentation generator • psc-bundle — Bundler & dead-code eliminator • psci — PureScript Read-Eval-Print-Loop (REPL) • psc-ide-server — IDE Server • psc-ide-client — IDE Client
  • 26. Getting Started Prerequisites: PureScript Compiler • Installers https://github.com/purescript/purescript/releases/latest • Install with NPM npm install -g purescript
  • 27. Getting Started Prerequisites: Pulp • Pulp: Popular build tool for PureScript projects • Knows how to perform magical incantations of psc & related tools • Bottom Line: If you can use it to build your project, then do it!
  • 28. Getting Started Prerequisites: Pulp • Install with NPM npm install -g pulp
  • 29. Getting Started Hello World 1. Create Directory Structure 2. Create Bower File 3. Install Bower Dependencies 4. Write PureScript Main 5. Build & Run
  • 30. Getting Started Hello World: Create Directory Structure bower.json /src/ /Main.purs
  • 31. Getting Started Hello World: Create Bower File { "name": "hello world", "dependencies": { "purescript-console": "^0.1.1", "purescript-eff": "^0.1.2", "purescript-prelude": "^0.1.5" } }
  • 32. Getting Started Hello World: Install Bower Dependencies bower install
  • 33. Getting Started Hello World: Write PureScript Main module Main where import Prelude(Unit) import Control.Monad.Eff (Eff) import Control.Monad.Eff.Console (CONSOLE, log) main :: forall e. Eff (console :: CONSOLE | e) Unit main = do log "Hello World!"
  • 34. Getting Started Hello World: Build & Run pulp build pulp run
  • 35. Congratulations, You've Started Your Journey Into The World of PureScript! Don't Forget the Easy Peasy PureScript Workshop at LambdaConf 2016! More Resources: http://purescript.org