PureScript
![]() | |
Paradigm | Functional |
---|---|
Designed by | Phil Freeman |
First appeared | 2013 |
Stable release | 0.12.3
/ February 24, 2019 |
Typing discipline | Static, Strong, Inferred |
License | Permissive (Modified BSD License)[1] |
Filename extensions | .purs |
Website | www.purescript.org |
Influenced by | |
Elm, F#, Haskell, Koka, OCaml, Roy, Standard ML |
PureScript is a strongly-typed pure 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
It shares a lot of the features of similar functional languages like Haskell and Elm. I.e. Algebraic data types, pattern matching, immutability, currying, higher kinded types, type classes, higher-rank polymorphism but also includes novel ones like row polymorphism and extensible records.[7]
It 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
![]() | This article or section is in a state of significant expansion or restructuring. You are welcome to assist in its construction by editing it as well. If this article or section has not been edited in several days, please remove this template. If you are the editor who added this template and you are actively editing, please be sure to replace this template with {{in use}} during the active editing session. Click on the link for template parameters to use.
This article was last edited by Elfin hamper (talk | contribs) 5 years ago. (Update timer) |
Applications
![]() | This article or section is in a state of significant expansion or restructuring. You are welcome to assist in its construction by editing it as well. If this article or section has not been edited in several days, please remove this template. If you are the editor who added this template and you are actively editing, please be sure to replace this template with {{in use}} during the active editing session. Click on the link for template parameters to use.
This article was last edited by Elfin hamper (talk | contribs) 5 years ago. (Update timer) |
Future Directions
![]() | This article or section is in a state of significant expansion or restructuring. You are welcome to assist in its construction by editing it as well. If this article or section has not been edited in several days, please remove this template. If you are the editor who added this template and you are actively editing, please be sure to replace this template with {{in use}} during the active editing session. Click on the link for template parameters to use.
This article was last edited by Elfin hamper (talk | contribs) 5 years ago. (Update timer) |
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
- ^ "purescript/purescript". GitHub.
- ^ "PureScript". www.purescript.org. Retrieved 2019-03-14.
- ^ "Read PureScript by Example | Leanpub". leanpub.com. Retrieved 2019-03-14.
- ^ A build tool for PureScript projects, PureScript Contrib, 2019-03-08, retrieved 2019-03-14
- ^ "Pursuit". pursuit.purescript.org. Retrieved 2019-03-14.
- ^ 🍝 PureScript package manager and build tool powered by Dhall and package-sets: spacchetti/spago, spacchetti, 2019-03-14, retrieved 2019-03-14
- ^ Documentation for the PureScript language, compiler, and tools.: purescript/documentation, PureScript, 2019-03-14, retrieved 2019-03-14
- ^ Documentation for the PureScript language, compiler, and tools.: purescript/documentation, PureScript, 2019-03-14, retrieved 2019-03-14