Upgrade to Pro — share decks privately, control downloads, hide ads and more …

PureScript Get Started

wuct
August 02, 2018

PureScript Get Started

Setup the environment, install dependencies and use PureScript REPL to learn types!

wuct

August 02, 2018
Tweet

More Decks by wuct

Other Decks in Programming

Transcript

  1. 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)
  2. 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
  3. 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)
  4. 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
  5. 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