git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Merge remote-tracking branch 'upstream/master' into pure11
commit6d14b7607f8788dad26a3e44bde3e7a4af84b3ce authorAndy Arvanitis <andyarvanitis@gmail.com> dateMon 14 Nov 2016, 16:23 (10 years ago) parent81a54afc5432ce
5 files changed+105−3
CONTRIBUTORS.md+1 bundle/README+1 bundle/build.sh+1−1 psc-package/README.md+99 src/Control/Monad/Supply/Class.hs+3−2
CONTRIBUTORS.md+1
@@ -84,6 +84,7 @@ This file lists the contributors to the PureScript compiler project, and the ter
8484- [@zudov](https://github.com/zudov) (Konstantin Zudov) My existing contributions and all future contributions until further notice are Copyright Konstantin Zudov, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
8585- [@brandonhamilton](https://github.com/brandonhamilton) (Brandon Hamilton) My existing contributions and all future contributions until further notice are Copyright Brandon Hamilton, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
8686- [@bbqbaron](https://github.com/bbqbaron) (Eric Loren) My existing contributions and all future contributions until further notice are Copyright Eric Loren, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
87+- [@RyanGlScott](https://github.com/RyanGlScott) (Ryan Scott) My existing contributions and all future contributions until further notice are Copyright Ryan Scott, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
8788
8889### Companies
8990
bundle/README+1
@@ -19,6 +19,7 @@ This bundle contains the following executables:
1919- psc-ide-server Provides Editor Support in the form of type information and
2020 autocompletion
2121- psc-ide-client Utility to query psc-ide-server
22+- psc-package Package manager for PureScript packages
2223
2324Copy these files anywhere on your PATH.
2425
bundle/build.sh+1−1
@@ -26,7 +26,7 @@ fi
2626mkdir -p bundle/build/purescript
2727
2828# Strip the binaries, and copy them to the staging directory
29−for BIN in psc psci psc-docs psc-publish psc-bundle psc-ide-server psc-ide-client
29+for BIN in psc psci psc-docs psc-publish psc-bundle psc-ide-server psc-ide-client psc-package
3030do
3131 FULL_BIN="$LOCAL_INSTALL_ROOT/bin/${BIN}${BIN_EXT}"
3232 if [ "$OS" != "win64" ]
psc-package/README.mdnew file+99
@@ -0,0 +1,99 @@
1+# `psc-package`
2+
3+`psc-package` is an executable which helps manage PureScript dependencies via Git. It can be used directly, but it is also designed to be used by external tools.
4+
5+## Concepts
6+
7+### Package Sets
8+
9+A _package set_ is a mapping from package names to:
10+
11+- the Git repository URL for the package
12+- the Git ref which should be passed to `git clone` to clone the appropriate version (usually a tag name, but a SHA is also valid)
13+- the package's transitive dependencies
14+
15+A package set repository contains a `packages.json` file which contains all mapping information. `psc-package` uses this information to decide which repos need to be cloned.
16+
17+The default package set is [purescript/package-sets](https://github.com/purescript/package-sets), but it is possible to create custom package sets by forking an existing package set or creating a new one from scratch. One benefit of using the default package set is that it is verified by a continuous integration process.
18+
19+## The `psc-package.json` format
20+
21+Here is a simple project configuration:
22+
23+```json
24+{
25+ "name": "my-project",
26+ "set": "psc-0.10.2",
27+ "source": "https://github.com/purescript/package-sets.git",
28+ "depends": [
29+ "prelude"
30+ ]
31+}
32+```
33+
34+It defines:
35+
36+- The project name
37+- The package set to use to resolve dependencies (this corresponds to a branch or tag of the package set source repository)
38+- The package set source repository Git URL (change this if you want to host your own package sets)
39+- Any dependencies of the project, as a list of names of packages from the package set
40+
41+## How To
42+
43+### Create a project
44+
45+A new package can be created using `psc-package init`. This will:
46+
47+- Create a simple `psc-package.json` file based on the current compiler version
48+- Add the Prelude as a dependency (this can be removed later)
49+- Sync the local package database (under the `.psc-package/` directory) by cloning any necessary repositories.
50+
51+### Add dependencies
52+
53+To add a dependency, either:
54+
55+- Use the `install` command, which will update the project configuration automatically, or
56+- Modify the `psc-package.json` file, and sync manually by running the `update` command.
57+
58+### Build a project
59+
60+Active project dependencies and project source files under `src` can be compiled using the `build` command.
61+
62+This command is provided as a convenience until external tools add support for `psc-package`. It _might_ be removed in future.
63+
64+### Query the local package database
65+
66+The local package database can be queried using the following commands:
67+
68+- `sources` - list source directories for active package versions. This can be useful when building a command for, say, running PSCi.
69+- `dependencies` - list all transitive dependencies
70+
71+### Add a package to the package set
72+
73+Adding your package to the package set means that others can easily install it as a dependency.
74+
75+Please note that your package will be removed from the set if it is not kept up to date. It can be easily re-added later if this happens.
76+
77+Adding a package is a manual process right now. We would like to add commands to make this process simpler, but for now, please follow these steps:
78+
79+- Tag a release of your library
80+- Run the `dependencies` command to get the list of transitive dependencies
81+- Make a pull request on the package set repository (against `master`) to add a new entry to `packages.json`. Use the dependency information above to fill in the fields, and the name of your new tag.
82+
83+Travis will verify your package builds correctly, and then we will try to merge your pull request. Your package will then be available in the next tagged package set.
84+
85+### Update a package in the set
86+
87+- Tag a new release
88+- Make a pull request on `master` to modify the tag named in the package set repository.
89+
90+Again, once Travis verifies your change, we will merge it into `master` and your change will be available in the next tag.
91+
92+## FAQ
93+
94+### Can I add a dependency which is not in the package set?
95+
96+Not right now. We might add this feature in future, but for now, consider either:
97+
98+- Adding your dependency to the package set if possible, or
99+- Creating your own custom package set
src/Control/Monad/Supply/Class.hs+3−2
@@ -3,6 +3,7 @@
33--
44
55{-# LANGUAGE DefaultSignatures #-}
6+{-# LANGUAGE TypeFamilies #-}
67
78module Control.Monad.Supply.Class where
89
@@ -15,9 +16,9 @@ import Control.Monad.Writer
1516class Monad m => MonadSupply m where
1617 fresh :: m Integer
1718 peek :: m Integer
18− default fresh :: MonadTrans t => t m Integer
19+ default fresh :: (MonadTrans t, MonadSupply n, m ~ t n) => m Integer
1920 fresh = lift fresh
20− default peek :: MonadTrans t => t m Integer
21+ default peek :: (MonadTrans t, MonadSupply n, m ~ t n) => m Integer
2122 peek = lift peek
2223
2324instance Monad m => MonadSupply (SupplyT m) where