Software is about writing
correct and understandable code,
and keeping it that way.

 

  • JavaScript makes writing correct software hard
  • HTML/DOM is slow and bloated
  • CSS Box Model is difficult to maintain

 

For simple pages, browsers are great.

For applications, browsers are a clusterfuck.

Pure Functional 

Options

  • UHC and GHCjs

  • Roy LambdaScript jshaskell

  • Haste

  • Fay

  • Elm

PRAGMATIC

Types make sense for the JavaScript runtime and surrounding ecosystem.

 

Reasonable, minimal and readable code footprint.

 

Legitimate language in its own right, with benefits beyond Haskell.

MaTURING

Constantly growing tools and resources:

  • REPL
  • PURSuit
  • Gulp & Grunt
  • Doc Generator
  • Language Documentation
  • PureScript by Example
  • FreeNode #purescript

 

Phil Freeman is extremely responsive.

ACTIVE

Standard

  • Control

  • Tuples

  • Monoid

  • Maybe

  • Either

  • Arrays

  • Foreign

  • Strings

  • Foldable Traversable

 

  • Validation

  • QuickCheck

  • Exceptions

  • Refs

  • Random

  • Math

  • Enums

Contrib

  • Linked Lists

  • Free Monads

  • Yaml

  • Transformers

  • Lens

  • Maps

  • Canvas

  • Node-fs

  • React

  • Generics

 

  • Mocha

  • Chai

  • Timers

  • Arrows

  • Yoneda

  • Unfoldable

  • yargs

  • jQuery

  • Lazy

  • BiFunctors

 

  • Distrubtive

  • Const

  • Parsing

  • History

  • Events

  • DateTime

  • Contravariant

  • ProFunctor

  • Streams

  • ...

Haskell comparision 

Similarities

  • Referential Transparency

  • Monadic IO

  • Curried by default

  • User-defined infix operators

  • Do Notation

  • Pattern Matching

  • Type Classes

Differences

  • Strict Evaluation

  • Extensible records

  • No tuples
    (as a language feature)

  • Simplified syntax

  • No GADTs, Type Families

Extensible Effects

getAge      :: IO Int
getName     :: IO String
showCompare :: Int -> String -> Boolean

showCompare <$> getName <*> getAge :: IO Boolean
getAge      :: forall e. Eff (network :: Network | e) Number
getName     :: forall e. Eff (fileSystem :: FileSystem | e) String
showCompare :: Number -> String -> Boolean

showCompare <$> getName <*> getAge :: forall e. Eff (network :: Network, fileSystem :: FileSystem | e) Boolean

Simplified type classes

class Monoid a where
  mempty  :: a
  mappend :: a -> a -> a
  mconcat :: [a] -> a
  mconcat = foldr mappend mempty

(<>) :: Monoid M => m -> m -> m
(<>) = mappend

class SemiGroup a where
  (.++.) :: a -> a -> a
class Semigroup a where
  (<>) :: a -> a -> a

class (Semigroup m) <= Monoid m where
  mempty :: m

Kinds and ffi

data Foo a = Foo a

1             :: *
"hello world" :: *
Foo           :: * -> *
IO            :: * -> *

data Foo a = Foo a

1             :: *
"hello world" :: *
Foo           :: * -> *
Eff           :: # ! -> * -> *

!    for Effects

#   for Rows (extensible records in the type system)

foreign import data Ajax :: !

foreign import getData """
  function getData(url){
    return function(fn){
      return function(){
        $.get(url, fn);
      };      
    };
  } """ :: forall a b e. String -> (a -> Eff (ajax :: Ajax | e) b) -> Eff (ajax :: Ajax | e) Unit

Purescript has its disadvantages

  • There is a performance tax
     
  • The JavaScript eco-system has good stuff without PureScript bindings
     
  • Writing code for JavaScript consumption, and unaccessible ES6 features

POLYGLOT Web

Mainstream

  • JavaScript
  • CoffeeScript
  • Harmony
  • TypeScript

ALTERNATIVES

  • CoffeeScript derivatives
  • GWT
  • Dead transpilers for every imaginable language infinity and beyond

My preference for PureScript's Neighbor is LiveScript

PURESCRIPT

By fresheyeball

PURESCRIPT

  • 730