Questions tagged [purescript]

PureScript is a functional language with strong, static types which compiles to JavaScript.

PureScript is a small strongly, statically typed programming language with expressive types, written in and inspired by , and compiling to .

PureScript has a number of interesting features, such as:

  • Type Inference
  • Higher Kinded Polymorphism
  • Support for basic Javascript types
  • Extensible records
  • Extensible effects
  • Optimizer rules for generation of efficient Javascript
  • Pattern matching
  • Simple FFI
  • Modules
  • Rank N Types
  • Do Notation
  • Tail-call elimination
  • Type Classes

Sample "Hello word" :

import Control.Monad.Eff.Console

main = do
    log "Hello, PureScript"

Would be compiled into:

var Control_Monad_Eff_Console = require("Control.Monad.Eff.Console");
var main = Control_Monad_Eff_Console.log("Hello sailor!");
module.exports = {
    main: main
};

References:

591 questions
-1
votes
1 answer

PureScript - Convert a number to an integer?

PureScript contains a method in the Integer library fromNumber. Here is an example of how it might be used: myInteger = fromMaybe 0 (fromNumber myNumber) However the docs provide this puzzling explanation: Creates an Int from a Number value. The…
Code Whisperer
  • 22,959
  • 20
  • 67
  • 85
-1
votes
1 answer

PureScript - fromMaybe does not return the Maybe value

Consider the following simple code example, module Main where import Prelude (discard, Unit, ($)) import Effect (Effect) import Effect.Console (log) import Data.Int ( toStringAs, fromNumber, decimal ) import Data.Maybe ( fromMaybe ) myNumber ::…
Code Whisperer
  • 22,959
  • 20
  • 67
  • 85
-1
votes
1 answer

How do I add an onclick listener in plain Purescript?

I've just started learning Purescript. I'd like to experiment with it in a simple web page. I want to start by learning only plain Purescript and not use any frameworks, such as Halogen or Pux etc. I believe I'll need to use the…
devdanke
  • 1,309
  • 15
  • 27
-1
votes
1 answer

Syntactical issue between order of two functions

Is there any order to be maintained while placing functions one another? I just tried the code on the online compiler provided by purescript.org itself "http://try.purescript.org" module Main where import Prelude import Data.List import Data.Array…
-1
votes
1 answer

Argument list lengths differ in declaration

First day with purescript. Followed these steps pulp repl :paste foo x y z = foo + bar where foo = x + y bar = y + z Get an error Error found: in module $PSCI at line 1, column 1 - line 1, column 14 Argument list lengths differ in…
Knows Not Much
  • 30,395
  • 60
  • 197
  • 373
-1
votes
1 answer

sort an array based on an array of another/different type in haskell or purescript

I have two Arrays of different types, 1) say moduleinfo array which has each element of type {name :: String, pack :: String } and 2) String Array. The simple String array contains element that is similar to the name field of moduleinfo, i.e…
1 2 3
39
40