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
4
votes
1 answer

Error installing purescript-list

I'm new to Purescript and am following the tutorial for installation. Purescript itself is working and I can start the CLI using pulp psci, but installing purescript-list runs into trouble. Having entered the command bower install purescript-lists…
Chris W
  • 289
  • 1
  • 12
4
votes
3 answers

Setting up a Purescript Enviornment

So I'm looking to play around with Purescript, but I haven't been able to get over this hump of actually setting up an enviornment to start playing in. Seems like most references on the subject are out of date at this point as well. Anyhow, I've…
Tshimanga
  • 845
  • 6
  • 16
4
votes
3 answers

How do you present any data type to the user with PureScript?

I want to make a very human-friendly development environment, and I'm considering using PureScript to provide the language part. I see that out of the box, Show doesn't work on records of things which are instances of Show: log (show {a:5}) The…
Christopher Done
  • 5,886
  • 4
  • 35
  • 38
4
votes
2 answers

Appropriate abstraction in lieu of heterogenous (but shared-class) list?

The Problem I'm trying to write a game engine in PureScript. I'm new to it, but learning has been smooth since I've previously gone through Real World Haskell (though I haven't much experience using Haskell for "real" things, either). Anything that…
Micah Cowan
  • 128
  • 5
4
votes
1 answer

(Purescript) How do I pattern match on an algebraic data type that is the "empty type"

I'm working with the following algebraic data type in PureScript... data Extended a = Infinite | Finite a v1 = Finite 11 v2 = Infinite I'm having trouble figuring out how to pattern match the "Infinite" case, since it appears that v2 has type…
Albtzrly
  • 924
  • 1
  • 6
  • 15
4
votes
1 answer

Testing purescript functions in jsPerf

I would like to compare the performance of two PureScript functions in jsPerf. What compilation do I need to do and what parts do I need to put in 'setup' and each snippet box? Using psc or pulp.
leighman
  • 191
  • 6
4
votes
3 answers

Are constraints possible for new types in Purescript?

Is it possible to put certain constraints on the type constructor in Purescript? For example: newtype Name = Name String -- where length of String is > 5
dgo.a
  • 2,634
  • 23
  • 35
4
votes
1 answer

Polymorphic instruction in Free Monad in Purescript

I'm trying to get this small piece of code to compile. module Sodium where import Prelude import Control.Monad.Free import Data.Coyoneda import Data.Tuple data ReactiveF more = RFNewEvent (forall a. (Tuple (Event a) (a -> Reactive Unit) ->…
clinux
  • 2,984
  • 2
  • 23
  • 26
4
votes
3 answers

Unknown module Data.List in psci

I installed purescript with brew $ brew install purescript No problems there. when i boot up the PSCI repl and do this: import Data.List I get Error in module $PSCI: Unknown module Data.List What am i doing wrong? UPDATE I started up psci with…
dopatraman
  • 13,416
  • 29
  • 90
  • 154
4
votes
2 answers

How to use setTimeout in PureScript v0.7

I want to use setTimeout for animation in PureScript like this. loop n = if n > 100 then do return Unit else do print n timeout (loop n+1) 30 purescript-timers is no longer work in v0.7. I don't have the slightest idea how to…
4
votes
1 answer

Is tacit programming possible in Purescript?

Is tacit programming also known as point-free style see e.g. http://en.wikipedia.org/wiki/Tacit_programming an option in Purescript?
v217
  • 765
  • 1
  • 6
  • 17
4
votes
1 answer

PureScript type system name

What is the proper academic name for the type system used in PureScript? I am looking for papers about that and proofs that it is sound. In particular, as the type system allows to solve the exception as hidden communication channel problem when one…
Igor Bukanov
  • 4,636
  • 3
  • 16
  • 23
4
votes
1 answer

How is the newline, tab characters represented in purescript?

For eg. How do I print out something like this: showEntry entry = entry.lastName ++ "\t" ++ entry.firstName ++ "\t" ++ entry.phone print(showEntry {lastName: 'Doe', firstName: 'John', phone: '555-555-5555'}) This…
4
votes
1 answer

Writing composable asynchronous monads from ffi

Right now I have an async function that works something like this: foo = do ayncGetNumber "/numberLocation" \a -> (trace <<< show) a but this callback style is not composable (to my understanding), i would like it to work like…
Fresheyeball
  • 29,567
  • 20
  • 102
  • 164
4
votes
1 answer

PureScript does not compose `trace` and `show`

So the following works main = do trace $ show $ 5 but this does not main = do (trace . show) 5 in psci the type of trace is forall r. Prim.String -> Control.Monad.Eff.Eff (trace :: Debug.Trace.Trace | r) Prelude.Unit and the type of…
Fresheyeball
  • 29,567
  • 20
  • 102
  • 164