Jump to content

PureScript: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
m Syntax error
Link to relevant pages
Line 14: Line 14:
}}
}}


PureScript is a strongly-typed pure [[Functional_programming|functional]] programming language that compiles to [[JavaScript]]. It can be used to develop web applications, server side apps, and also desktop applications with use of [[Electron (software framework)|Electron]]. Its syntax is mostly comparable to that of [[Haskell (programming language)|Haskell]]. In addition, it introduces [[row polymorphism]] and extensible records.<ref>{{Cite web|url=http://www.purescript.org/|title=PureScript|website=www.purescript.org|access-date=2019-03-14}}</ref> Also, contrary to Haskell, PureScript adheres to a strict [[Evaluation strategy|evaluation strategy]].
PureScript is a [[strongly-typed]], [[Purely_functional_programming|purely-functional]] [[programming language]] that compiles to [[JavaScript]]. It can be used to develop web applications, server side apps, and also desktop applications with use of [[Electron (software framework)|Electron]]. Its syntax is mostly comparable to that of [[Haskell (programming language)|Haskell]]. In addition, it introduces [[row polymorphism]] and extensible records.<ref>{{Cite web|url=http://www.purescript.org/|title=PureScript|website=www.purescript.org|access-date=2019-03-14}}</ref> Also, contrary to Haskell, PureScript adheres to a strict [[Evaluation strategy|evaluation strategy]].


== History ==
== History ==

Revision as of 17:15, 21 April 2019

PureScript
ParadigmFunctional
Designed byPhil Freeman
First appeared2013
Stable release
0.12.5 / April 14, 2019; 5 years ago (2019-04-14)
Typing disciplineStatic, Strong, Inferred
LicensePermissive (Modified BSD License)[1]
Filename extensions.purs
Websitewww.purescript.org
Influenced by
Elm, F#, Haskell, Koka, OCaml, Roy, Standard ML

PureScript is a strongly-typed, purely-functional programming language that compiles to JavaScript. It can be used to develop web applications, server side apps, and also desktop applications with use of Electron. Its syntax is mostly comparable to that of Haskell. In addition, it introduces row polymorphism and extensible records.[2] Also, contrary to Haskell, PureScript adheres to a strict evaluation strategy.

History

PureScript was initially designed by Phil Freeman in 2013. He started to work on PureScript as various attempts to compile Haskell to JavaScript while preserving its semantics (e.g. using Fay, Haste, or GHCJS) didn't work to his satisfaction.[3]

Since then it has been picked up by the community and is developed on GitHub. Additional core tools developed by the community include the dedicated build tool "Pulp"[4], the documentation directory "Pursuit"[5], and the package manager "Spago"[6]

Type System

Code Examples

A "Hello world" program in PureScript could look as follows:

module Main where

import Prelude
import Effect (Effect)
import Effect.Console (log)

main :: Effect Unit
main = do
  log "Hello World!"

Features

The PureScript type system shares many features with those of similar functional languages like Haskell: algebraic data types and pattern matching, higher kinded types, type classes and functional dependencies, and higher-rank polymorphism. Perhaps most notably, PureScript's type system adds support for row polymorphism and extensible records.[7] However, PureScript lacks support for some of the more advanced features of Haskell like GADTs and type families.

PureScript compiles to readable JavaScript code, i.e. unlike other to-JavaScript compilers like Emscripten. Through a simple FFI interface it also allows to reuse existing JavaScript code.[8]

Ecosystem

Applications

Future Directions

See also

  • Elm: A domain-specific programming language for declaratively creating web browser-based graphical user interfaces
  • TypeScript: A strongly-typed programming language that transpiles to JavaScript

References

  1. ^ "purescript/purescript". GitHub.
  2. ^ "PureScript". www.purescript.org. Retrieved 2019-03-14.
  3. ^ "Read PureScript by Example | Leanpub". leanpub.com. Retrieved 2019-03-14.
  4. ^ A build tool for PureScript projects, PureScript Contrib, 2019-03-08, retrieved 2019-03-14
  5. ^ "Pursuit". pursuit.purescript.org. Retrieved 2019-03-14.
  6. ^ 🍝 PureScript package manager and build tool powered by Dhall and package-sets: spacchetti/spago, spacchetti, 2019-03-14, retrieved 2019-03-14
  7. ^ Documentation for the PureScript language, compiler, and tools.: purescript/documentation, PureScript, 2019-03-14, retrieved 2019-03-14
  8. ^ Documentation for the PureScript language, compiler, and tools.: purescript/documentation, PureScript, 2019-03-14, retrieved 2019-03-14