├── README.md ├── docs ├── .gitignore ├── 0.11.7-to-0.12.0.md ├── Makefile ├── _static │ └── css │ │ └── default.css ├── azure-pipelines.md ├── blogs.md ├── collections.md ├── community.md ├── conf.py ├── databases.md ├── datatype-generics.md ├── default.nix ├── eff-to-effect.md ├── elm-like.md ├── etc.md ├── ffi.md ├── http-requests.md ├── index.rst ├── installation.md ├── intro.md ├── json.md ├── nix.md ├── node-backends.md ├── non-pulp.md ├── psc-package.md ├── spacchetti.md ├── testing.md ├── travis.md ├── typelevel-programming.md └── ui.md └── purs-install.bash /README.md: -------------------------------------------------------------------------------- 1 | # PureScript Resources 2 | 3 | This is a collection of notes and links to resources to learn and use PureScript as generally recommended by me. This is all biased information. Think of it as "awesome-how-to-purescript" that isn't just a link farm. 4 | 5 | This guide contains a lot of 🌶️. If you'd like to have something changed or explained more, make a PR or an issue. 6 | 7 | There is another resources page out there that you might look at here: 8 | 9 | -------------------------------------------------------------------------------- /docs/.gitignore: -------------------------------------------------------------------------------- 1 | _build 2 | -------------------------------------------------------------------------------- /docs/0.11.7-to-0.12.0.md: -------------------------------------------------------------------------------- 1 | # 0.11.7 to 0.12.0 2 | 3 | There are very few changes needed to be made to upgrade to 0.12.0. 4 | 5 | Below from 6 | 7 | ---------- 8 | 9 | There are some changes you will need to make for most applications to be upgraded to PureScript 0.12. With some usage of editor commands, you should be able to convert any 20K LOC codebase in less than an hour. 10 | 11 | ## Libraries 12 | 13 | * Remove `eff`, install `effect` 14 | * Remove `dom` and `dom-*`, use `web-dom` and such from [purescript-web](https://github.com/purescript-web). Use type holes (`?whatmethod`) to discover new APIs 15 | * Remove `maps`, install `ordered-collections` for Map/Set/etc. and `foreign-object` for `StrMap` 16 | 17 | ## Changes 18 | 19 | * `Eff (fx :: # Type) a` -> `Effect a` 20 | * `Aff (fx :: # Type) a` -> `Aff a` 21 | * `Control.Monad.Effect` -> `Effect` 22 | * `id` -> `identity` 23 | * `Data.Record` -> `Record` 24 | * `Data.StrMap` -> `Foreign.Object` 25 | * `Data.Foreign` -> `Foreign` 26 | 27 | ## Updating libraries 28 | 29 | * Use a newer package set or use `ncu -uam bower` via [npm-check-updates](https://www.npmjs.com/package/npm-check-updates) 30 | * If you want a package set that is actively maintained by me, see 31 | 32 | ## General 33 | 34 | * Use `psc-package build -d` or `pulp build --src-path some-empty-folder` if you want to only build dependencies first (you should) 35 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | SPHINXPROJ = PureScript-Resources 8 | SOURCEDIR = . 9 | BUILDDIR = _build 10 | 11 | # Put it first so that "make" without argument is like "make help". 12 | help: 13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 14 | 15 | .PHONY: help Makefile 16 | 17 | # Catch-all target: route all unknown targets to Sphinx using the new 18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 19 | %: Makefile 20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 21 | -------------------------------------------------------------------------------- /docs/_static/css/default.css: -------------------------------------------------------------------------------- 1 | .rst-content pre.literal-block,.rst-content div[class^='highlight'] pre,.rst-content .linenodiv pre { 2 | font-family: SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",Courier,monospace; 3 | font-size: 14px; 4 | line-height: 1.5; 5 | } 6 | -------------------------------------------------------------------------------- /docs/azure-pipelines.md: -------------------------------------------------------------------------------- 1 | # Azure Pipelines CI 2 | 3 | Azure Pipelines works surprisingly well, with no hacks needed to get things going. 4 | 5 | ## Example config 6 | 7 | ```yaml 8 | 9 | pool: 10 | vmImage: 'Ubuntu 16.04' 11 | 12 | steps: 13 | - script: | 14 | PURESCRIPT_TAG=v0.12.0 15 | PSC_PACKAGE_TAG=v0.3.2 16 | 17 | PURESCRIPT=https://github.com/purescript/purescript/releases/download/$PURESCRIPT_TAG/linux64.tar.gz 18 | PSC_PACKAGE=https://github.com/purescript/psc-package/releases/download/$PSC_PACKAGE_TAG/linux64.tar.gz 19 | 20 | wget -O $HOME/purescript.tar.gz $PURESCRIPT 21 | wget -O $HOME/psc-package.tar.gz $PSC_PACKAGE 22 | 23 | tar -xvf $HOME/psc-package.tar.gz -C $HOME/ 24 | tar -xvf $HOME/purescript.tar.gz -C $HOME/ 25 | 26 | mv $HOME/purescript/* $HOME/bin 27 | mv $HOME/psc-package/* $HOME/bin 28 | 29 | chmod a+x $HOME/bin 30 | displayName: 'Install deps' 31 | - script: | 32 | export PATH=./bin:$HOME/bin:$PATH 33 | 34 | which purs 35 | which psc-package 36 | 37 | make 38 | displayName: 'Make' 39 | ``` 40 | 41 | If you don't mind using npm: 42 | 43 | ```yaml 44 | pool: 45 | vmImage: 'Ubuntu 16.04' 46 | 47 | steps: 48 | - script: | 49 | export PATH=~/.npm/bin:$PATH 50 | npm set prefix ~/.npm 51 | npm i -g purescript psc-package-bin-simple 52 | make setup-only 53 | psc-package verify 54 | displayName: 'Install deps and run' 55 | ``` 56 | 57 | From and 58 | -------------------------------------------------------------------------------- /docs/blogs.md: -------------------------------------------------------------------------------- 1 | # Blogs 2 | 3 | I write the most out of anyone, and my posts are in a repo here: 4 | 5 | Also see the subreddit for other posts: 6 | -------------------------------------------------------------------------------- /docs/collections.md: -------------------------------------------------------------------------------- 1 | # Collections 2 | 3 | ## Arrays, Lists 4 | 5 | Use the libraries for extra functions on arrays and the List structure. 6 | 7 | ## Foreign-Object 8 | 9 | For working with JS Objects as String-keyed Maps, see this library. 10 | 11 | ## Ordered Collections 12 | 13 | For working with collections in general. 14 | -------------------------------------------------------------------------------- /docs/community.md: -------------------------------------------------------------------------------- 1 | # Community 2 | 3 | How to actually talk to people in PureScript: 4 | 5 | * FP Slack: #purescript/#purescript-beginners 6 | * Discourse: 7 | * Reddit: 8 | -------------------------------------------------------------------------------- /docs/conf.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # Configuration file for the Sphinx documentation builder. 4 | # 5 | # This file does only contain a selection of the most common options. For a 6 | # full list see the documentation: 7 | # http://www.sphinx-doc.org/en/master/config 8 | 9 | # -- Path setup -------------------------------------------------------------- 10 | 11 | # If extensions (or modules to document with autodoc) are in another directory, 12 | # add these directories to sys.path here. If the directory is relative to the 13 | # documentation root, use os.path.abspath to make it absolute, like shown here. 14 | # 15 | # import os 16 | # import sys 17 | # sys.path.insert(0, os.path.abspath('.')) 18 | 19 | 20 | # -- Project information ----------------------------------------------------- 21 | 22 | project = u'PureScript-Resources' 23 | copyright = u'2018, Justin Woo' 24 | author = u'Justin Woo' 25 | 26 | # The short X.Y version 27 | version = u'' 28 | # The full version, including alpha/beta/rc tags 29 | release = u'' 30 | 31 | 32 | # -- General configuration --------------------------------------------------- 33 | 34 | # If your documentation needs a minimal Sphinx version, state it here. 35 | # 36 | # needs_sphinx = '1.0' 37 | 38 | # Add any Sphinx extension module names here, as strings. They can be 39 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom 40 | # ones. 41 | extensions = [ 42 | ] 43 | 44 | # Add any paths that contain templates here, relative to this directory. 45 | templates_path = ['_templates'] 46 | 47 | source_parsers = { 48 | '.md': 'recommonmark.parser.CommonMarkParser', 49 | } 50 | 51 | # The suffix(es) of source filenames. 52 | # You can specify multiple suffix as a list of string: 53 | # 54 | source_suffix = ['.rst', '.md'] 55 | 56 | # The master toctree document. 57 | master_doc = 'index' 58 | 59 | # The language for content autogenerated by Sphinx. Refer to documentation 60 | # for a list of supported languages. 61 | # 62 | # This is also used if you do content translation via gettext catalogs. 63 | # Usually you set "language" from the command line for these cases. 64 | language = None 65 | 66 | # List of patterns, relative to source directory, that match files and 67 | # directories to ignore when looking for source files. 68 | # This pattern also affects html_static_path and html_extra_path . 69 | exclude_patterns = [u'_build', 'Thumbs.db', '.DS_Store'] 70 | 71 | # The name of the Pygments (syntax highlighting) style to use. 72 | pygments_style = 'default' 73 | 74 | 75 | # -- Options for HTML output ------------------------------------------------- 76 | 77 | # The theme to use for HTML and HTML Help pages. See the documentation for 78 | # a list of builtin themes. 79 | # 80 | html_theme = 'sphinx_rtd_theme' 81 | 82 | # Theme options are theme-specific and customize the look and feel of a theme 83 | # further. For a list of options available for each theme, see the 84 | # documentation. 85 | # 86 | # html_theme_options = {} 87 | 88 | # Add any paths that contain custom static files (such as style sheets) here, 89 | # relative to this directory. They are copied after the builtin static files, 90 | # so a file named "default.css" will overwrite the builtin "default.css". 91 | html_static_path = ['_static'] 92 | 93 | # Custom sidebar templates, must be a dictionary that maps document names 94 | # to template names. 95 | # 96 | # The default sidebars (for documents that don't match any pattern) are 97 | # defined by theme itself. Builtin themes are using these templates by 98 | # default: ``['localtoc.html', 'relations.html', 'sourcelink.html', 99 | # 'searchbox.html']``. 100 | # 101 | # html_sidebars = {} 102 | 103 | 104 | # -- Options for HTMLHelp output --------------------------------------------- 105 | 106 | # Output file base name for HTML help builder. 107 | htmlhelp_basename = 'PureScript-Resourcesdoc' 108 | 109 | 110 | # -- Options for LaTeX output ------------------------------------------------ 111 | 112 | latex_elements = { 113 | # The paper size ('letterpaper' or 'a4paper'). 114 | # 115 | # 'papersize': 'letterpaper', 116 | 117 | # The font size ('10pt', '11pt' or '12pt'). 118 | # 119 | # 'pointsize': '10pt', 120 | 121 | # Additional stuff for the LaTeX preamble. 122 | # 123 | # 'preamble': '', 124 | 125 | # Latex figure (float) alignment 126 | # 127 | # 'figure_align': 'htbp', 128 | } 129 | 130 | # Grouping the document tree into LaTeX files. List of tuples 131 | # (source start file, target name, title, 132 | # author, documentclass [howto, manual, or own class]). 133 | latex_documents = [ 134 | (master_doc, 'PureScript-Resources.tex', u'PureScript-Resources Documentation', 135 | u'Justin Woo', 'manual'), 136 | ] 137 | 138 | 139 | # -- Options for manual page output ------------------------------------------ 140 | 141 | # One entry per manual page. List of tuples 142 | # (source start file, name, description, authors, manual section). 143 | man_pages = [ 144 | (master_doc, 'purescript-resources', u'PureScript-Resources Documentation', 145 | [author], 1) 146 | ] 147 | 148 | 149 | # -- Options for Texinfo output ---------------------------------------------- 150 | 151 | # Grouping the document tree into Texinfo files. List of tuples 152 | # (source start file, target name, title, author, 153 | # dir menu entry, description, category) 154 | texinfo_documents = [ 155 | (master_doc, 'PureScript-Resources', u'PureScript-Resources Documentation', 156 | author, 'PureScript-Resources', 'One line description of project.', 157 | 'Miscellaneous'), 158 | ] 159 | 160 | def setup(app): 161 | app.add_stylesheet('css/default.css') 162 | -------------------------------------------------------------------------------- /docs/databases.md: -------------------------------------------------------------------------------- 1 | # Databases 2 | 3 | If you're really going to write a backend in PureScript (like on AWS Lambda and other such offerings), you probably need to talk to a database. 4 | 5 | ## General 6 | 7 | Generally, you should learn how to use FFI and bind to the database you actually want to use, then start thinking about how libraries like Simple-JSON can help you decode results from databases. 8 | 9 | Once you learn how to use FFI, you will not need anyone else to provide you a library. This is a large part of the reason why many production users of PureScript on Node do not contribute libraries back to the ecosystem, as they make small interfaces to libraries that they build on top of that contain many assumptions. 10 | 11 | ### Warning 12 | 13 | If you see a library that contains a `ReadForeign`, `IsForeign`, or `Decode` constraint, you should probably not use that library, as this is a clear sign of someone imposing a specific combination of libraries on you. 14 | 15 | ## SQLite3 16 | 17 | I wrote this library and it provides a wrapper for node-sqlite3. I use this personally, and have been using it for over two years. 18 | 19 | 20 | 21 | ## Postgres 22 | 23 | I use this sometimes, like at work. You can use this if you want, or just make your own wrapper for pg. 24 | 25 | 26 | -------------------------------------------------------------------------------- /docs/datatype-generics.md: -------------------------------------------------------------------------------- 1 | # Datatype Generics via Generics-Rep 2 | 3 | If you've ever wanted to work with information about your data types in terms of generic types and representations that can be converted to and from, this is exactly what you've been looking for: 4 | 5 | Here is a tutorial on Generics-Rep in the Simple-JSON docs: 6 | 7 | For much more detailed information, refer to the GHC User guide and the Haskell generic-deriving library docs 8 | -------------------------------------------------------------------------------- /docs/default.nix: -------------------------------------------------------------------------------- 1 | { pkgs ? import {} }: 2 | 3 | let 4 | buildInputs = builtins.attrValues { 5 | inherit (pkgs.pythonPackages) 6 | sphinx 7 | sphinx_rtd_theme 8 | recommonmark; 9 | }; 10 | in pkgs.stdenv.mkDerivation { 11 | name = "spacchetti-docs"; 12 | buildInputs = buildInputs; 13 | } 14 | -------------------------------------------------------------------------------- /docs/eff-to-effect.md: -------------------------------------------------------------------------------- 1 | # "Why did PureScript go from Eff to Effect?" 2 | 3 | There are quite many ill-informed "takes" on PureScript's switch from Eff with row types to Effect. This page serves to provide a **minimum** reading list for one to become familiar with the subject. If you just hate PureScript, there are [alternatives](http://www.typescriptlang.org/) you can use without having to learn about different ways to represent effects. 4 | 5 | There are various resources you can check about this: 6 | 7 | * 8 | * 9 | * 10 | 11 | Eff rows were not sufficiently useful in terms of actually guaranteeing what effects were run in a given `Eff row`, and the attempts to track possible exceptions were poor. In addition, these led to many problems with users not knowing how to solve type errors with unification of effect rows. 12 | 13 | If you want to actually track effects, find some reading about MTL, Free, Tagless Final, and also read through for an implementation of extensible, algebraic effects for PureScript. 14 | 15 | If you want an example of an approach where you can work with known errors, read through 16 | 17 | ## "There was a huge rewrite to go from Eff to Effect" 18 | 19 | There was little involved other than for renaming. 20 | 21 | 22 | 23 | ## "It's hard to go from Eff to Effect" 24 | 25 | Unless you already used many tricks to encode extra information by creating types of kind `Type -> Effect`, there are only renaming changes involved. 26 | 27 | 28 | 29 | ## "Eff to Effect was decided by Twitter poll" 30 | 31 | See links above, and then see the actual poll and thread of explanations: 32 | 33 | ### "But the result of the poll isn't vastly positive" 34 | 35 | How much did you have faith in Twitter polls anyway? 36 | -------------------------------------------------------------------------------- /docs/elm-like.md: -------------------------------------------------------------------------------- 1 | # Elm-likes 2 | 3 | ## "I mostly need query-updater-html functions" 4 | 5 | Use Halogen with one component, then add a few more whenever you find something that makes sense as a component. Or try to jerry-rig some web components setup. 6 | 7 | ## Hedwig 8 | 9 | Another library that presents you a fairly Elm-like experience 10 | 11 | ## Spork 12 | 13 | For an up to date Elm-like that is performant, you should look at 14 | 15 | ## Pux 16 | 17 | Even though Pux is well-known, I do not recommend it because of various usability issues, overwhelming performance issues, and lack of maintenance. It also does not actually provide React interop, so if you want React interop, you should use 18 | 19 | If you're new to PureScript and frustrated with Pux, that's completely understandable as it is quite frustrating to work with. Try some of these other options or try using more FFI to do things you want. 20 | -------------------------------------------------------------------------------- /docs/etc.md: -------------------------------------------------------------------------------- 1 | # Etc 2 | 3 | ## Where are union types from TypeScript? 4 | 5 | First, you should read some useful information from Typed Racket to learn how union types and occurence typing work: 6 | 7 | * 8 | * 9 | 10 | Once you have read through these, you will want to use 11 | 12 | * Regular sum types, where occurence typing is replaced by pattern matching 13 | * Polymorphic Variants via 14 | * Some other approximation by first using Foreign types to safely read to types you want to use 15 | 16 | If you fully understand the above and you're looking for a challenge, try taking a look at the implementation the associated blog post here: 17 | -------------------------------------------------------------------------------- /docs/ffi.md: -------------------------------------------------------------------------------- 1 | # FFI 2 | 3 | I wrote about this in a blog post called ["User empowerment of FFI in PureScript"](https://qiita.com/kimagure/items/0ce4d9d2792dd110ee45) 4 | 5 | You should read these links at minimum: 6 | 7 | * PureScript language FFI documentation 8 | * PureScript documentation guide on FFI 9 | * PureScript-Effect uncurried function documentation 10 | 11 | I have some examples of various ways of doing FFI here: 12 | 13 | ## "What if I need to validate inputs from FFI?" 14 | 15 | Use the `Foreign` type from the `purescript-foreign` library and see the next section, which is not only about JSON but also about foreign JS values. 16 | -------------------------------------------------------------------------------- /docs/http-requests.md: -------------------------------------------------------------------------------- 1 | # HTTP Requests 2 | 3 | I only use libraries that use Aff for requests. Here are the two libraries I actually use: 4 | 5 | ## Milkis 6 | 7 | I made this library so I could use [Fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch) on both the Browser (through window) and Node (through node-fetch). See its docs at 8 | 9 | See repo at 10 | 11 | ## Affjax 12 | 13 | This is a library for working with XHR by Slamdata. It works, so you can use it. It currently has concepts of request and response data types and does come with some pains of dealing with Argonaut's Json types, but if you don't really care about Argonaut, you can set it to use the String responses and parse the JSON yourself instead. Read its and docs and see it at 14 | -------------------------------------------------------------------------------- /docs/index.rst: -------------------------------------------------------------------------------- 1 | PureScript Resources 2 | ============================ 3 | 4 | **DEPRECATED: this content will be moved to GitHub for ease of maintenance: `https://github.com/justinwoo/purescript-resources` 5 | 6 | ------- 7 | 8 | This is a collection of notes and links to resources to learn and use PureScript as generally recommended by me. This is all biased information. Think of it as "awesome-how-to-purescript" that isn't just a link farm. 9 | 10 | This guide contains a lot of 🌶️. If you'd like to have something changed or explained more, make a PR or an issue. 11 | 12 | There is another resources page out there that you might look at here: `https://github.com/JordanMartinez/purescript-jordans-reference `_ 13 | 14 | .. note:: Do you find this guide useful? Please contribute your own writing to this page if you do! 15 | 16 | Pages 17 | ================== 18 | 19 | .. toctree:: 20 | 21 | intro 22 | installation 23 | community 24 | psc-package 25 | spacchetti 26 | ffi 27 | json 28 | http-requests 29 | ui 30 | testing 31 | elm-like 32 | collections 33 | node-backends 34 | databases 35 | travis 36 | azure-pipelines 37 | non-pulp 38 | typelevel-programming 39 | datatype-generics 40 | blogs 41 | 0.11.7-to-0.12.0 42 | eff-to-effect 43 | nix 44 | etc 45 | -------------------------------------------------------------------------------- /docs/installation.md: -------------------------------------------------------------------------------- 1 | # Installation 2 | 3 | I wrote a blog post about this for people who want to install PureScript tooling via npm: 4 | 5 | ## About npm in general 6 | 7 | ### Prefix 8 | 9 | Make sure you have prefix set for npm in `~/.npmrc`: 10 | 11 | ``` 12 | prefix="~/.npm" 13 | ``` 14 | 15 | If you don't do this, npm installations overall in your system will be messed up. 16 | 17 | **never run npm with `sudo`.** 18 | 19 | ### Set your npm paths 20 | 21 | ``` 22 | export PATH="$HOME/.npm/bin:$PATH" 23 | export PATH="./node_modules/.bin:$PATH" 24 | ``` 25 | 26 | ## If you want to set up PureScript tooling via npm 27 | 28 | ``` 29 | npm i -g purescript pulp psc-package-bin-simple 30 | ``` 31 | 32 | ## If you don't want to set up tooling via npm 33 | 34 | Grab the PureScript binary from Github releases and put it in your path (e.g. `~/.local/bin/`): 35 | 36 | Grab the Psc-Package binary from Github releases and put it in your path: 37 | 38 | You will have to install `pulp` via npm, but you don't necessarily have to use pulp. Nevertheless, `npm install -g pulp` or `npm i -S pulp` in your project. 39 | 40 | You might try this bash script, but if it doesn't work, make a PR: 41 | 42 | ## Installation of tools through Nix 43 | 44 | Unfortunately, the Nix package for PureScript is usually broken, and there is no visible interest in making the package use the binaries from GitHub. As a result, installing the compiler through Nix will usually be broken or irreproducable. 45 | 46 | I have started collecting easy ways of installing PureScript-related tools with Nix via the released binaries: . Please try this! If you don't use NixOS, you can quite readily use this like so in . 47 | 48 | You can also try this simple derivation for the compiler: 49 | 50 | On the other hand, the Psc-Package package on nixpkgs is fine: 51 | -------------------------------------------------------------------------------- /docs/intro.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | ## "Why should I use PureScript?" 4 | 5 | I will guess that you want to learn something where 6 | 7 | * You can actually refactor programs without them breaking 8 | * You want the computer to do more things that you shouldn't have to do 9 | * You want to use tools that help you learn more and do more meaningful work in less time 10 | * You want to do things as you see fit, not just as some thoughtleader has dictated 11 | 12 | In that case, welcome. If not, maybe you'll still want to just poke around and look at some of the things here. 13 | 14 | ## "How do I manage my dependencies?" / "Ew, do I have to use BOWER?" 15 | 16 | You can just use Spago if you want some solution based on package sets: 17 | 18 | I use Psc-Package for everything at work and at home for project dependency management. See the docs for Psc-Package and the new package-sets 19 | 20 | For Bower criticisms, you should read and understand . Then you can start using Psc-Package for projects like a normal person. 21 | 22 | ## "Why can't I just use NPM"? 23 | 24 | Read the link above to read why npm-style dependencies don't work for PureScript. 25 | 26 | However, **yes, almost everyone uses npm for their JavaScript dependencies. It is essential to how PureScript interops with existing JavaScript libraries.** 27 | 28 | ## "Where do I find some general documentation on PureScript?" 29 | 30 | Documentation is here 31 | 32 | Some of these pages are outdated or stale, so you might ask people to consider updating them in various channels. 33 | 34 | ## "Where do I find libraries?" 35 | 36 | Pursuit 37 | 38 | ## "Where do I find docs for libraries?" 39 | 40 | Pursuit 41 | 42 | ## "What is the `purescript-contrib` org on Github?" 43 | 44 | Various donated libraries to be maintained by contributors of `purescript-contrib`, to varying degrees. Use these if you want, don't use them if you don't want. 45 | 46 | ## What is the difference between row type of Type (# Type) and Records (`{}`/`Record ()`)? 47 | 48 | Read here: 49 | 50 | Note the parens vs curly brace 51 | -------------------------------------------------------------------------------- /docs/json.md: -------------------------------------------------------------------------------- 1 | # JSON 2 | 3 | Currently, I only use my own library Simple-JSON. 4 | 5 | ## Simple-JSON 6 | 7 | Everything you've dreamed of when defining transport types or wanting to work with inferred serialization types for JSON. See its documentation at 8 | 9 | Repo at 10 | 11 | ## Foreign 12 | 13 | If you work with JS values, you will want to use the Foreign library. 14 | 15 | ## Foreign-Generic 16 | 17 | A library for working with data types deriving `Generic`. 18 | 19 | ## Argonaut-Core 20 | 21 | A library for working with Json values but in a different way. If you want automatic decoding of JSON, this is not the set of libraries you want to use. Otherwise, welcome. 22 | 23 | Repo at 24 | 25 | Also see 26 | 27 | ## "None of these libraries do what I want" 28 | 29 | Writing your own solution is fairly simple, since you can start by only handling some of the cases you care about most. If you understand how to use single and multiparameter type classes, then you're ready to get started with making your own solution. 30 | 31 | First, make sure you understand whether or not you want to use plain `Either`, [`Except`](https://pursuit.purescript.org/packages/purescript-transformers/4.1.0/docs/Control.Monad.Except#t:Except), or something else. 32 | 33 | Start by reading through this tutorial: 34 | 35 | * 36 | 37 | This article alone should give you some ideas on how you might start to implement your own library. 38 | 39 | You might want to also read these blog posts: 40 | 41 | * 42 | * 43 | -------------------------------------------------------------------------------- /docs/nix.md: -------------------------------------------------------------------------------- 1 | # Usage with Nix 2 | 3 | You might look through this post to see the components involved: 4 | 5 | I've been trying to put a few things together: 6 | 7 | ## easy-purescript-nix 8 | 9 | Easily use PureScript with Nix. Doesn't require hard to reproduce builds, but actually prefers binaries that can be downloaded and used readily. 10 | 11 | 12 | 13 | You can see an example of this in action in the vidtracker repo: 14 | 15 | ## psc-package2nix 16 | 17 | Generates a series of derivations from a solved dependency set from Psc-Package. 18 | 19 | 20 | 21 | You can see this in action being used in the vidtracker repo: 22 | -------------------------------------------------------------------------------- /docs/node-backends.md: -------------------------------------------------------------------------------- 1 | # Node Backends 2 | 3 | I do not use any libraries to do Node backend development for work, as I have not found any to be useful enough compared to the cost of having the wrong combination of requirements or missing functionality. See the section on FFI to get familiar with how to do things. 4 | 5 | ## Makkori 6 | 7 | I have a library for relatively simple Express usage, which can be extended with normal Express middleware as needed. My vidtracker project uses it to prepare the backend, though there are many other techniques involved here 8 | 9 | See the repo at 10 | 11 | ## What about my databases??? 12 | 13 | Looking on Pursuit alone, you'll find is actively maintained. I use node-sqlite3 for many of my projects and keep it fairly maintained, though the binding itself is completely minimal: 14 | 15 | Overall, you should learn how to use FFI so you can make wrappers around things you need and improve their types overall. 16 | 17 | ## HTTPure 18 | 19 | You might look at this project if you want to try something active written in plain PureScript 20 | -------------------------------------------------------------------------------- /docs/non-pulp.md: -------------------------------------------------------------------------------- 1 | # Purp, the non-Pulp 2 | 3 | To work with Psc-Package projects, I use purp: 4 | 5 | You may be interested in using this also, but otherwise, you can always use Pulp if you don't mind using a node CLI. 6 | -------------------------------------------------------------------------------- /docs/psc-package.md: -------------------------------------------------------------------------------- 1 | # Psc-Package or Spago 2 | 3 | I use Psc-Package, but I realize it might not be what people readily want. Maybe Spago will help: 4 | 5 | See the docs for Psc-Package here 6 | 7 | For easy installation, you might try . 8 | 9 | ## Spacchetti 10 | 11 | I have a Dhall-based package set for Psc-Package that I actively use and base my work and home projects on. See the docs 12 | 13 | Repo 14 | 15 | ## With Nix 16 | 17 | I have put together a Psc-Package2Nix project here: 18 | -------------------------------------------------------------------------------- /docs/spacchetti.md: -------------------------------------------------------------------------------- 1 | # Spacchetti 2 | 3 | Spacchetti is now merged in package-sets, so you should see it first: 4 | 5 | Otherwise, also see the Spacchetti guide here: 6 | -------------------------------------------------------------------------------- /docs/testing.md: -------------------------------------------------------------------------------- 1 | # Testing 2 | 3 | ## Assert 4 | 5 | Simple but flexible 6 | 7 | 8 | 9 | ## Spec 10 | 11 | Pretty fully featured 12 | 13 | 14 | 15 | ## Test-Unit 16 | 17 | Works, but no fancy features 18 | 19 | 20 | -------------------------------------------------------------------------------- /docs/travis.md: -------------------------------------------------------------------------------- 1 | # Travis CI 2 | 3 | Travis, being the problem child that it is, over represents resources available to it by default. One normal workaround is to force usage of a different environment by using `sudo: required` in .travis.yml like so: 4 | 5 | ```yaml 6 | dist: trusty 7 | sudo: required 8 | ``` 9 | 10 | (from ) 11 | 12 | ## Example configuration 13 | 14 | ```yaml 15 | language: c 16 | dist: trusty 17 | sudo: required 18 | 19 | cache: 20 | directories: 21 | - .psc-package 22 | - output 23 | 24 | env: 25 | - PATH=$HOME/purescript:$HOME/psc-package:$PATH 26 | 27 | install: 28 | - TAG=v0.12.0 29 | - PSC_PACKAGE_TAG=v0.3.2 30 | - wget -O $HOME/purescript.tar.gz https://github.com/purescript/purescript/releases/download/$TAG/linux64.tar.gz 31 | - tar -xvf $HOME/purescript.tar.gz -C $HOME/ 32 | - chmod a+x $HOME/purescript 33 | - wget -O $HOME/psc-package.tar.gz https://github.com/purescript/psc-package/releases/download/$PSC_PACKAGE_TAG/linux64.tar.gz 34 | - tar -xvf $HOME/psc-package.tar.gz -C $HOME/ 35 | - chmod a+x $HOME/psc-package 36 | 37 | script: 38 | - make setup-only 39 | - psc-package verify 40 | ``` 41 | 42 | From 43 | 44 | ## Telling Haskell RTS the bad news 45 | 46 | You can pass runtime system arguments as pass-through arguments to pulp to make Travis build correctly: 47 | 48 | ``` 49 | pulp build -- +RTS -N1 -RTS 50 | ``` 51 | 52 | This will make builds run smoothly most of the time. As with everything Travis-related, godspeed. 53 | -------------------------------------------------------------------------------- /docs/typelevel-programming.md: -------------------------------------------------------------------------------- 1 | # Type-Level Programming 2 | 3 | In PureScript, type-level programming isn't about being "smart" or "talented", it's only about solving problems. If you're seeking validation or for something to "prove" your "intelligence", you may be better off reading books or arguing politics on Twitter instead. 4 | 5 | This is a truly exciting and interesting area of PureScript, but most people wanting to look at this don't understand enough fundamentals to actually solve their problems. Instead of trying to link you to my blog posts, it's more useful for me to write down a list of topics you should read about and know before you try to start doing this: 6 | 7 | * Pattern matching (e.g. of Data.List Cons, Nil) 8 | * Type classes, single parameters and their instances 9 | * Proxy, SProxy, etc. 10 | * Multiple parameter type classes 11 | * Functional dependencies 12 | * Overlapping instances 13 | * Row polymorphism in PureScript 14 | * PureScript-Record 15 | * PureScript-Variant 16 | * Datatype Generics/PureScript-Generics-Rep 17 | * PureScript-Typelevel-Prelude 18 | 19 | Optional: 20 | * Instance chains in PureScript 21 | 22 | The associated literature for some of these topics in the [GHC User's Guide](https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html) make for a good first start to read about, and long-form explanations can also be found on [PureScript By Example](https://leanpub.com/purescript/read). 23 | 24 | For understanding, you should devote some time to making some examples of each topic and take some notes that you can refer to later, such as blog posts, an ORG file, or written notes. 25 | 26 | To tie everything together, you might read my post [Type classes and instances are pattern matching for types](https://qiita.com/kimagure/items/08c59fa21adcd6968ae1). 27 | -------------------------------------------------------------------------------- /docs/ui.md: -------------------------------------------------------------------------------- 1 | # UI libraries 2 | 3 | There are effectively two actively maintained and working solutions. 4 | 5 | ## React-Basic 6 | 7 | Quite transparent React interop. Start by looking here: 8 | 9 | See the starter here: 10 | 11 | See my fork with all of my opinionated things here: 12 | 13 | And the TodoMVC implementation here: 14 | 15 | [React-Basic](https://github.com/lumihq/purescript-react-basic) 16 | 17 | ## Halogen 18 | 19 | Pure PureScript. Fast if you don't write naive code with thousands of unkeyed children. Note that the docs are slow to update, but each major version is very usable. This library can end up being a deep rabbit hole of FP ideas and how FP also models OOP. Consider React-Basic if you want to get started quickly and improve your codebase incrementally. 20 | 21 | See the starter project here: 22 | 23 | See an example real-world application with authentication, routing, state management, and more: 24 | 25 | [Halogen](https://github.com/slamdata/purescript-halogen/) 26 | 27 | ## No library 28 | 29 | It might be worthwhile to not actually try to write your entire view in PureScript first, and rather interface in your existing application. You should read through the [FFI](./ffi.html) links. 30 | -------------------------------------------------------------------------------- /purs-install.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | TAG=v0.12.1 4 | PSC_PACKAGE_TAG=v0.4.2 5 | 6 | wget -O $HOME/purescript.tar.gz https://github.com/purescript/purescript/releases/download/$TAG/linux64.tar.gz 7 | tar -xvf $HOME/purescript.tar.gz -C $HOME/ 8 | mv $HOME/purescript/purs ~/.local/bin 9 | 10 | wget -O $HOME/psc-package.tar.gz https://github.com/purescript/psc-package/releases/download/$PSC_PACKAGE_TAG/linux64.tar.gz 11 | tar -xvf $HOME/psc-package.tar.gz -C $HOME/ 12 | mv $HOME/psc-package/psc-package ~/.local/bin 13 | --------------------------------------------------------------------------------