Welcome to EverybodyWiki ! Nuvola apps kgpg.png Sign in or create an account to improve, watchlist or create an article like a company page or a bio (yours ?)...

PureScript

From EverybodyWiki Bios & Wiki
Jump to navigation Jump to search




PureScript
PureScript Logo.png
ParadigmFunctional
Designed byPhil Freeman
First appeared2013
Stable release
0.13.0 / May 30, 2019; 6 months ago (2019-05-30)
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[edit | edit source]

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]


Features[edit | edit source]

PureScript features strict evaluation, persistent data structures and type inference. 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. 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.

The PureScript compiler attempts to produce readable JavaScript code, where possible. Through a simple FFI interface it also allows the reuse of existing JavaScript code.[8]

PureScript supports incremental compilation, and the compiler distribution includes support for building source code editor plugins for iterative development[9]. Editor plugins exist for many popular text editors, including Vim, Emacs, Sublime Text, Atom and Visual Studio Code.

Code Examples[edit | edit source]

Here is a minimal "Hello world" program in PureScript:

1 module Main where
2 
3 import Effect.Console (log)
4 
5 main = log "Hello World!"

Here, the type of the program is inferred and checked by the PureScript compiler. A more verbose version of the same program might include explicit type annotations:

1 module Main where
2 
3 import Prelude
4 
5 import Effect (Effect)
6 import Effect.Console (log)
7 
8 main :: Effect Unit
9 main = log "Hello World!"

See also[edit | edit source]


Others articles of the Topic Free and open-source software : Project Kenai, KPDF, Lobsters (website), Uftp-server, Twisted (software), Apache Commons DbUtils, Vertcoin
Some use of "" in your query was not closed by a matching "".Some use of "" in your query was not closed by a matching "".

  • 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[edit | edit source]

  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
  9. purs ide: Editor and tooling support for the PureScript programming language, 2019-04-21, retrieved 2019-04-21

External links[edit | edit source]


This article "PureScript" is from Wikipedia. The list of its authors can be seen in its historical and/or the page Edithistory:PureScript. Articles copied from Draft Namespace on Wikipedia could be seen on the Draft Namespace of Wikipedia and not main one.



Compte Twitter EverybodyWiki Follow us on https://twitter.com/EverybodyWiki !