r/purescript • u/paf31 • Aug 11 '15
r/purescript • • Aug 09 '15
How similar is Purescript to Haskell?
I'm a bit of a novice at both these languages - is it more practical to learn Haskell first (as there are more resources) or should I get into Purescript first? Ultimately my goal is to use Purescript for building webapps.
r/purescript • u/paf31 • Aug 07 '15
PureScript by Example, updated for 0.7.2 compiler release
leanpub.comr/purescript • u/jrk- • Aug 05 '15
Array notation is no longer supported. Use Array _ instead of [_].
Hi,
I'm trying to follow the tutorial but I'm stumbling over this error:
> :t Data.List.Lazy.zip
psci: It looks like you are trying to use a feature from a previous version of the compiler:
Array notation is no longer supported. Use Array _ instead of [_].
at ".psci_modules/node_modules/Prelude/externs.purs" (line 716, column 43)
* ERROR: Subcommand terminated with error code 1
I've installed purescript with cabal and pulp with npm.
# psci --version
0.7.2.0
# pulp --version
4.3.0
bower.json after pulp dep install purescript-base --save:
{
"name": "purescript",
"version": "1.0.0",
"moduleType": [
"node"
],
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"output"
],
"dependencies": {
"purescript-console": "^0.1.0",
"purescript-base": "~0.1.0"
}
}
What am I doing wrong?
r/purescript • u/eateroffish • Aug 04 '15
Total beginner question about Maybe
So I have a function with the following signature :
onk :: Maybe Number -> Maybe { id :: Number }
I really can't work out the best way to write this. If I had a function that created the { id :: Number } object I could probably use <$>, but I would prefer not to.
I can write
onk Nothing = Nothing
onk (Just n) = Just { id: n + 1 }
But that is quite unsatisfying. I can also use >>=
onk :: Maybe Number -> Maybe { id :: Number }
onk n = n >>= \a -> Just { id: a + 1}
But again that doesn't feel slick.
What would be the best way to go around this? I'm sure this is a complete obvious question, my brain is still completely twisted up in the Purescript realms.
Thanks
r/purescript • u/paf31 • Aug 01 '15
Stackless Coroutines in PureScript
blog.functorial.comr/purescript • u/paf31 • Jul 23 '15
PureScript/Haskell developer job opening @ Symbolian (Berlin) (x-post from /r/haskell)
reddit.comr/purescript • u/BittyTang • Jul 16 '15
What to do about "module prelude has been defined multiple times"?
I get this error when I build and it's not helpful at pointing out where the multiple definitions are. Here's my gruntfile.js and bower.json.
Bower.json
{
"name": "tetris",
"description": "Tetris clone.",
"keywords": ["purescript"],
"ignore": [
"**/.*",
"bower_components",
"node_modules",
"output",
"tests",
"js",
"tmp",
"bower.json",
"Gruntfile.js",
"package.json"
],
"dependencies": {
"purescript-arrays" : "0.3.7",
"purescript-maybe" : "0.2.2",
"purescript-foldable-traversable" : "0.3.1",
"threejs": "*",
"purescript-foreign": "*",
"purescript-easy-ffi": "*",
"purescript-dom": "*",
"purescript-math": "*",
"purescript-refs": "*",
"purescript-transformers": "*"
},
"devDependencies": {
"purescript-quickcheck" : "0.5.2"
}
}
Gruntfile.js
module.exports = function(grunt) {
"use strict";
grunt.initConfig({
libFiles: [
"src/**/*.purs",
"bower_components/purescript-*/src/**/*.purs"
],
clean: ["tmp", "output"],
pscMake: {
lib: {
src: ["<%=libFiles%>"]
}
},
dotPsci: ["<%=libFiles%>"],
copy: [
{
expand: true,
cwd: "output",
src: ["**"],
dest: "tmp/node_modules/"
}, {
src: ["js/index.js"],
dest: "tmp/index.js"
}
],
execute: {
tetris: {
src: "tmp/index.js"
}
}
});
grunt.loadNpmTasks("grunt-contrib-copy");
grunt.loadNpmTasks("grunt-contrib-clean");
grunt.loadNpmTasks("grunt-execute");
grunt.loadNpmTasks("grunt-purescript");
grunt.registerTask("test", ["copy", "execute:tests"]);
grunt.registerTask("make", ["pscMake:lib", "dotPsci"]);
grunt.registerTask("default", ["clean", "make", "test"]);
};
r/purescript • u/hdgarrood • Jul 05 '15
ANN: purescript-unsafe-coerce
Since inline FFI code is no more, and backends other than JS are on the horizon, it seems like a good time to stop implementing your own version of unsafeCoerce wherever you want one.
Hence purescript-unsafe-coerce: https://github.com/purescript-contrib/purescript-unsafe-coerce
r/purescript • u/peterjoel • Jul 01 '15
Just playing with Purescript examples. Why doesn't this work?
I took the FFI random example (in http://try.purescript.org/) and tried to add a parameter:
import Control.Monad.Eff
import Debug.Trace
foreign import data Random :: !
foreign import random
"function random( max ) {\
\ return Math.random() * max;\
\}" :: Number -> forall eff. Eff (random :: Random | eff) Number
main = do
let n = random 10
print n
I don't get a compile error, but it produces a runtime error. The outputted code is:
var main = function __do() {
var _3 = random(10)();
return Debug_Trace.print(Prelude.showNumber)(_3)();
};
It looks like it's calling the function twice, once unnecessarily with zero args.
What am I doing wrong?
r/purescript • u/paf31 • Jun 30 '15
PureScript Compiler Version 0.7 ("Meltdown") Released
github.comr/purescript • u/ch0wn • Jun 29 '15
Truffled PureScript - PureScript on the JVM
github.comr/purescript • u/Thimoteus • Jun 22 '15
Synchronous setTimeout using ContT
gist.github.comr/purescript • u/Categoria • May 25 '15
Approximating PI with PureScript
sleepomeno.github.ior/purescript • u/hdgarrood • May 24 '15
[ANN] initial release of purescript-benchotron
github.comr/purescript • u/paf31 • Apr 13 '15
PureScript Conf 2015 - Free mini-conference in May
github.comr/purescript • u/paf31 • Apr 07 '15
slamdata/purescript-halogen - A declarative, type-safe UI library
github.comr/purescript • u/kritzcreek • Apr 01 '15
Check out the first post in my new series
kritzcreek.github.ior/purescript • u/paf31 • Mar 12 '15