8000 Merge branch 'master' into chexxor-rows-in-instances · purescript/documentation@f64b4a1 · GitHub
[go: up one dir, main page]

Skip to content

Commit f64b4a1

Browse files
authored
Merge branch 'master' into chexxor-rows-in-instances
2 parents 40d4abc + 78d6837 commit f64b4a1

21 files changed

+257
-73
lines changed

CONTRIBUTORS.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
## Contributors
2+
3+
This file lists the contributors to the PureScript documentation project, and the terms under which their contributions are licensed.
4+
5+
**NOTICE:** This list is not yet exhaustive, and any content written by contributors not listed here is not yet explicitly licensed.
6+
7+
### Contributors using Standard Terms
8+
9+
Contributors listed here agree to license their contributions under the following terms:
10+
11+
> My existing contributions and all future contributions until further notice are Copyright {Name}, and are licensed to the owners and users of the PureScript documentation project under the terms of the {License}.
12+
13+
By adding your name to the list below, you agree to license your contributions under these following terms.
14+
15+
If you would prefer to use different terms, please use the section below instead.
16+
17+
| Username | Name | License |
18+
| :------- | :--- | :------ |
19+
| [@LiamGoodacre](https://github.com/LiamGoodacre) | Liam Goodacre | [CC BY-NC-SA 3.0](https://creativecommons.org/licenses/by-nc-sa/3.0/deed) |
20+
| [@hdgarrood](https://github.com/hdgarrood) | Harry Garrood | [CC BY-NC-SA 3.0](https://creativecommons.org/licenses/by-nc-sa/3.0/deed) |
21+
| [@jplatte](https://github.com/jplatte) | Jonas Platte | [CC BY-NC-SA 3.0](https://creativecommons.org/licenses/by-nc-sa/3.0/deed) |
22+
| [@garyb](https://github.com/garyb) | Gary Burgess | [CC BY-NC-SA 3.0](https://creativecommons.org/licenses/by-nc-sa/3.0/deed) |
23+
| [@nwolverson](https://github.com/nwolverson) | Nicholas Wolverson | [CC BY-NC-SA 3.0](https://creativecommons.org/licenses/by-nc-sa/3.0/deed) |
24+
| [@csicar](https://github.com/csicar) | Carsten Csiky | [CC BY-NC-SA 3.0](https://creativecommons.org/licenses/by-nc-sa/3.0/deed) |
25+
| [@andyarvanitis](https://github.com/andyarvanitis) | Andy Arvanitis | [CC BY-NC-SA 3.0](https://creativecommons.org/licenses/by-nc-sa/3.0/deed) |
26+
| [@jdegoes](https://github.com/jdegoes) | John A. De Goes | [CC BY-NC-SA 3.0](https://creativecommons.org/licenses/by-nc-sa/3.0/deed) |
27+
| [@epost](https://github.com/epost) | Erik Post | [CC BY-NC-SA 3.0](https://creativecommons.org/licenses/by-nc-sa/3.0/deed) |
28+
| [@paf31](https://github.com/paf31) | Phil Freeman | [CC BY-NC-SA 3.0](https://creativecommons.org/licenses/by-nc-sa/3.0/deed) |
29+
| [@kRITZCREEK](https://github.com/kRITZCREEK) | Christoph Hegemann | [CC BY-NC-SA 3.0](https://creativecommons.org/licenses/by-nc-sa/3.0/deed) |
30+
| [@stefanholzmueller](https://github.com/stefanholzmueller) | Stefan Holzmüller | [CC BY-NC-SA 3.0](https://creativecommons.org/licenses/by-nc-sa/3.0/deed) |
31+
| [@damncabbage](https://github.com/damncabbage) | Rob Howard | [CC BY-NC-SA 3.0](https://creativecommons.org/licenses/by-nc-sa/3.0/deed) |
32+
| [@dgendill](https://github.com/dgendill) | Dominick Gendill | [CC BY-NC-SA 3.0](https://creativecommons.org/licenses/by-nc-sa/3.0/deed) |
33+
| [@haf](https://github.com/haf) | Henrik Feldt | [CC BY-NC-SA 3.0](https://creativecommons.org/licenses/by-nc-sa/3.0/deed) |
34+
| [@Xandaros](https://github.com/Xandaros) | @Xandaros | [CC BY-NC-SA 3.0](https://creativecommons.org/licenses/by-nc-sa/3.0/deed) |
35+
| [@kika](https://github.com/kika) | Kirill Pertsev | [CC BY-NC-SA 3.0](https://creativecommons.org/licenses/by-nc-sa/3.0/deed) |
36+
| [@chexxor](https://github.com/chexxor) | Alex Berg | [CC BY-NC-SA 3.0](https://creativecommons.org/licenses/by-nc-sa/3.0/deed) |
37+
38+
### Contributors using Modified Terms
39+
40+
| Username | Name | Terms |
41+
| :------- | :--- | :------ |
42+
43+
### Companies
44+
45+
| Username | Company | Terms |
46+
| :------- | :--- | :------ |

ecosystem/Alternate-backends.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ There are various alternatives to `psc`'s default JavaScript backend:
55
| source code | PS version | Target | status | comments |
66
|:--------------------------------------------------------------------------------------|:-----------|:--------------|:------|:-----------------------|
77
| [pure11/pure11](https://github.com/pure11/pure11) | 0.10.6 | C++11 | active | all tests in `./examples/passing` are passing |
8-
| [purerl/purescript](https://github.com/purerl/purescript) | 0.10.1 | Erlang | experimental |
8+
| [purerl/purescript](https://github.com/purerl/purescript) | 0.11.6 | Erlang | active |
99

1010
## Alpha Quality
1111

@@ -14,7 +14,7 @@ There are various alternatives to `psc`'s default JavaScript backend:
1414
| [andyarvanitis/purescript-clojure](https://github.com/andyarvanitis/purescript-clojure) | | Clojure (JVM) |
1515
| [PyreScript](https://github.com/joneshf/pyrescript) | 0.9.1 | Python |
1616
| [epost/psc-query](https://github.com/epost/psc-query) | 0.7.3.0 | Datalog |
17-
| [tfausak/thran](https://github.com/tfausak/thran) | 0.10.3 | Haskell (GHC) |
17+
| [tfausak/thran](https://github.com/tfausak/thran) | 0.11.6 | Haskell (GHC) |
1818

1919
## Stale
2020

ecosystem/Editor-and-tool-support.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
#### Atom
55

66
- [purescript-contrib/atom-language-purescript](https://github.com/purescript-contrib/atom-language-purescript) provides syntax highlighting
7-
- [nwolverson/atom-ide-purescript](https://github.com/nwolverson/atom-ide-purescript) provides build support, REPL, and autocomplete etc. via [psc-ide](https://github.com/purescript/purescript/tree/master/psc-ide-server)
7+
- [nwolverson/atom-ide-purescript](https://github.com/nwolverson/atom-ide-purescript) provides build support, REPL, and autocomplete etc. via [psc-ide](https://github.com/purescript/purescript/tree/master/psc-ide)
88

99
#### Emacs
1010
Either use these two:
1111
- [dysinger/purescript-mode](https://github.com/dysinger/purescript-mode) was adapted from haskell-mode
12-
- [epost/psc-ide-emacs](https://github.com/epost/psc-ide-emacs) offers Emacs support for [psc-ide](https://github.com/purescript/purescript/tree/master/psc-ide-server)
12+
- [epost/psc-ide-emacs](https://github.com/epost/psc-ide-emacs) offers Emacs support for [psc-ide](https://github.com/purescript/purescript/tree/master/psc-ide)
1313

1414
Or these two, for a more minimal setup:
1515

@@ -37,7 +37,7 @@ Spacemacs users can just use the [`purescript` layer](https://github.com/syl20bn
3737

3838
#### General
3939

40-
- To generate `TAGS` files, use `psc-docs --format etags` (or `--format ctags`)
40+
- To generate `TAGS` files, use `purs docs --format etags` (or `--format ctags`)
4141

4242
## Build tools and package managers
4343

errors/CannotDerive.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,17 @@
33
## Example
44

55
```purescript
6-
module ShortFailingExample where
6+
data Bool = True | False
77
8-
...
8+
derive instance showBool :: Show Bool
99
```
1010

1111
## Cause
1212

13-
Explain why a user might see this error.
13+
This error shows up when you're attempting to derive an instance for which compiler
14+
support does not exist.
1415

1516
## Fix
1617

17-
- Suggest possible solutions.
18-
19-
## Notes
20-
21-
- Additional notes.
18+
- You will need to write an instance yourself.
19+
- If you want to derive e.g. `Show` you can use [Generics](https://github.com/purescript/documentation/blob/master/guides/Generic.md#show-eq-ord).

errors/CycleInDeclaration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## Example
44

55
```text
6-
$ pulp psci
6+
$ pulp repl
77
88
> x = x
99
Error found:

errors/IncorrectAnonymousArgument.md

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,35 @@
33
## Example
44

55
```purescript
6-
module ShortFailingExample where
6+
module Example where
77
8-
...
8+
add = (_ + _)
9+
10+
mapArray = map _ [1, 2, 3]
911
```
1012

1113
## Cause
1214

13-
Explain why a user might see this error.
15+
In an [operator section](https://github.com/purescript/documentation/blob/fc4a9db4b128aa3331e5f990cb1860e59077af31/language/Syntax.md#operator-sections), like `(_ + 1)`, an anonymous argument can be used only once.
16+
1417

1518
## Fix
1619

17-
- Suggest possible solutions.
20+
In the case of multiple arguments, give them names:
21+
```purescript
22+
add a b = (a + b)
23+
```
24+
or in the case of a normal function: Write the function [as an operator](https://github.com/purescript/documentation/blob/fc4a9db4b128aa3331e5f990cb1860e59077af31/language/Syntax.md#functions-as-operators) using backticks:
25+
```purescript
26+
mapArray = _ `map` [1, 2, 3]
27+
```
28+
1829

1930
## Notes
2031

21-
- Additional notes.
32+
- While `_ + _` will give this error; `\a -> a + _` will not
33+
34+
- If you really want to have multiple anonymous arguments, it can be achieved like this:
35+
```purescript
36+
add = (((+) $ _) $ _)
37+
```

errors/InvalidNewtype.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,21 @@
33
## Example
44

55
```purescript
6-
module ShortFailingExample where
6+
newtype NotIdentity a = a
77
8-
...
8+
newtype NotTuple a b = NotTuple a b
99
```
1010

1111
## Cause
1212

13-
Explain why a user might see this error.
13+
Newtypes must define a single constructor with a single argument, so the two
14+
most common sources of this error are having multiple arguments (like a `Tuple`)
15+
or forgetting to provide a constructor.
1416

1517
## Fix
1618

17-
- Suggest possible solutions.
19+
- If you need multiple arguments, consider using a newtype around a record or `Tuple`:
1820

19-
## Notes
20-
21-
- Additional notes.
21+
```purescript
22+
newtype RecordTuple a b = RecordTuple {fst :: a, snd :: b}
23+
```

errors/InvalidNewtypeInstance.md

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,38 @@
33
## Example
44

55
```purescript
6-
module ShortFailingExample where
6+
newtype ManyErrors e a = ManyErrors (Either e (Maybe a))
77
8-
...
8+
derive newtype instance manyErrorsFunctor :: Functor (ManyErrors e)
99
```
1010

1111
## Cause
1212

13-
Explain why a user might see this error.
13+
While `ManyErrors` is a valid newtype, its underlying representation is not a
14+
type for which a `Functor` instance already exists. Most causes of this error are
15+
due to the newtype being some composition of other types (in our case, `Either`
16+
and `Maybe`) instead of just one type.
1417

1518
## Fix
1619

17-
- Suggest possible solutions.
20+
- In many cases you can use existing higher-order newtypes that already have the
21+
relevant instances defined. For example, we could have done the following without
22+
getting an error:
23+
24+
```purescript
25+
import Data.Functor.Compose (Compose)
26+
27+
newtype ManyErrors e a = ManyErrors (Compose (Either e) Maybe a)
28+
29+
derive newtype instance manyErrorsFunctor :: Functor (ManyErrors e)
30+
```
31+
32+
This works because `Compose f g` is a functor whenever `f` and `g` are functors.
33+
34+
Otherwise, we would need to explicitly write the instance ourselves.
1835

1936
## Notes
2037

21-
- Additional notes.
38+
- If the underlying type does not have an instance to derive, you will instead
39+
get a [NoInstanceFound](https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md)
40+
error.

errors/KindsDoNotUnify.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ In the example above, the type constructor `Proxy` takes an argument of kind `Ty
3333

3434
## Notes
3535

36+
### Order of Error Message
37+
38+
In the `Proxy Array` example above it is unclear if `Type` refers to the expected kind and `Type -> Type` refers to the actual kind found on line 1 or vice-versa. The current implementation of Purescript sometimes presents the expected value first and other times presents the actual value first. In this sense the presentation of this error is inconsistent, so please don't read any order into the error message.
39+
3640
### Additional/Missing Type Arguments
3741

3842
This error can occur when a type argument is missing, or an additional type argument is provided:

errors/RedefinedIdent.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,32 @@
33
## Example
44

55
```purescript
6-
module ShortFailingExample where
6+
module Example where
7+
8+
a = 3
9+
10+
a = 5
711
8-
...
912
```
1013

1114
## Cause
1215

13-
Explain why a user might see this error.
16+
You have defined a value with the same name multiple times.
1417

1518
## Fix
1619

17-
- Suggest possible solutions.
20+
- Rename one of the variables. In this example:
21+
```purescript
22+
a = 3
23+
24+
a' = 5
25+
```
1826
1927
## Notes
2028
21-
- Additional notes.
29+
- This error also occurs if you have multiple clauses for a function, where you misspelled the function name once. For Example:
30+
```purescript
31+
bar [] = 10
32+
barr [2] = 2
33+
bar x = length x
34+
```

0 commit comments

Comments
 (0)
0