git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Merge pull request #1067 from hdgarrood/pursuit2
c5f28f4Phil Freeman
.gitignore+1
@@ -9,3 +9,4 @@ cabal.sandbox.config
9*.lksh*
9*.lksh*
10.virthualenv
10.virthualenv
11.psci_modules/
11.psci_modules/
12+tmp/
CONTRIBUTING.md+14
@@ -16,3 +16,17 @@ If you would like to contribute, please consider the issues in the current miles
16Finally, if you have made code changes and would like to be included in the copyright notice in the cabal file, please include that change in your pull request.
16Finally, if you have made code changes and would like to be included in the copyright notice in the cabal file, please include that change in your pull request.
17
17
18To prevent core libraries from getting broken, every change must be reviewed. A pull request will be merged as long as one other team member has verified the changes.
18To prevent core libraries from getting broken, every change must be reviewed. A pull request will be merged as long as one other team member has verified the changes.
19+
20+## Adding dependencies
21+
22+Because the PureScript compiler is distributed in binary form, we include
23+the licenses of all dependencies, including transitive ones, in the LICENSE
24+file. Therefore, whenever the dependencies change, the LICENSE file should be
25+updated.
26+
27+You can automate this (if you have bash):
28+
29+- get a copy of [cabal-dependency-licenses][]
30+- run at the command line: `./license/generate > LICENSE`
31+
32+[cabal-dependency-licenses]: https://github.com/jaspervdj/cabal-dependency-licenses
LICENSE+1318−262
@@ -1,6 +1,7 @@
1The MIT License (MIT)
1The MIT License (MIT)
2
2
3−Copyright (c) 2013-14 Phil Freeman, (c) 2014 Gary Burgess, and other contributors
3+Copyright (c) 2013-15 Phil Freeman, (c) 2014-2015 Gary Burgess, and other
4+contributors
4
5
5Permission is hereby granted, free of charge, to any person obtaining a copy of
6Permission is hereby granted, free of charge, to any person obtaining a copy of
6this software and associated documentation files (the "Software"), to deal in
7this software and associated documentation files (the "Software"), to deal in
@@ -21,65 +22,320 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22
22PureScript uses the following Haskell library packages. Their license files follow.
23PureScript uses the following Haskell library packages. Their license files follow.
23
24
25+ aeson
26+ aeson-better-errors
27+ ansi-terminal
28+ ansi-wl-pprint
29+ array
30+ attoparsec
24 base
31 base
32+ bower-json
33+ boxes
34+ bytestring
25 containers
35 containers
36+ deepseq
26 directory
37 directory
27− file-embed
38+ dlist
28 filepath
39 filepath
40+ ghc-prim
41+ Glob
42+ hashable
29 haskeline
43 haskeline
30− monad-unify
44+ integer-gmp
31 mtl
45 mtl
46+ nats
47+ old-locale
32 optparse-applicative
48 optparse-applicative
33 parsec
49 parsec
34 pattern-arrows
50 pattern-arrows
51+ pretty
52+ primitive
35 process
53 process
54+ rts
55+ safe
56+ scientific
57+ semigroups
58+ split
59+ syb
60+ template-haskell
61+ terminfo
62+ text
36 time
63 time
37 transformers
64 transformers
65+ transformers-compat
66+ unix
38 unordered-containers
67 unordered-containers
39 utf8-string
68 utf8-string
40− split
69+ vector
41− boxes
70+ void
42
71
43−base LICENSE file:
72+aeson LICENSE file:
44
73
45− This library (libraries/base) is derived from code from several
74+ Copyright (c) 2011, MailRank, Inc.
46− sources:
75+
76+ All rights reserved.
77+
78+ Redistribution and use in source and binary forms, with or without
79+ modification, are permitted provided that the following conditions
80+ are met:
81+
82+ 1. Redistributions of source code must retain the above copyright
83+ notice, this list of conditions and the following disclaimer.
84+
85+ 2. Redistributions in binary form must reproduce the above copyright
86+ notice, this list of conditions and the following disclaimer in the
87+ documentation and/or other materials provided with the distribution.
88+
89+ 3. Neither the name of the author nor the names of his contributors
90+ may be used to endorse or promote products derived from this software
91+ without specific prior written permission.
92+
93+ THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRESS
94+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
95+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
96+ DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
97+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
98+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
99+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
100+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
101+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
102+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
103+ POSSIBILITY OF SUCH DAMAGE.
104+
105+aeson-better-errors LICENSE file:
106+
107+ Copyright (c) 2015 Harry Garrood
108+
109+ Permission is hereby granted, free of charge, to any person obtaining
110+ a copy of this software and associated documentation files (the
111+ "Software"), to deal in the Software without restriction, including
112+ without limitation the rights to use, copy, modify, merge, publish,
113+ distribute, sublicense, and/or sell copies of the Software, and to
114+ permit persons to whom the Software is furnished to do so, subject to
115+ the following conditions:
116+
117+ The above copyright notice and this permission notice shall be included
118+ in all copies or substantial portions of the Software.
119+
120+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
121+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
122+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
123+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
124+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
125+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
126+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
127+
128+ansi-terminal LICENSE file:
129+
130+ Copyright (c) 2008, Maximilian Bolingbroke
131+ All rights reserved.
132+
133+ Redistribution and use in source and binary forms, with or without modification, are permitted
134+ provided that the following conditions are met:
135+
136+ * Redistributions of source code must retain the above copyright notice, this list of
137+ conditions and the following disclaimer.
138+ * Redistributions in binary form must reproduce the above copyright notice, this list of
139+ conditions and the following disclaimer in the documentation and/or other materials
140+ provided with the distribution.
141+ * Neither the name of Maximilian Bolingbroke nor the names of other contributors may be used to
142+ endorse or promote products derived from this software without specific prior written permission.
143+
144+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
145+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
146+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
147+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
148+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
149+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
150+ IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
151+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
152+ansi-wl-pprint LICENSE file:
153+
154+ Copyright 2008, Daan Leijen and Max Bolingbroke. All rights reserved.
155+
156+ Redistribution and use in source and binary forms, with or without
157+ modification, are permitted provided that the following conditions are
158+ met:
159+
160+ * Redistributions of source code must retain the above copyright
161+ notice, this list of conditions and the following disclaimer.
162+
163+ * Redistributions in binary form must reproduce the above copyright
164+ notice, this list of conditions and the following disclaimer in
165+ the documentation and/or other materials provided with the
166+ distribution.
167+
168+ This software is provided by the copyright holders "as is" and any
169+ express or implied warranties, including, but not limited to, the
170+ implied warranties of merchantability and fitness for a particular
171+ purpose are disclaimed. In no event shall the copyright holders be
172+ liable for any direct, indirect, incidental, special, exemplary, or
173+ consequential damages (including, but not limited to, procurement of
174+ substitute goods or services; loss of use, data, or profits; or
175+ business interruption) however caused and on any theory of liability,
176+ whether in contract, strict liability, or tort (including negligence
177+ or otherwise) arising in any way out of the use of this software, even
178+ if advised of the possibility of such damage.
179+
180+array LICENSE file:
47
181
182+ This library (libraries/base) is derived from code from several
183+ sources:
184+
48 * Code from the GHC project which is largely (c) The University of
185 * Code from the GHC project which is largely (c) The University of
49 Glasgow, and distributable under a BSD-style license (see below),
186 Glasgow, and distributable under a BSD-style license (see below),
50−
187+
51 * Code from the Haskell 98 Report which is (c) Simon Peyton Jones
188 * Code from the Haskell 98 Report which is (c) Simon Peyton Jones
52 and freely redistributable (but see the full license for
189 and freely redistributable (but see the full license for
53 restrictions).
190 restrictions).
54−
191+
55 * Code from the Haskell Foreign Function Interface specification,
192 * Code from the Haskell Foreign Function Interface specification,
56 which is (c) Manuel M. T. Chakravarty and freely redistributable
193 which is (c) Manuel M. T. Chakravarty and freely redistributable
57 (but see the full license for restrictions).
194 (but see the full license for restrictions).
58−
195+
59 The full text of these licenses is reproduced below. All of the
196 The full text of these licenses is reproduced below. All of the
60 licenses are BSD-style or compatible.
197 licenses are BSD-style or compatible.
61−
198+
62 -----------------------------------------------------------------------------
199 -----------------------------------------------------------------------------
63−
200+
64 The Glasgow Haskell Compiler License
201 The Glasgow Haskell Compiler License
202+
203+ Copyright 2004, The University Court of the University of Glasgow.
204+ All rights reserved.
205+
206+ Redistribution and use in source and binary forms, with or without
207+ modification, are permitted provided that the following conditions are met:
208+
209+ - Redistributions of source code must retain the above copyright notice,
210+ this list of conditions and the following disclaimer.
211+
212+ - Redistributions in binary form must reproduce the above copyright notice,
213+ this list of conditions and the following disclaimer in the documentation
214+ and/or other materials provided with the distribution.
215+
216+ - Neither name of the University nor the names of its contributors may be
217+ used to endorse or promote products derived from this software without
218+ specific prior written permission.
219+
220+ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
221+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
222+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
223+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
224+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
225+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
226+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
227+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
228+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
229+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
230+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
231+ DAMAGE.
232+
233+ -----------------------------------------------------------------------------
234+
235+ Code derived from the document "Report on the Programming Language
236+ Haskell 98", is distributed under the following license:
237+
238+ Copyright (c) 2002 Simon Peyton Jones
239+
240+ The authors intend this Report to belong to the entire Haskell
241+ community, and so we grant permission to copy and distribute it for
242+ any purpose, provided that it is reproduced in its entirety,
243+ including this Notice. Modified versions of this Report may also be
244+ copied and distributed for any purpose, provided that the modified
245+ version is clearly presented as such, and that it does not claim to
246+ be a definition of the Haskell 98 Language.
247+
248+ -----------------------------------------------------------------------------
249+
250+ Code derived from the document "The Haskell 98 Foreign Function
251+ Interface, An Addendum to the Haskell 98 Report" is distributed under
252+ the following license:
253+
254+ Copyright (c) 2002 Manuel M. T. Chakravarty
255+
256+ The authors intend this Report to belong to the entire Haskell
257+ community, and so we grant permission to copy and distribute it for
258+ any purpose, provided that it is reproduced in its entirety,
259+ including this Notice. Modified versions of this Report may also be
260+ copied and distributed for any purpose, provided that the modified
261+ version is clearly presented as such, and that it does not claim to
262+ be a definition of the Haskell 98 Foreign Function Interface.
263+
264+ -----------------------------------------------------------------------------
65
265
66− Copyright 2004, The University Court of the University of Glasgow.
266+attoparsec LICENSE file:
267+
268+ Copyright (c) Lennart Kolmodin
269+
67 All rights reserved.
270 All rights reserved.
271+
272+ Redistribution and use in source and binary forms, with or without
273+ modification, are permitted provided that the following conditions
274+ are met:
275+
276+ 1. Redistributions of source code must retain the above copyright
277+ notice, this list of conditions and the following disclaimer.
278+
279+ 2. Redistributions in binary form must reproduce the above copyright
280+ notice, this list of conditions and the following disclaimer in the
281+ documentation and/or other materials provided with the distribution.
282+
283+ 3. Neither the name of the author nor the names of his contributors
284+ may be used to endorse or promote products derived from this software
285+ without specific prior written permission.
286+
287+ THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRESS
288+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
289+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
290+ DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
291+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
292+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
293+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
294+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
295+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
296+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
297+ POSSIBILITY OF SUCH DAMAGE.
298+
299+base LICENSE file:
68
300
301+ This library (libraries/base) is derived from code from several
302+ sources:
303+
304+ * Code from the GHC project which is largely (c) The University of
305+ Glasgow, and distributable under a BSD-style license (see below),
306+
307+ * Code from the Haskell 98 Report which is (c) Simon Peyton Jones
308+ and freely redistributable (but see the full license for
309+ restrictions).
310+
311+ * Code from the Haskell Foreign Function Interface specification,
312+ which is (c) Manuel M. T. Chakravarty and freely redistributable
313+ (but see the full license for restrictions).
314+
315+ The full text of these licenses is reproduced below. All of the
316+ licenses are BSD-style or compatible.
317+
318+ -----------------------------------------------------------------------------
319+
320+ The Glasgow Haskell Compiler License
321+
322+ Copyright 2004, The University Court of the University of Glasgow.
323+ All rights reserved.
324+
69 Redistribution and use in source and binary forms, with or without
325 Redistribution and use in source and binary forms, with or without
70 modification, are permitted provided that the following conditions are met:
326 modification, are permitted provided that the following conditions are met:
71−
327+
72 - Redistributions of source code must retain the above copyright notice,
328 - Redistributions of source code must retain the above copyright notice,
73 this list of conditions and the following disclaimer.
329 this list of conditions and the following disclaimer.
74−
330+
75 - Redistributions in binary form must reproduce the above copyright notice,
331 - Redistributions in binary form must reproduce the above copyright notice,
76 this list of conditions and the following disclaimer in the documentation
332 this list of conditions and the following disclaimer in the documentation
77 and/or other materials provided with the distribution.
333 and/or other materials provided with the distribution.
78−
334+
79 - Neither name of the University nor the names of its contributors may be
335 - Neither name of the University nor the names of its contributors may be
80 used to endorse or promote products derived from this software without
336 used to endorse or promote products derived from this software without
81− specific prior written permission.
337+ specific prior written permission.
82−
338+
83 THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
339 THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
84 GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
340 GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
85 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
341 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
@@ -92,14 +348,14 @@ base LICENSE file:
92 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
348 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
93 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
349 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
94 DAMAGE.
350 DAMAGE.
95−
351+
96 -----------------------------------------------------------------------------
352 -----------------------------------------------------------------------------
97−
353+
98 Code derived from the document "Report on the Programming Language
354 Code derived from the document "Report on the Programming Language
99 Haskell 98", is distributed under the following license:
355 Haskell 98", is distributed under the following license:
100−
356+
101 Copyright (c) 2002 Simon Peyton Jones
357 Copyright (c) 2002 Simon Peyton Jones
102−
358+
103 The authors intend this Report to belong to the entire Haskell
359 The authors intend this Report to belong to the entire Haskell
104 community, and so we grant permission to copy and distribute it for
360 community, and so we grant permission to copy and distribute it for
105 any purpose, provided that it is reproduced in its entirety,
361 any purpose, provided that it is reproduced in its entirety,
@@ -107,15 +363,15 @@ base LICENSE file:
107 copied and distributed for any purpose, provided that the modified
363 copied and distributed for any purpose, provided that the modified
108 version is clearly presented as such, and that it does not claim to
364 version is clearly presented as such, and that it does not claim to
109 be a definition of the Haskell 98 Language.
365 be a definition of the Haskell 98 Language.
110−
366+
111 -----------------------------------------------------------------------------
367 -----------------------------------------------------------------------------
112−
368+
113 Code derived from the document "The Haskell 98 Foreign Function
369 Code derived from the document "The Haskell 98 Foreign Function
114 Interface, An Addendum to the Haskell 98 Report" is distributed under
370 Interface, An Addendum to the Haskell 98 Report" is distributed under
115 the following license:
371 the following license:
116−
372+
117 Copyright (c) 2002 Manuel M. T. Chakravarty
373 Copyright (c) 2002 Manuel M. T. Chakravarty
118−
374+
119 The authors intend this Report to belong to the entire Haskell
375 The authors intend this Report to belong to the entire Haskell
120 community, and so we grant permission to copy and distribute it for
376 community, and so we grant permission to copy and distribute it for
121 any purpose, provided that it is reproduced in its entirety,
377 any purpose, provided that it is reproduced in its entirety,
@@ -123,30 +379,156 @@ base LICENSE file:
123 copied and distributed for any purpose, provided that the modified
379 copied and distributed for any purpose, provided that the modified
124 version is clearly presented as such, and that it does not claim to
380 version is clearly presented as such, and that it does not claim to
125 be a definition of the Haskell 98 Foreign Function Interface.
381 be a definition of the Haskell 98 Foreign Function Interface.
126−
382+
127 -----------------------------------------------------------------------------
383 -----------------------------------------------------------------------------
128
384
385+bower-json LICENSE file:
386+
387+ Copyright (c) 2015 Harry Garrood
388+
389+ Permission is hereby granted, free of charge, to any person obtaining
390+ a copy of this software and associated documentation files (the
391+ "Software"), to deal in the Software without restriction, including
392+ without limitation the rights to use, copy, modify, merge, publish,
393+ distribute, sublicense, and/or sell copies of the Software, and to
394+ permit persons to whom the Software is furnished to do so, subject to
395+ the following conditions:
396+
397+ The above copyright notice and this permission notice shall be included
398+ in all copies or substantial portions of the Software.
399+
400+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
401+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
402+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
403+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
404+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
405+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
406+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
407+
408+boxes LICENSE file:
409+
410+ Copyright (c) Brent Yorgey 2008
411+
412+ Redistribution and use in source and binary forms, with or without
413+ modification, are permitted provided that the following conditions
414+ are met:
415+ 1. Redistributions of source code must retain the above copyright
416+ notice, this list of conditions and the following disclaimer.
417+ 2. Redistributions in binary form must reproduce the above copyright
418+ notice, this list of conditions and the following disclaimer in the
419+ documentation and/or other materials provided with the distribution.
420+ 3. Neither the name of the author nor the names of other contributors
421+ may be used to endorse or promote products derived from this software
422+ without specific prior written permission.
423+
424+ All other rights are reserved.
425+
426+ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND
427+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
428+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
429+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
430+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
431+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
432+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
433+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
434+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
435+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
436+ SUCH DAMAGE.
437+
438+bytestring LICENSE file:
439+
440+ Copyright (c) Don Stewart 2005-2009
441+ (c) Duncan Coutts 2006-2015
442+ (c) David Roundy 2003-2005
443+ (c) Simon Meier 2010-2011
444+
445+ All rights reserved.
446+
447+ Redistribution and use in source and binary forms, with or without
448+ modification, are permitted provided that the following conditions
449+ are met:
450+ 1. Redistributions of source code must retain the above copyright
451+ notice, this list of conditions and the following disclaimer.
452+ 2. Redistributions in binary form must reproduce the above copyright
453+ notice, this list of conditions and the following disclaimer in the
454+ documentation and/or other materials provided with the distribution.
455+ 3. Neither the name of the author nor the names of his contributors
456+ may be used to endorse or promote products derived from this software
457+ without specific prior written permission.
458+
459+ THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
460+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
461+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
462+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
463+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
464+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
465+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
466+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
467+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
468+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
469+ SUCH DAMAGE.
470+
129containers LICENSE file:
471containers LICENSE file:
130
472
131 The Glasgow Haskell Compiler License
473 The Glasgow Haskell Compiler License
132−
474+
133 Copyright 2004, The University Court of the University of Glasgow.
475 Copyright 2004, The University Court of the University of Glasgow.
134 All rights reserved.
476 All rights reserved.
135−
477+
136 Redistribution and use in source and binary forms, with or without
478 Redistribution and use in source and binary forms, with or without
137 modification, are permitted provided that the following conditions are met:
479 modification, are permitted provided that the following conditions are met:
138−
480+
139 - Redistributions of source code must retain the above copyright notice,
481 - Redistributions of source code must retain the above copyright notice,
140 this list of conditions and the following disclaimer.
482 this list of conditions and the following disclaimer.
141−
483+
142 - Redistributions in binary form must reproduce the above copyright notice,
484 - Redistributions in binary form must reproduce the above copyright notice,
143 this list of conditions and the following disclaimer in the documentation
485 this list of conditions and the following disclaimer in the documentation
144 and/or other materials provided with the distribution.
486 and/or other materials provided with the distribution.
145−
487+
146 - Neither name of the University nor the names of its contributors may be
488 - Neither name of the University nor the names of its contributors may be
147 used to endorse or promote products derived from this software without
489 used to endorse or promote products derived from this software without
148 specific prior written permission.
490 specific prior written permission.
491+
492+ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
493+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
494+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
495+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
496+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
497+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
498+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
499+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
500+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
501+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
502+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
503+ DAMAGE.
504+
505+deepseq LICENSE file:
149
506
507+ This library (deepseq) is derived from code from the GHC project which
508+ is largely (c) The University of Glasgow, and distributable under a
509+ BSD-style license (see below).
510+
511+ -----------------------------------------------------------------------------
512+
513+ The Glasgow Haskell Compiler License
514+
515+ Copyright 2001-2009, The University Court of the University of Glasgow.
516+ All rights reserved.
517+
518+ Redistribution and use in source and binary forms, with or without
519+ modification, are permitted provided that the following conditions are met:
520+
521+ - Redistributions of source code must retain the above copyright notice,
522+ this list of conditions and the following disclaimer.
523+
524+ - Redistributions in binary form must reproduce the above copyright notice,
525+ this list of conditions and the following disclaimer in the documentation
526+ and/or other materials provided with the distribution.
527+
528+ - Neither name of the University nor the names of its contributors may be
529+ used to endorse or promote products derived from this software without
530+ specific prior written permission.
531+
150 THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
532 THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
151 GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
533 GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
152 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
534 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
@@ -159,43 +541,45 @@ containers LICENSE file:
159 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
541 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
160 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
542 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
161 DAMAGE.
543 DAMAGE.
544+
545+ -----------------------------------------------------------------------------
162
546
163directory LICENSE file:
547directory LICENSE file:
164
548
165 This library (libraries/base) is derived from code from two
549 This library (libraries/base) is derived from code from two
166− sources:
550+ sources:
167−
551+
168 * Code from the GHC project which is largely (c) The University of
552 * Code from the GHC project which is largely (c) The University of
169 Glasgow, and distributable under a BSD-style license (see below),
553 Glasgow, and distributable under a BSD-style license (see below),
170−
554+
171 * Code from the Haskell 98 Report which is (c) Simon Peyton Jones
555 * Code from the Haskell 98 Report which is (c) Simon Peyton Jones
172 and freely redistributable (but see the full license for
556 and freely redistributable (but see the full license for
173 restrictions).
557 restrictions).
174−
558+
175 The full text of these licenses is reproduced below. Both of the
559 The full text of these licenses is reproduced below. Both of the
176 licenses are BSD-style or compatible.
560 licenses are BSD-style or compatible.
177−
561+
178 -----------------------------------------------------------------------------
562 -----------------------------------------------------------------------------
179−
563+
180 The Glasgow Haskell Compiler License
564 The Glasgow Haskell Compiler License
181−
565+
182− Copyright 2004, The University Court of the University of Glasgow.
566+ Copyright 2004, The University Court of the University of Glasgow.
183 All rights reserved.
567 All rights reserved.
184−
568+
185 Redistribution and use in source and binary forms, with or without
569 Redistribution and use in source and binary forms, with or without
186 modification, are permitted provided that the following conditions are met:
570 modification, are permitted provided that the following conditions are met:
187−
571+
188 - Redistributions of source code must retain the above copyright notice,
572 - Redistributions of source code must retain the above copyright notice,
189 this list of conditions and the following disclaimer.
573 this list of conditions and the following disclaimer.
190−
574+
191 - Redistributions in binary form must reproduce the above copyright notice,
575 - Redistributions in binary form must reproduce the above copyright notice,
192 this list of conditions and the following disclaimer in the documentation
576 this list of conditions and the following disclaimer in the documentation
193 and/or other materials provided with the distribution.
577 and/or other materials provided with the distribution.
194−
578+
195 - Neither name of the University nor the names of its contributors may be
579 - Neither name of the University nor the names of its contributors may be
196 used to endorse or promote products derived from this software without
580 used to endorse or promote products derived from this software without
197− specific prior written permission.
581+ specific prior written permission.
198−
582+
199 THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
583 THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
200 GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
584 GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
201 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
585 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
@@ -208,14 +592,14 @@ directory LICENSE file:
208 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
592 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
209 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
593 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
210 DAMAGE.
594 DAMAGE.
211−
595+
212 -----------------------------------------------------------------------------
596 -----------------------------------------------------------------------------
213−
597+
214 Code derived from the document "Report on the Programming Language
598 Code derived from the document "Report on the Programming Language
215 Haskell 98", is distributed under the following license:
599 Haskell 98", is distributed under the following license:
216−
600+
217 Copyright (c) 2002 Simon Peyton Jones
601 Copyright (c) 2002 Simon Peyton Jones
218−
602+
219 The authors intend this Report to belong to the entire Haskell
603 The authors intend this Report to belong to the entire Haskell
220 community, and so we grant permission to copy and distribute it for
604 community, and so we grant permission to copy and distribute it for
221 any purpose, provided that it is reproduced in its entirety,
605 any purpose, provided that it is reproduced in its entirety,
@@ -223,58 +607,64 @@ directory LICENSE file:
223 copied and distributed for any purpose, provided that the modified
607 copied and distributed for any purpose, provided that the modified
224 version is clearly presented as such, and that it does not claim to
608 version is clearly presented as such, and that it does not claim to
225 be a definition of the Haskell 98 Language.
609 be a definition of the Haskell 98 Language.
226−
610+
227 -----------------------------------------------------------------------------
611 -----------------------------------------------------------------------------
228
612
229−file-embed LICENSE file:
613+dlist LICENSE file:
230−
231− The following license covers this documentation, and the source code, except
232− where otherwise indicated.
233−
234− Copyright 2008, Michael Snoyman. All rights reserved.
235
614
615+ Copyright (c) 2006-2009 Don Stewart, 2013-2014 Sean Leather
616+
617+ All rights reserved.
618+
236 Redistribution and use in source and binary forms, with or without
619 Redistribution and use in source and binary forms, with or without
237− modification, are permitted provided that the following conditions are met:
620+ modification, are permitted provided that the following conditions are
238−
621+ met:
622+
239− * Redistributions of source code must retain the above copyright notice, this
623+ * Redistributions of source code must retain the above copyright
240− list of conditions and the following disclaimer.
624+ notice, this list of conditions and the following disclaimer.
241−
625+
242− * Redistributions in binary form must reproduce the above copyright notice,
626+ * Redistributions in binary form must reproduce the above
243− this list of conditions and the following disclaimer in the documentation
627+ copyright notice, this list of conditions and the following
628+ disclaimer in the documentation and/or other materials provided
244− and/or other materials provided with the distribution.
629+ with the distribution.
245−
630+
631+ * Neither the name of Don Stewart nor the names of other
632+ contributors may be used to endorse or promote products derived
633+ from this software without specific prior written permission.
634+
246− THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY EXPRESS OR
635+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
247− IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
636+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
637+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
248− MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
638+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
249− EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT,
639+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
250− INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
640+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
251− NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
641+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
252− OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
642+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
253− LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
643+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
254− OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
644+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
255− ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
645+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
256
646
257filepath LICENSE file:
647filepath LICENSE file:
258
648
259− Copyright Neil Mitchell 2005-2007.
649+ Copyright Neil Mitchell 2005-2015.
260 All rights reserved.
650 All rights reserved.
261−
651+
262 Redistribution and use in source and binary forms, with or without
652 Redistribution and use in source and binary forms, with or without
263 modification, are permitted provided that the following conditions are
653 modification, are permitted provided that the following conditions are
264 met:
654 met:
265−
655+
266 * Redistributions of source code must retain the above copyright
656 * Redistributions of source code must retain the above copyright
267 notice, this list of conditions and the following disclaimer.
657 notice, this list of conditions and the following disclaimer.
268−
658+
269 * Redistributions in binary form must reproduce the above
659 * Redistributions in binary form must reproduce the above
270 copyright notice, this list of conditions and the following
660 copyright notice, this list of conditions and the following
271 disclaimer in the documentation and/or other materials provided
661 disclaimer in the documentation and/or other materials provided
272 with the distribution.
662 with the distribution.
273−
663+
274 * Neither the name of Neil Mitchell nor the names of other
664 * Neither the name of Neil Mitchell nor the names of other
275 contributors may be used to endorse or promote products derived
665 contributors may be used to endorse or promote products derived
276 from this software without specific prior written permission.
666 from this software without specific prior written permission.
277−
667+
278 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
668 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
279 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
669 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
280 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
670 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -287,21 +677,123 @@ filepath LICENSE file:
287 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
677 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
288 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
678 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
289
679
290−haskeline LICENSE file:
680+ghc-prim LICENSE file:
291
681
292− Copyright 2007-2009, Judah Jacobson.
682+ This library (libraries/ghc-prim) is derived from code from several
293− All Rights Reserved.
683+ sources:
684+
685+ * Code from the GHC project which is largely (c) The University of
686+ Glasgow, and distributable under a BSD-style license (see below),
687+
688+ * Code from the Haskell 98 Report which is (c) Simon Peyton Jones
689+ and freely redistributable (but see the full license for
690+ restrictions).
691+
692+ The full text of these licenses is reproduced below. All of the
693+ licenses are BSD-style or compatible.
694+
695+ -----------------------------------------------------------------------------
696+
697+ The Glasgow Haskell Compiler License
698+
699+ Copyright 2004, The University Court of the University of Glasgow.
700+ All rights reserved.
701+
702+ Redistribution and use in source and binary forms, with or without
703+ modification, are permitted provided that the following conditions are met:
704+
705+ - Redistributions of source code must retain the above copyright notice,
706+ this list of conditions and the following disclaimer.
707+
708+ - Redistributions in binary form must reproduce the above copyright notice,
709+ this list of conditions and the following disclaimer in the documentation
710+ and/or other materials provided with the distribution.
711+
712+ - Neither name of the University nor the names of its contributors may be
713+ used to endorse or promote products derived from this software without
714+ specific prior written permission.
715+
716+ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
717+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
718+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
719+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
720+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
721+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
722+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
723+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
724+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
725+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
726+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
727+ DAMAGE.
728+
729+ -----------------------------------------------------------------------------
730+
731+ Code derived from the document "Report on the Programming Language
732+ Haskell 98", is distributed under the following license:
733+
734+ Copyright (c) 2002 Simon Peyton Jones
735+
736+ The authors intend this Report to belong to the entire Haskell
737+ community, and so we grant permission to copy and distribute it for
738+ any purpose, provided that it is reproduced in its entirety,
739+ including this Notice. Modified versions of this Report may also be
740+ copied and distributed for any purpose, provided that the modified
741+ version is clearly presented as such, and that it does not claim to
742+ be a definition of the Haskell 98 Language.
743+
744+
745+Glob LICENSE file:
746+
747+ Page not found: Sorry, it's just not here.
294
748
749+hashable LICENSE file:
750+
751+ Copyright Milan Straka 2010
752+
753+ All rights reserved.
754+
295 Redistribution and use in source and binary forms, with or without
755 Redistribution and use in source and binary forms, with or without
296 modification, are permitted provided that the following conditions are met:
756 modification, are permitted provided that the following conditions are met:
757+
758+ * Redistributions of source code must retain the above copyright
759+ notice, this list of conditions and the following disclaimer.
760+
761+ * Redistributions in binary form must reproduce the above
762+ copyright notice, this list of conditions and the following
763+ disclaimer in the documentation and/or other materials provided
764+ with the distribution.
765+
766+ * Neither the name of Milan Straka nor the names of other
767+ contributors may be used to endorse or promote products derived
768+ from this software without specific prior written permission.
769+
770+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
771+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
772+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
773+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
774+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
775+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
776+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
777+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
778+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
779+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
780+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
297
781
782+haskeline LICENSE file:
783+
784+ Copyright 2007-2009, Judah Jacobson.
785+ All Rights Reserved.
786+
787+ Redistribution and use in source and binary forms, with or without
788+ modification, are permitted provided that the following conditions are met:
789+
298 - Redistribution of source code must retain the above copyright notice,
790 - Redistribution of source code must retain the above copyright notice,
299 this list of conditions and the following disclaimer.
791 this list of conditions and the following disclaimer.
300−
792+
301 - Redistribution in binary form must reproduce the above copyright notice,
793 - Redistribution in binary form must reproduce the above copyright notice,
302 this list of conditions and the following disclaimer in the documentation
794 this list of conditions and the following disclaimer in the documentation
303 and/or other materials provided with the distribution.
795 and/or other materials provided with the distribution.
304−
796+
305 THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY
797 THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY
306 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
798 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
307 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
799 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -313,22 +805,245 @@ haskeline LICENSE file:
313 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
805 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
314 USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
806 USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
315
807
316−monad-unify LICENSE file:
808+integer-gmp LICENSE file:
317
809
318− The MIT License (MIT)
810+ Copyright (c) 2014, Herbert Valerio Riedel
811+
812+ All rights reserved.
813+
814+ Redistribution and use in source and binary forms, with or without
815+ modification, are permitted provided that the following conditions are met:
816+
817+ * Redistributions of source code must retain the above copyright
818+ notice, this list of conditions and the following disclaimer.
819+
820+ * Redistributions in binary form must reproduce the above
821+ copyright notice, this list of conditions and the following
822+ disclaimer in the documentation and/or other materials provided
823+ with the distribution.
824+
825+ * Neither the name of Herbert Valerio Riedel nor the names of other
826+ contributors may be used to endorse or promote products derived
827+ from this software without specific prior written permission.
828+
829+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
830+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
831+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
832+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
833+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
834+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
835+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
836+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
837+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
838+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
839+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
319
840
320− Copyright (c) 2013 Phil Freeman
841+mtl LICENSE file:
842+
843+ The Glasgow Haskell Compiler License
844+
845+ Copyright 2004, The University Court of the University of Glasgow.
846+ All rights reserved.
847+
848+ Redistribution and use in source and binary forms, with or without
849+ modification, are permitted provided that the following conditions are met:
850+
851+ - Redistributions of source code must retain the above copyright notice,
852+ this list of conditions and the following disclaimer.
853+
854+ - Redistributions in binary form must reproduce the above copyright notice,
855+ this list of conditions and the following disclaimer in the documentation
856+ and/or other materials provided with the distribution.
857+
858+ - Neither name of the University nor the names of its contributors may be
859+ used to endorse or promote products derived from this software without
860+ specific prior written permission.
861+
862+ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
863+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
864+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
865+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
866+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
867+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
868+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
869+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
870+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
871+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
872+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
873+ DAMAGE.
874+
875+nats LICENSE file:
876+
877+ Copyright 2011-2014 Edward Kmett
878+
879+ All rights reserved.
880+
881+ Redistribution and use in source and binary forms, with or without
882+ modification, are permitted provided that the following conditions
883+ are met:
884+
885+ 1. Redistributions of source code must retain the above copyright
886+ notice, this list of conditions and the following disclaimer.
887+
888+ 2. Redistributions in binary form must reproduce the above copyright
889+ notice, this list of conditions and the following disclaimer in the
890+ documentation and/or other materials provided with the distribution.
891+
892+ 3. Neither the name of the author nor the names of his contributors
893+ may be used to endorse or promote products derived from this software
894+ without specific prior written permission.
895+
896+ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
897+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
898+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
899+ DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
900+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
901+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
902+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
903+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
904+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
905+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
906+ POSSIBILITY OF SUCH DAMAGE.
907+
908+old-locale LICENSE file:
909+
910+ This library (libraries/base) is derived from code from two
911+ sources:
912+
913+ * Code from the GHC project which is largely (c) The University of
914+ Glasgow, and distributable under a BSD-style license (see below),
915+
916+ * Code from the Haskell 98 Report which is (c) Simon Peyton Jones
917+ and freely redistributable (but see the full license for
918+ restrictions).
919+
920+ The full text of these licenses is reproduced below. Both of the
921+ licenses are BSD-style or compatible.
922+
923+ -----------------------------------------------------------------------------
924+
925+ The Glasgow Haskell Compiler License
926+
927+ Copyright 2004, The University Court of the University of Glasgow.
928+ All rights reserved.
929+
930+ Redistribution and use in source and binary forms, with or without
931+ modification, are permitted provided that the following conditions are met:
932+
933+ - Redistributions of source code must retain the above copyright notice,
934+ this list of conditions and the following disclaimer.
935+
936+ - Redistributions in binary form must reproduce the above copyright notice,
937+ this list of conditions and the following disclaimer in the documentation
938+ and/or other materials provided with the distribution.
939+
940+ - Neither name of the University nor the names of its contributors may be
941+ used to endorse or promote products derived from this software without
942+ specific prior written permission.
943+
944+ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
945+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
946+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
947+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
948+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
949+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
950+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
951+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
952+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
953+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
954+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
955+ DAMAGE.
956+
957+ -----------------------------------------------------------------------------
958+
959+ Code derived from the document "Report on the Programming Language
960+ Haskell 98", is distributed under the following license:
961+
962+ Copyright (c) 2002 Simon Peyton Jones
963+
964+ The authors intend this Report to belong to the entire Haskell
965+ community, and so we grant permission to copy and distribute it for
966+ any purpose, provided that it is reproduced in its entirety,
967+ including this Notice. Modified versions of this Report may also be
968+ copied and distributed for any purpose, provided that the modified
969+ version is clearly presented as such, and that it does not claim to
970+ be a definition of the Haskell 98 Language.
971+
972+ -----------------------------------------------------------------------------
973+
974+optparse-applicative LICENSE file:
975+
976+ Copyright (c) 2012, Paolo Capriotti
977+
978+ All rights reserved.
979+
980+ Redistribution and use in source and binary forms, with or without
981+ modification, are permitted provided that the following conditions are met:
982+
983+ * Redistributions of source code must retain the above copyright
984+ notice, this list of conditions and the following disclaimer.
985+
986+ * Redistributions in binary form must reproduce the above
987+ copyright notice, this list of conditions and the following
988+ disclaimer in the documentation and/or other materials provided
989+ with the distribution.
990+
991+ * Neither the name of Paolo Capriotti nor the names of other
992+ contributors may be used to endorse or promote products derived
993+ from this software without specific prior written permission.
994+
995+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
996+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
997+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
998+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
999+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1000+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1001+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1002+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1003+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1004+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1005+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1006+
1007+parsec LICENSE file:
1008+
1009+ Copyright 1999-2000, Daan Leijen; 2007, Paolo Martini. All rights reserved.
1010+
1011+ Redistribution and use in source and binary forms, with or without
1012+ modification, are permitted provided that the following conditions are met:
1013+
1014+ * Redistributions of source code must retain the above copyright notice,
1015+ this list of conditions and the following disclaimer.
1016+ * Redistributions in binary form must reproduce the above copyright
1017+ notice, this list of conditions and the following disclaimer in the
1018+ documentation and/or other materials provided with the distribution.
1019+
1020+ This software is provided by the copyright holders "as is" and any express or
1021+ implied warranties, including, but not limited to, the implied warranties of
1022+ merchantability and fitness for a particular purpose are disclaimed. In no
1023+ event shall the copyright holders be liable for any direct, indirect,
1024+ incidental, special, exemplary, or consequential damages (including, but not
1025+ limited to, procurement of substitute goods or services; loss of use, data,
1026+ or profits; or business interruption) however caused and on any theory of
1027+ liability, whether in contract, strict liability, or tort (including
1028+ negligence or otherwise) arising in any way out of the use of this software,
1029+ even if advised of the possibility of such damage.
1030+
1031+pattern-arrows LICENSE file:
321
1032
1033+ The MIT License (MIT)
1034+
1035+ Copyright (c) 2013 Phil Freeman
1036+
322 Permission is hereby granted, free of charge, to any person obtaining a copy of
1037 Permission is hereby granted, free of charge, to any person obtaining a copy of
323 this software and associated documentation files (the "Software"), to deal in
1038 this software and associated documentation files (the "Software"), to deal in
324 the Software without restriction, including without limitation the rights to
1039 the Software without restriction, including without limitation the rights to
325 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
1040 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
326 the Software, and to permit persons to whom the Software is furnished to do so,
1041 the Software, and to permit persons to whom the Software is furnished to do so,
327 subject to the following conditions:
1042 subject to the following conditions:
328−
1043+
329 The above copyright notice and this permission notice shall be included in all
1044 The above copyright notice and this permission notice shall be included in all
330 copies or substantial portions of the Software.
1045 copies or substantial portions of the Software.
331−
1046+
332 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1047 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
333 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
1048 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
334 FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
1049 FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
@@ -336,27 +1051,384 @@ monad-unify LICENSE file:
336 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
1051 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
337 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1052 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
338
1053
339−mtl LICENSE file:
1054+pretty LICENSE file:
1055+
1056+ This library (libraries/pretty) is derived from code from
1057+ the GHC project which is largely (c) The University of
1058+ Glasgow, and distributable under a BSD-style license (see below).
1059+
1060+ -----------------------------------------------------------------------------
1061+
1062+ The Glasgow Haskell Compiler License
1063+
1064+ Copyright 2004, The University Court of the University of Glasgow.
1065+ All rights reserved.
1066+
1067+ Redistribution and use in source and binary forms, with or without
1068+ modification, are permitted provided that the following conditions are met:
1069+
1070+ - Redistributions of source code must retain the above copyright notice,
1071+ this list of conditions and the following disclaimer.
1072+
1073+ - Redistributions in binary form must reproduce the above copyright notice,
1074+ this list of conditions and the following disclaimer in the documentation
1075+ and/or other materials provided with the distribution.
1076+
1077+ - Neither name of the University nor the names of its contributors may be
1078+ used to endorse or promote products derived from this software without
1079+ specific prior written permission.
1080+
1081+ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
1082+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
1083+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
1084+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
1085+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
1086+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1087+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
1088+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
1089+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1090+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1091+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
1092+ DAMAGE.
1093+
1094+ -----------------------------------------------------------------------------
1095+
1096+primitive LICENSE file:
1097+
1098+ Copyright (c) 2008-2009, Roman Leshchinskiy
1099+ All rights reserved.
1100+
1101+ Redistribution and use in source and binary forms, with or without
1102+ modification, are permitted provided that the following conditions are met:
1103+
1104+ - Redistributions of source code must retain the above copyright notice,
1105+ this list of conditions and the following disclaimer.
1106+
1107+ - Redistributions in binary form must reproduce the above copyright notice,
1108+ this list of conditions and the following disclaimer in the documentation
1109+ and/or other materials provided with the distribution.
1110+
1111+ - Neither name of the University nor the names of its contributors may be
1112+ used to endorse or promote products derived from this software without
1113+ specific prior written permission.
1114+
1115+ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
1116+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
1117+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
1118+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
1119+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
1120+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1121+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
1122+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
1123+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1124+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1125+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
1126+ DAMAGE.
1127+
1128+
1129+process LICENSE file:
1130+
1131+ This library (libraries/process) is derived from code from two
1132+ sources:
1133+
1134+ * Code from the GHC project which is largely (c) The University of
1135+ Glasgow, and distributable under a BSD-style license (see below),
1136+
1137+ * Code from the Haskell 98 Report which is (c) Simon Peyton Jones
1138+ and freely redistributable (but see the full license for
1139+ restrictions).
1140+
1141+ The full text of these licenses is reproduced below. Both of the
1142+ licenses are BSD-style or compatible.
1143+
1144+ -----------------------------------------------------------------------------
1145+
1146+ The Glasgow Haskell Compiler License
1147+
1148+ Copyright 2004, The University Court of the University of Glasgow.
1149+ All rights reserved.
1150+
1151+ Redistribution and use in source and binary forms, with or without
1152+ modification, are permitted provided that the following conditions are met:
1153+
1154+ - Redistributions of source code must retain the above copyright notice,
1155+ this list of conditions and the following disclaimer.
1156+
1157+ - Redistributions in binary form must reproduce the above copyright notice,
1158+ this list of conditions and the following disclaimer in the documentation
1159+ and/or other materials provided with the distribution.
1160+
1161+ - Neither name of the University nor the names of its contributors may be
1162+ used to endorse or promote products derived from this software without
1163+ specific prior written permission.
1164+
1165+ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
1166+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
1167+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
1168+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
1169+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
1170+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1171+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
1172+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
1173+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1174+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1175+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
1176+ DAMAGE.
1177+
1178+ -----------------------------------------------------------------------------
1179+
1180+ Code derived from the document "Report on the Programming Language
1181+ Haskell 98", is distributed under the following license:
1182+
1183+ Copyright (c) 2002 Simon Peyton Jones
1184+
1185+ The authors intend this Report to belong to the entire Haskell
1186+ community, and so we grant permission to copy and distribute it for
1187+ any purpose, provided that it is reproduced in its entirety,
1188+ including this Notice. Modified versions of this Report may also be
1189+ copied and distributed for any purpose, provided that the modified
1190+ version is clearly presented as such, and that it does not claim to
1191+ be a definition of the Haskell 98 Language.
1192+
1193+ -----------------------------------------------------------------------------
1194+
1195+rts LICENSE file:
1196+
1197+ Package not found: No such package in package index
1198+
1199+safe LICENSE file:
1200+
1201+ Copyright Neil Mitchell 2007-2014.
1202+ All rights reserved.
1203+
1204+ Redistribution and use in source and binary forms, with or without
1205+ modification, are permitted provided that the following conditions are
1206+ met:
1207+
1208+ * Redistributions of source code must retain the above copyright
1209+ notice, this list of conditions and the following disclaimer.
1210+
1211+ * Redistributions in binary form must reproduce the above
1212+ copyright notice, this list of conditions and the following
1213+ disclaimer in the documentation and/or other materials provided
1214+ with the distribution.
1215+
1216+ * Neither the name of Neil Mitchell nor the names of other
1217+ contributors may be used to endorse or promote products derived
1218+ from this software without specific prior written permission.
1219+
1220+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1221+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1222+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1223+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1224+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1225+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1226+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1227+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1228+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1229+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1230+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1231+
1232+scientific LICENSE file:
1233+
1234+ Copyright (c) 2013, Bas van Dijk
1235+
1236+ All rights reserved.
1237+
1238+ Redistribution and use in source and binary forms, with or without
1239+ modification, are permitted provided that the following conditions are met:
1240+
1241+ * Redistributions of source code must retain the above copyright
1242+ notice, this list of conditions and the following disclaimer.
1243+
1244+ * Redistributions in binary form must reproduce the above
1245+ copyright notice, this list of conditions and the following
1246+ disclaimer in the documentation and/or other materials provided
1247+ with the distribution.
1248+
1249+ * Neither the name of Bas van Dijk nor the names of other
1250+ contributors may be used to endorse or promote products derived
1251+ from this software without specific prior written permission.
1252+
1253+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1254+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1255+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1256+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1257+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1258+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1259+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1260+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1261+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1262+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1263+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1264+
1265+semigroups LICENSE file:
1266+
1267+ Copyright 2011-2015 Edward Kmett
1268+
1269+ All rights reserved.
1270+
1271+ Redistribution and use in source and binary forms, with or without
1272+ modification, are permitted provided that the following conditions
1273+ are met:
1274+
1275+ 1. Redistributions of source code must retain the above copyright
1276+ notice, this list of conditions and the following disclaimer.
1277+
1278+ 2. Redistributions in binary form must reproduce the above copyright
1279+ notice, this list of conditions and the following disclaimer in the
1280+ documentation and/or other materials provided with the distribution.
1281+
1282+ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
1283+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
1284+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
1285+ DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
1286+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1287+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1288+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1289+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
1290+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
1291+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
1292+ POSSIBILITY OF SUCH DAMAGE.
1293+
1294+split LICENSE file:
1295+
1296+ Copyright (c) 2008 Brent Yorgey, Louis Wasserman
1297+
1298+ All rights reserved.
1299+
1300+ Redistribution and use in source and binary forms, with or without
1301+ modification, are permitted provided that the following conditions
1302+ are met:
1303+ 1. Redistributions of source code must retain the above copyright
1304+ notice, this list of conditions and the following disclaimer.
1305+ 2. Redistributions in binary form must reproduce the above copyright
1306+ notice, this list of conditions and the following disclaimer in the
1307+ documentation and/or other materials provided with the distribution.
1308+ 3. Neither the name of the author nor the names of other contributors
1309+ may be used to endorse or promote products derived from this software
1310+ without specific prior written permission.
1311+
1312+ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND
1313+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1314+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1315+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
1316+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1317+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1318+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1319+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1320+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1321+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1322+ SUCH DAMAGE.
1323+
1324+syb LICENSE file:
1325+
1326+ This library (libraries/syb) is derived from code from several
1327+ sources:
1328+
1329+ * Code from the GHC project which is largely (c) The University of
1330+ Glasgow, and distributable under a BSD-style license (see below),
1331+
1332+ * Code from the Haskell 98 Report which is (c) Simon Peyton Jones
1333+ and freely redistributable (but see the full license for
1334+ restrictions).
1335+
1336+ * Code from the Haskell Foreign Function Interface specification,
1337+ which is (c) Manuel M. T. Chakravarty and freely redistributable
1338+ (but see the full license for restrictions).
1339+
1340+ The full text of these licenses is reproduced below. All of the
1341+ licenses are BSD-style or compatible.
1342+
1343+ -----------------------------------------------------------------------------
1344+
1345+ The Glasgow Haskell Compiler License
1346+
1347+ Copyright 2004, The University Court of the University of Glasgow.
1348+ All rights reserved.
1349+
1350+ Redistribution and use in source and binary forms, with or without
1351+ modification, are permitted provided that the following conditions are met:
1352+
1353+ - Redistributions of source code must retain the above copyright notice,
1354+ this list of conditions and the following disclaimer.
1355+
1356+ - Redistributions in binary form must reproduce the above copyright notice,
1357+ this list of conditions and the following disclaimer in the documentation
1358+ and/or other materials provided with the distribution.
1359+
1360+ - Neither name of the University nor the names of its contributors may be
1361+ used to endorse or promote products derived from this software without
1362+ specific prior written permission.
1363+
1364+ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
1365+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
1366+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
1367+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
1368+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
1369+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1370+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
1371+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
1372+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1373+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1374+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
1375+ DAMAGE.
1376+
1377+ -----------------------------------------------------------------------------
1378+
1379+ Code derived from the document "Report on the Programming Language
1380+ Haskell 98", is distributed under the following license:
1381+
1382+ Copyright (c) 2002 Simon Peyton Jones
1383+
1384+ The authors intend this Report to belong to the entire Haskell
1385+ community, and so we grant permission to copy and distribute it for
1386+ any purpose, provided that it is reproduced in its entirety,
1387+ including this Notice. Modified versions of this Report may also be
1388+ copied and distributed for any purpose, provided that the modified
1389+ version is clearly presented as such, and that it does not claim to
1390+ be a definition of the Haskell 98 Language.
1391+
1392+ -----------------------------------------------------------------------------
1393+
1394+ Code derived from the document "The Haskell 98 Foreign Function
1395+ Interface, An Addendum to the Haskell 98 Report" is distributed under
1396+ the following license:
1397+
1398+ Copyright (c) 2002 Manuel M. T. Chakravarty
1399+
1400+ The authors intend this Report to belong to the entire Haskell
1401+ community, and so we grant permission to copy and distribute it for
1402+ any purpose, provided that it is reproduced in its entirety,
1403+ including this Notice. Modified versions of this Report may also be
1404+ copied and distributed for any purpose, provided that the modified
1405+ version is clearly presented as such, and that it does not claim to
1406+ be a definition of the Haskell 98 Foreign Function Interface.
1407+
1408+ -----------------------------------------------------------------------------
1409+
1410+template-haskell LICENSE file:
340
1411
1412+
341 The Glasgow Haskell Compiler License
1413 The Glasgow Haskell Compiler License
342−
1414+
343− Copyright 2004, The University Court of the University of Glasgow.
1415+ Copyright 2002-2007, The University Court of the University of Glasgow.
344 All rights reserved.
1416 All rights reserved.
345−
1417+
346 Redistribution and use in source and binary forms, with or without
1418 Redistribution and use in source and binary forms, with or without
347 modification, are permitted provided that the following conditions are met:
1419 modification, are permitted provided that the following conditions are met:
348−
1420+
349 - Redistributions of source code must retain the above copyright notice,
1421 - Redistributions of source code must retain the above copyright notice,
350 this list of conditions and the following disclaimer.
1422 this list of conditions and the following disclaimer.
351−
1423+
352 - Redistributions in binary form must reproduce the above copyright notice,
1424 - Redistributions in binary form must reproduce the above copyright notice,
353 this list of conditions and the following disclaimer in the documentation
1425 this list of conditions and the following disclaimer in the documentation
354 and/or other materials provided with the distribution.
1426 and/or other materials provided with the distribution.
355−
1427+
356 - Neither name of the University nor the names of its contributors may be
1428 - Neither name of the University nor the names of its contributors may be
357 used to endorse or promote products derived from this software without
1429 used to endorse or promote products derived from this software without
358 specific prior written permission.
1430 specific prior written permission.
359−
1431+
360 THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
1432 THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
361 GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
1433 GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
362 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
1434 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
@@ -369,28 +1441,51 @@ mtl LICENSE file:
369 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1441 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
370 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
1442 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
371 DAMAGE.
1443 DAMAGE.
1444+
372
1445
373−optparse-applicative LICENSE file:
1446+terminfo LICENSE file:
374−
375− Copyright (c) 2012, Paolo Capriotti
376−
377− All rights reserved.
378
1447
1448+ Copyright 2007, Judah Jacobson.
1449+ All Rights Reserved.
1450+
379 Redistribution and use in source and binary forms, with or without
1451 Redistribution and use in source and binary forms, with or without
380 modification, are permitted provided that the following conditions are met:
1452 modification, are permitted provided that the following conditions are met:
1453+
1454+ - Redistribution of source code must retain the above copyright notice,
1455+ this list of conditions and the following disclamer.
1456+
1457+ - Redistribution in binary form must reproduce the above copyright notice,
1458+ this list of conditions and the following disclamer in the documentation
1459+ and/or other materials provided with the distribution.
1460+
1461+ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY
1462+ EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
1463+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
1464+ DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE CONTRIBUTORS BE LIABLE
1465+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1466+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
1467+ SERVICES; LOSS OF USE, DATA OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
1468+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
1469+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
1470+ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1471+
1472+text LICENSE file:
381
1473
1474+ Copyright (c) 2008-2009, Tom Harper
1475+ All rights reserved.
1476+
1477+ Redistribution and use in source and binary forms, with or without
1478+ modification, are permitted provided that the following conditions
1479+ are met:
1480+
382 * Redistributions of source code must retain the above copyright
1481 * Redistributions of source code must retain the above copyright
383 notice, this list of conditions and the following disclaimer.
1482 notice, this list of conditions and the following disclaimer.
384−
1483+
385 * Redistributions in binary form must reproduce the above
1484 * Redistributions in binary form must reproduce the above
386 copyright notice, this list of conditions and the following
1485 copyright notice, this list of conditions and the following
387 disclaimer in the documentation and/or other materials provided
1486 disclaimer in the documentation and/or other materials provided
388 with the distribution.
1487 with the distribution.
389−
1488+
390− * Neither the name of Paolo Capriotti nor the names of other
391− contributors may be used to endorse or promote products derived
392− from this software without specific prior written permission.
393−
394 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1489 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
395 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1490 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
396 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1491 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -403,89 +1498,40 @@ optparse-applicative LICENSE file:
403 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1498 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
404 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1499 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
405
1500
406−parsec LICENSE file:
1501+time LICENSE file:
407−
408− Copyright 1999-2000, Daan Leijen; 2007, Paolo Martini. All rights reserved.
409−
410− Redistribution and use in source and binary forms, with or without
411− modification, are permitted provided that the following conditions are met:
412−
413− * Redistributions of source code must retain the above copyright notice,
414− this list of conditions and the following disclaimer.
415− * Redistributions in binary form must reproduce the above copyright
416− notice, this list of conditions and the following disclaimer in the
417− documentation and/or other materials provided with the distribution.
418−
419− This software is provided by the copyright holders "as is" and any express or
420− implied warranties, including, but not limited to, the implied warranties of
421− merchantability and fitness for a particular purpose are disclaimed. In no
422− event shall the copyright holders be liable for any direct, indirect,
423− incidental, special, exemplary, or consequential damages (including, but not
424− limited to, procurement of substitute goods or services; loss of use, data,
425− or profits; or business interruption) however caused and on any theory of
426− liability, whether in contract, strict liability, or tort (including
427− negligence or otherwise) arising in any way out of the use of this software,
428− even if advised of the possibility of such damage.
429−
430−pattern-arrows LICENSE file:
431−
432− The MIT License (MIT)
433−
434− Copyright (c) 2013 Phil Freeman
435−
436− Permission is hereby granted, free of charge, to any person obtaining a copy of
437− this software and associated documentation files (the "Software"), to deal in
438− the Software without restriction, including without limitation the rights to
439− use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
440− the Software, and to permit persons to whom the Software is furnished to do so,
441− subject to the following conditions:
442−
443− The above copyright notice and this permission notice shall be included in all
444− copies or substantial portions of the Software.
445−
446− THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
447− IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
448− FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
449− COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
450− IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
451− CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
452−
453−process LICENSE file:
454−
455− This library (libraries/process) is derived from code from two
456− sources:
457−
458− * Code from the GHC project which is largely (c) The University of
459− Glasgow, and distributable under a BSD-style license (see below),
460−
461− * Code from the Haskell 98 Report which is (c) Simon Peyton Jones
462− and freely redistributable (but see the full license for
463− restrictions).
464
1502
465− The full text of these licenses is reproduced below. Both of the
1503+ TimeLib is Copyright (c) Ashley Yakeley, 2004-2014. All rights reserved.
466− licenses are BSD-style or compatible.
1504+ Certain sections are Copyright 2004, The University Court of the University of Glasgow. All rights reserved.
1505+
1506+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1507+
1508+ - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
1509+
1510+ - Neither name of the copyright holders nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
1511+
1512+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
467
1513
468− -----------------------------------------------------------------------------
1514+transformers LICENSE file:
469
1515
470 The Glasgow Haskell Compiler License
1516 The Glasgow Haskell Compiler License
471−
1517+
472 Copyright 2004, The University Court of the University of Glasgow.
1518 Copyright 2004, The University Court of the University of Glasgow.
473 All rights reserved.
1519 All rights reserved.
474−
1520+
475 Redistribution and use in source and binary forms, with or without
1521 Redistribution and use in source and binary forms, with or without
476 modification, are permitted provided that the following conditions are met:
1522 modification, are permitted provided that the following conditions are met:
477−
1523+
478 - Redistributions of source code must retain the above copyright notice,
1524 - Redistributions of source code must retain the above copyright notice,
479 this list of conditions and the following disclaimer.
1525 this list of conditions and the following disclaimer.
480−
1526+
481 - Redistributions in binary form must reproduce the above copyright notice,
1527 - Redistributions in binary form must reproduce the above copyright notice,
482 this list of conditions and the following disclaimer in the documentation
1528 this list of conditions and the following disclaimer in the documentation
483 and/or other materials provided with the distribution.
1529 and/or other materials provided with the distribution.
484−
1530+
485 - Neither name of the University nor the names of its contributors may be
1531 - Neither name of the University nor the names of its contributors may be
486 used to endorse or promote products derived from this software without
1532 used to endorse or promote products derived from this software without
487 specific prior written permission.
1533 specific prior written permission.
488−
1534+
489 THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
1535 THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
490 GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
1536 GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
491 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
1537 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
@@ -499,57 +1545,60 @@ process LICENSE file:
499 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
1545 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
500 DAMAGE.
1546 DAMAGE.
501
1547
502− -----------------------------------------------------------------------------
503−
504− Code derived from the document "Report on the Programming Language
505− Haskell 98", is distributed under the following license:
506−
507− Copyright (c) 2002 Simon Peyton Jones
508−
509− The authors intend this Report to belong to the entire Haskell
510− community, and so we grant permission to copy and distribute it for
511− any purpose, provided that it is reproduced in its entirety,
512− including this Notice. Modified versions of this Report may also be
513− copied and distributed for any purpose, provided that the modified
514− version is clearly presented as such, and that it does not claim to
515− be a definition of the Haskell 98 Language.
516−
517− -----------------------------------------------------------------------------
518−
519−time LICENSE file:
1548+transformers-compat LICENSE file:
520−
521− TimeLib is Copyright (c) Ashley Yakeley, 2004-2014. All rights reserved.
522− Certain sections are Copyright 2004, The University Court of the University of Glasgow. All rights reserved.
523−
524− Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
525−
526− - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
527−
528− - Neither name of the copyright holders nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
529
1549
530− THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1550+ Copyright 2012 Edward Kmett
1551+
1552+ All rights reserved.
1553+
1554+ Redistribution and use in source and binary forms, with or without
1555+ modification, are permitted provided that the following conditions
1556+ are met:
1557+
1558+ 1. Redistributions of source code must retain the above copyright
1559+ notice, this list of conditions and the following disclaimer.
1560+
1561+ 2. Redistributions in binary form must reproduce the above copyright
1562+ notice, this list of conditions and the following disclaimer in the
1563+ documentation and/or other materials provided with the distribution.
1564+
1565+ 3. Neither the name of the author nor the names of his contributors
1566+ may be used to endorse or promote products derived from this software
1567+ without specific prior written permission.
1568+
1569+ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
1570+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
1571+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
1572+ DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
1573+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1574+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1575+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1576+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
1577+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
1578+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
1579+ POSSIBILITY OF SUCH DAMAGE.
531
1580
532−transformers LICENSE file:
1581+unix LICENSE file:
533
1582
534 The Glasgow Haskell Compiler License
1583 The Glasgow Haskell Compiler License
535−
1584+
536− Copyright 2004, The University Court of the University of Glasgow.
1585+ Copyright 2004, The University Court of the University of Glasgow.
537 All rights reserved.
1586 All rights reserved.
538−
1587+
539 Redistribution and use in source and binary forms, with or without
1588 Redistribution and use in source and binary forms, with or without
540 modification, are permitted provided that the following conditions are met:
1589 modification, are permitted provided that the following conditions are met:
541−
1590+
542 - Redistributions of source code must retain the above copyright notice,
1591 - Redistributions of source code must retain the above copyright notice,
543 this list of conditions and the following disclaimer.
1592 this list of conditions and the following disclaimer.
544−
1593+
545 - Redistributions in binary form must reproduce the above copyright notice,
1594 - Redistributions in binary form must reproduce the above copyright notice,
546 this list of conditions and the following disclaimer in the documentation
1595 this list of conditions and the following disclaimer in the documentation
547 and/or other materials provided with the distribution.
1596 and/or other materials provided with the distribution.
548−
1597+
549 - Neither name of the University nor the names of its contributors may be
1598 - Neither name of the University nor the names of its contributors may be
550 used to endorse or promote products derived from this software without
1599 used to endorse or promote products derived from this software without
551− specific prior written permission.
1600+ specific prior written permission.
552−
1601+
553 THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
1602 THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
554 GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
1603 GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
555 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
1604 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
@@ -566,24 +1615,24 @@ transformers LICENSE file:
566unordered-containers LICENSE file:
1615unordered-containers LICENSE file:
567
1616
568 Copyright (c) 2010, Johan Tibell
1617 Copyright (c) 2010, Johan Tibell
569−
1618+
570 All rights reserved.
1619 All rights reserved.
571−
1620+
572 Redistribution and use in source and binary forms, with or without
1621 Redistribution and use in source and binary forms, with or without
573 modification, are permitted provided that the following conditions are met:
1622 modification, are permitted provided that the following conditions are met:
574−
1623+
575 * Redistributions of source code must retain the above copyright
1624 * Redistributions of source code must retain the above copyright
576 notice, this list of conditions and the following disclaimer.
1625 notice, this list of conditions and the following disclaimer.
577−
1626+
578 * Redistributions in binary form must reproduce the above
1627 * Redistributions in binary form must reproduce the above
579 copyright notice, this list of conditions and the following
1628 copyright notice, this list of conditions and the following
580 disclaimer in the documentation and/or other materials provided
1629 disclaimer in the documentation and/or other materials provided
581 with the distribution.
1630 with the distribution.
582−
1631+
583 * Neither the name of Johan Tibell nor the names of other
1632 * Neither the name of Johan Tibell nor the names of other
584 contributors may be used to endorse or promote products derived
1633 contributors may be used to endorse or promote products derived
585 from this software without specific prior written permission.
1634 from this software without specific prior written permission.
586−
1635+
587 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1636 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
588 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1637 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
589 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1638 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -623,62 +1672,69 @@ utf8-string LICENSE file:
623 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
1672 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
624 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1673 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
625
1674
626−split LICENSE file:
1675+vector LICENSE file:
627−
628− Copyright (c) 2008 Brent Yorgey, Louis Wasserman
629
1676
1677+ Copyright (c) 2008-2012, Roman Leshchinskiy
630 All rights reserved.
1678 All rights reserved.
631−
1679+
632 Redistribution and use in source and binary forms, with or without
1680 Redistribution and use in source and binary forms, with or without
633− modification, are permitted provided that the following conditions
1681+ modification, are permitted provided that the following conditions are met:
634− are met:
1682+
635− 1. Redistributions of source code must retain the above copyright
1683+ - Redistributions of source code must retain the above copyright notice,
636− notice, this list of conditions and the following disclaimer.
1684+ this list of conditions and the following disclaimer.
1685+
637− 2. Redistributions in binary form must reproduce the above copyright
1686+ - Redistributions in binary form must reproduce the above copyright notice,
638− notice, this list of conditions and the following disclaimer in the
1687+ this list of conditions and the following disclaimer in the documentation
639− documentation and/or other materials provided with the distribution.
1688+ and/or other materials provided with the distribution.
1689+
640− 3. Neither the name of the author nor the names of other contributors
1690+ - Neither name of the University nor the names of its contributors may be
641− may be used to endorse or promote products derived from this software
1691+ used to endorse or promote products derived from this software without
642− without specific prior written permission.
1692+ specific prior written permission.
643−
1693+
644− THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND
1694+ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
645− ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1695+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
646− IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1696+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
647− ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
1697+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
1698+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
648 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1699 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
649− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1700+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
650− OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1701+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
651− HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1702+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
652 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1703 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
653− OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1704+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
654− SUCH DAMAGE.
1705+ DAMAGE.
655−
1706+
656−boxes LICENSE file:
657
1707
658− Copyright (c) Brent Yorgey 2008
1708+void LICENSE file:
659
1709
1710+ Copyright 2013 Edward Kmett
1711+
1712+ All rights reserved.
1713+
660 Redistribution and use in source and binary forms, with or without
1714 Redistribution and use in source and binary forms, with or without
661 modification, are permitted provided that the following conditions
1715 modification, are permitted provided that the following conditions
662 are met:
1716 are met:
1717+
663 1. Redistributions of source code must retain the above copyright
1718 1. Redistributions of source code must retain the above copyright
664 notice, this list of conditions and the following disclaimer.
1719 notice, this list of conditions and the following disclaimer.
1720+
665 2. Redistributions in binary form must reproduce the above copyright
1721 2. Redistributions in binary form must reproduce the above copyright
666 notice, this list of conditions and the following disclaimer in the
1722 notice, this list of conditions and the following disclaimer in the
667 documentation and/or other materials provided with the distribution.
1723 documentation and/or other materials provided with the distribution.
1724+
668− 3. Neither the name of the author nor the names of other contributors
1725+ 3. Neither the name of the author nor the names of his contributors
669 may be used to endorse or promote products derived from this software
1726 may be used to endorse or promote products derived from this software
670 without specific prior written permission.
1727 without specific prior written permission.
671−
1728+
672− All other rights are reserved.
673−
674− THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND
1729+ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
675− ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1730+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
676− IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1731+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
677− ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
1732+ DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
678− FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1733+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
679 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1734 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
680 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1735 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
681− HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1736+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
682− LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1737+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
683− OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1738+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
684− SUCH DAMAGE.
1739+ POSSIBILITY OF SUCH DAMAGE.
1740+
examples/manual/passing/ExportedInstanceDeclarations.pursnew file+41
@@ -0,0 +1,41 @@
1+
2+-- Tests that instances for non-exported classes / types do not appear in the
3+-- result of `exportedDeclarations`.
4+
5+module ExportedInstanceDeclarations
6+ ( Const(..)
7+ , Foo
8+ , foo
9+ ) where
10+
11+data Const a b = Const a
12+
13+class Foo a where
14+ foo :: a
15+
16+data NonexportedType = NonexportedType
17+
18+class NonexportedClass a where
19+ notExported :: a
20+
21+-- There are three places that a nonexported type or type class can occur,
22+-- leading an instance to count as non-exported:
23+-- * Constraints
24+-- * The type class itself
25+-- * The instance types
26+
27+-- Case 1: constraints
28+instance nonExportedFoo :: (NonexportedClass a) => Foo a where
29+ foo = notExported
30+
31+-- Another instance of case 1:
32+instance nonExportedFoo2 :: (Foo NonexportedType) => Foo (a -> a) where
33+ foo = id
34+
35+-- Case 2: type class
36+instance nonExportedNonexportedType :: NonexportedClass (Const Number a) where
37+ notExported = Const 0
38+
39+-- Case 3: instance types
40+instance constFoo :: Foo (Const NonexportedType b) where
41+ foo = Const NonexportedType
get-dependency-licencesnew file+13
@@ -0,0 +1,13 @@
1+#!/bin/bash
2+set -e # exit on error
3+set -u # exit on undefined variable
4+set -o pipefail # propagate nonzero exit codes through pipelines
5+
6+while read dep; do
7+ echo "fetching: ${dep}" >&2
8+ echo "${dep} LICENSE file:"
9+ echo ""
10+ curl --silent "https://hackage.haskell.org/package/${dep}/src/LICENSE" \
11+ | sed 's/^/ /g' # indent by 2 characters
12+ echo ""
13+done
license/generatenew file+44
@@ -0,0 +1,44 @@
1+#!/bin/bash
2+# Generates the LICENSE file and prints it to standard output.
3+# Example use:
4+#
5+# ./license/generate > LICENSE
6+#
7+
8+set -e # exit on error
9+set -u # exit on undefined variable
10+set -o pipefail # propagate nonzero exit codes through pipelines
11+
12+if ! which cabal-dependency-licenses >/dev/null; then
13+ echo "$0: the program 'cabal-dependency-licenses' is required." >&2
14+ echo "$0: see Hackage: https://hackage.haskell.org/package/cabal-dependency-licenses" >&2
15+ exit 1
16+fi
17+
18+echo_header() {
19+ cat license/header.txt
20+}
21+
22+echo_deps_names() {
23+ cabal-dependency-licenses \
24+ | grep '^- ' | sed 's/^..//' | sort -h
25+}
26+
27+echo_deps_licenses() {
28+ while read dep; do
29+ echo "fetching LICENSE for: ${dep}" >&2
30+ echo "${dep} LICENSE file:"
31+ echo ""
32+ curl --silent "https://hackage.haskell.org/package/${dep}/src/LICENSE" \
33+ | sed 's/^/ /g' # indent by 2 characters
34+ echo ""
35+ done
36+}
37+
38+echo_deps_names > license/tmp/deps.txt
39+
40+echo_header
41+echo ""
42+sed <license/tmp/deps.txt 's/^/ /'
43+echo ""
44+echo_deps_licenses <license/tmp/deps.txt
license/header.txtnew file+23
@@ -0,0 +1,23 @@
1+The MIT License (MIT)
2+
3+Copyright (c) 2013-15 Phil Freeman, (c) 2014-2015 Gary Burgess, and other
4+contributors
5+
6+Permission is hereby granted, free of charge, to any person obtaining a copy of
7+this software and associated documentation files (the "Software"), to deal in
8+the Software without restriction, including without limitation the rights to
9+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
10+the Software, and to permit persons to whom the Software is furnished to do so,
11+subject to the following conditions:
12+
13+The above copyright notice and this permission notice shall be included in all
14+copies or substantial portions of the Software.
15+
16+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
18+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
19+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22+
23+PureScript uses the following Haskell library packages. Their license files follow.
license/tmp/.gitkeepnew file

No changes to the content.

psc-docs/Main.hs+168−190
@@ -1,3 +1,4 @@
1+{-# LANGUAGE TupleSections #-}
1----------------------------------------------------------------------------
2----------------------------------------------------------------------------
2--
3--
3-- Module : Main
4-- Module : Main
@@ -15,223 +16,127 @@
15module Main where
16module Main where
16
17
17import Control.Applicative
18import Control.Applicative
18−import Control.Monad
19import Control.Monad.Writer
19import Control.Monad.Writer
20−import Control.Arrow (first)
20+import Control.Arrow (first, second)
21+import Control.Category ((>>>))
21import Data.List
22import Data.List
22import Data.Maybe (fromMaybe)
23import Data.Maybe (fromMaybe)
23import Data.Version (showVersion)
24import Data.Version (showVersion)
24−import Data.Foldable (traverse_)
25
25
26import Options.Applicative
26import Options.Applicative
27+import qualified Text.PrettyPrint.ANSI.Leijen as PP
27
28
28import qualified Language.PureScript as P
29import qualified Language.PureScript as P
29import qualified Paths_purescript as Paths
30import qualified Paths_purescript as Paths
30−import System.Exit (exitSuccess, exitFailure)
31+import System.Exit (exitFailure)
31import System.IO (hPutStrLn, stderr)
32import System.IO (hPutStrLn, stderr)
32
33
33import Etags
34import Etags
34import Ctags
35import Ctags
36+import qualified Language.PureScript.Docs as D
37+import qualified Language.PureScript.Docs.AsMarkdown as D
35
38
36-- Available output formats
39-- Available output formats
37data Format = Markdown -- Output documentation in Markdown format
40data Format = Markdown -- Output documentation in Markdown format
38 | Ctags -- Output ctags symbol index suitable for use with vi
41 | Ctags -- Output ctags symbol index suitable for use with vi
39 | Etags -- Output etags symbol index suitable for use with emacs
42 | Etags -- Output etags symbol index suitable for use with emacs
43+ deriving (Show, Eq, Ord)
44+
45+-- | Available methods of outputting Markdown documentation
46+data DocgenOutput
47+ = EverythingToStdOut
48+ | ToStdOut [P.ModuleName]
49+ | ToFiles [(P.ModuleName, FilePath)]
50+ deriving (Show)
40
51
41data PSCDocsOptions = PSCDocsOptions
52data PSCDocsOptions = PSCDocsOptions
42 { pscdFormat :: Format
53 { pscdFormat :: Format
43 , pscdInputFiles :: [FilePath]
54 , pscdInputFiles :: [FilePath]
55+ , pscdDocgen :: DocgenOutput
44 }
56 }
57+ deriving (Show)
45
58
46docgen :: PSCDocsOptions -> IO ()
59docgen :: PSCDocsOptions -> IO ()
47−docgen (PSCDocsOptions fmt input) = do
60+docgen (PSCDocsOptions fmt input output) =
48− e <- P.parseModulesFromFiles (fromMaybe "") <$> mapM (fmap (first Just) . parseFile) (nub input)
49− case e of
61+ case fmt of
50− Left err -> do
51− hPutStrLn stderr $ show err
52− exitFailure
53− Right ms -> do
54− case fmt of
55− Markdown -> putStrLn . runDocs $ renderModules (map snd ms)
56− Etags -> ldump $ dumpEtags $ pairs ms
62+ Etags -> dumpTags input dumpEtags
57− Ctags -> ldump $ dumpCtags $ pairs ms
63+ Ctags -> dumpTags input dumpCtags
58− exitSuccess
64+ Markdown -> do
59− where pairs :: [(Maybe String, m)] -> [(String, m)]
65+ e <- D.parseAndDesugar input [] (\_ ms -> return ms)
60− pairs = map (\(k,m) -> (fromMaybe "" k,m))
66+ case e of
61− ldump :: [String] -> IO ()
67+ Left (D.ParseError err) -> do
62− ldump = mapM_ putStrLn
68+ hPutStrLn stderr $ show err
63−
69+ exitFailure
64−parseFile :: FilePath -> IO (FilePath, String)
70+ Left (D.SortModulesError err) -> do
65−parseFile input = (,) input <$> readFile input
71+ hPutStrLn stderr $ P.prettyPrintMultipleErrors False err
66−
72+ exitFailure
67−type Docs = Writer [String] ()
73+ Left (D.DesugarError err) -> do
68−
74+ hPutStrLn stderr $ P.prettyPrintMultipleErrors False err
69−runDocs :: Docs -> String
75+ exitFailure
70−runDocs = unlines . execWriter
76+ Right ms' -> do
71−
77+ case output of
72−spacer :: Docs
78+ EverythingToStdOut ->
73−spacer = tell [""]
79+ putStrLn (D.renderModulesAsMarkdown ms')
74−
80+ ToStdOut names -> do
75−headerLevel :: Int -> String -> Docs
81+ let (ms, missing) = takeModulesByName ms' names
76−headerLevel level hdr = tell [replicate level '#' ++ ' ' : hdr]
82+ guardMissing missing
77−
83+ putStrLn (D.renderModulesAsMarkdown ms)
78−withIndent :: Int -> Docs -> Docs
84+ ToFiles names -> do
79−withIndent indent = censor (map (replicate indent ' ' ++ ))
85+ let (ms, missing) = takeModulesByName' ms' names
86+ guardMissing missing
87+ forM_ ms $ \(m, fp) ->
88+ writeFile fp (D.renderModulesAsMarkdown [m])
80
89
81−atIndent :: Int -> String -> Docs
82−atIndent indent text =
83− let ls = lines text in
84− withIndent indent (tell ls)
85−
86−fenced :: String -> Docs
87−fenced text = fencedBlock (tell $ lines text)
88−
89−fencedBlock :: Docs -> Docs
90−fencedBlock inner = do
91− tell ["``` purescript"]
92− inner
93− tell ["```"]
94−
95−ticks :: String -> String
96−ticks = ("`" ++) . (++ "`")
97−
98−renderModules :: [P.Module] -> Docs
99−renderModules ms = do
100− headerLevel 1 "Module Documentation"
101− spacer
102− mapM_ renderModule ms
103−
104−renderModule :: P.Module -> Docs
105−renderModule mdl@(P.Module coms moduleName _ exps) = do
106− headerLevel 2 $ "Module " ++ P.runModuleName moduleName
107− spacer
108− unless (null coms) $ do
109− renderComments coms
110− spacer
111− renderTopLevel exps (P.exportedDeclarations mdl)
112− spacer
113−
114−renderTopLevel :: Maybe [P.DeclarationRef] -> [P.Declaration] -> Docs
115−renderTopLevel exps decls = forM_ decls $ \decl ->
116− when (canRenderDecl decl) $ do
117− traverse_ (headerLevel 4) (ticks `fmap` getDeclarationTitle decl)
118− spacer
119− renderDeclaration exps decl
120− spacer
121−
122−renderTypeclassImage :: P.ModuleName -> Docs
123−renderTypeclassImage name =
124− let name' = P.runModuleName name
125− in tell ["![" ++ name' ++ "](images/" ++ name' ++ ".png)"]
126−
127−getDeclarationTitle :: P.Declaration -> Maybe String
128−getDeclarationTitle (P.TypeDeclaration name _) = Just (show name)
129−getDeclarationTitle (P.ExternDeclaration _ name _ _) = Just (show name)
130−getDeclarationTitle (P.DataDeclaration _ name _ _) = Just (show name)
131−getDeclarationTitle (P.ExternDataDeclaration name _) = Just (show name)
132−getDeclarationTitle (P.TypeSynonymDeclaration name _ _) = Just (show name)
133−getDeclarationTitle (P.TypeClassDeclaration name _ _ _) = Just (show name)
134−getDeclarationTitle (P.TypeInstanceDeclaration name _ _ _ _) = Just (show name)
135−getDeclarationTitle (P.PositionedDeclaration _ _ d) = getDeclarationTitle d
136−getDeclarationTitle _ = Nothing
137−
138−renderDeclaration :: Maybe [P.DeclarationRef] -> P.Declaration -> Docs
139−renderDeclaration _ (P.TypeDeclaration ident ty) =
140− fenced $ show ident ++ " :: " ++ prettyPrintType' ty
141−renderDeclaration _ (P.ExternDeclaration _ ident _ ty) =
142− fenced $ show ident ++ " :: " ++ prettyPrintType' ty
143−renderDeclaration exps (P.DataDeclaration dtype name args ctors) = do
144− let
145− typeApp = foldl P.TypeApp (P.TypeConstructor (P.Qualified Nothing name)) (map toTypeVar args)
146− typeName = prettyPrintType' typeApp
147− exported = filter (P.isDctorExported name exps . fst) ctors
148− fencedBlock $ do
149− tell [show dtype ++ " " ++ typeName]
150− zipWithM_ (\isFirst (ctor, tys) ->
151− atIndent 2 $ (if isFirst then "= " else "| ") ++ P.runProperName ctor ++ " " ++ unwords (map P.prettyPrintTypeAtom tys))
152− (True : repeat False) exported
153−renderDeclaration _ (P.ExternDataDeclaration name kind) =
154− fenced $ "data " ++ P.runProperName name ++ " :: " ++ P.prettyPrintKind kind
155−renderDeclaration _ (P.TypeSynonymDeclaration name args ty) = do
156− let
157− typeApp = foldl P.TypeApp (P.TypeConstructor (P.Qualified Nothing name)) (map toTypeVar args)
158− typeName = prettyPrintType' typeApp
159− fenced $ "type " ++ typeName ++ " = " ++ prettyPrintType' ty
160−renderDeclaration _ (P.TypeClassDeclaration name args implies ds) = do
161− let impliesText = case implies of
162− [] -> ""
163− is -> "(" ++ intercalate ", " (map (\(pn, tys') -> show pn ++ " " ++ unwords (map P.prettyPrintTypeAtom tys')) is) ++ ") <= "
164− classApp = foldl P.TypeApp (P.TypeConstructor (P.Qualified Nothing name)) (map toTypeVar args)
165− className = prettyPrintType' classApp
166− fencedBlock $ do
167− tell ["class " ++ impliesText ++ className ++ " where"]
168− mapM_ renderClassMember ds
169 where
90 where
170− renderClassMember (P.PositionedDeclaration _ _ d) = renderClassMember d
91+ guardMissing [] = return ()
171− renderClassMember (P.TypeDeclaration ident ty) = atIndent 2 $ show ident ++ " :: " ++ prettyPrintType' ty
92+ guardMissing [mn] = do
172− renderClassMember _ = error "Invalid argument to renderClassMember."
93+ hPutStrLn stderr ("psc-docs: error: unknown module \"" ++ show mn ++ "\"")
173−renderDeclaration _ (P.TypeInstanceDeclaration name constraints className tys _) = do
94+ exitFailure
174− let constraintsText = case constraints of
95+ guardMissing mns = do
175− [] -> ""
96+ hPutStrLn stderr "psc-docs: error: unknown modules:"
176− cs -> "(" ++ intercalate ", " (map (\(pn, tys') -> show pn ++ " " ++ unwords (map P.prettyPrintTypeAtom tys')) cs) ++ ") => "
97+ forM_ mns $ \mn ->
177− fenced $ "instance " ++ show name ++ " :: " ++ constraintsText ++ show className ++ " " ++ unwords (map P.prettyPrintTypeAtom tys)
98+ hPutStrLn stderr (" * " ++ show mn)
178−renderDeclaration exps (P.PositionedDeclaration _ com d) = do
99+ exitFailure
179− renderDeclaration exps d
180− renderComments com
181−renderDeclaration _ _ = return ()
182−
183−renderComments :: [P.Comment] -> Docs
184−renderComments cs = do
185− let raw = concatMap toLines cs
186− when (all hasPipe raw) $ do
187− spacer
188− atIndent 0 . unlines . map stripPipes $ raw
189− where
190−
191− toLines (P.LineComment s) = [s]
192− toLines (P.BlockComment s) = lines s
193
100
194− hasPipe s = case dropWhile (== ' ') s of { ('|':_) -> True; _ -> False }
101+-- |
195−
102+-- Given a list of module names and a list of modules, return a list of modules
196− stripPipes = dropPipe . dropWhile (== ' ')
103+-- whose names appeared in the given name list, together with a list of names
104+-- for which no module could be found in the module list.
105+--
106+takeModulesByName :: [P.Module] -> [P.ModuleName] -> ([P.Module], [P.ModuleName])
107+takeModulesByName modules names =
108+ first (map fst) (takeModulesByName' modules (map (,()) names))
197
109
198− dropPipe ('|':' ':s) = s
110+-- |
199− dropPipe ('|':s) = s
111+-- Like takeModulesByName but also keeps some extra data with the module.
200− dropPipe s = s
112+--
113+takeModulesByName' :: [P.Module] -> [(P.ModuleName, a)] -> ([(P.Module, a)], [P.ModuleName])
114+takeModulesByName' modules = foldl go ([], [])
115+ where
116+ go (ms, missing) (name, x) =
117+ case find ((== name) . P.getModuleName) modules of
118+ Just m -> ((m, x) : ms, missing)
119+ Nothing -> (ms, name : missing)
201
120
202−toTypeVar :: (String, Maybe P.Kind) -> P.Type
121+dumpTags :: [FilePath] -> ([(String, P.Module)] -> [String]) -> IO ()
203−toTypeVar (s, Nothing) = P.TypeVar s
122+dumpTags input renderTags = do
204−toTypeVar (s, Just k) = P.KindedType (P.TypeVar s) k
123+ e <- P.parseModulesFromFiles (fromMaybe "") <$> mapM (fmap (first Just) . parseFile) (nub input)
124+ case e of
125+ Left err -> do
126+ hPutStrLn stderr (show err)
127+ exitFailure
128+ Right ms ->
129+ ldump (renderTags (pairs ms))
205
130
206−prettyPrintType' :: P.Type -> String
207−prettyPrintType' = P.prettyPrintType . P.everywhereOnTypes dePrim
208 where
131 where
209− dePrim ty@(P.TypeConstructor (P.Qualified _ name))
132+ pairs :: [(Maybe String, m)] -> [(String, m)]
210− | ty == P.tyBoolean || ty == P.tyNumber || ty == P.tyString || ty == P.tyChar || ty == P.tyInt =
133+ pairs = map (first (fromMaybe ""))
211− P.TypeConstructor $ P.Qualified Nothing name
212− dePrim other = other
213
134
214−getName :: P.Declaration -> String
135+ ldump :: [String] -> IO ()
215−getName (P.TypeDeclaration ident _) = show ident
136+ ldump = mapM_ putStrLn
216−getName (P.ExternDeclaration _ ident _ _) = show ident
217−getName (P.DataDeclaration _ name _ _) = P.runProperName name
218−getName (P.ExternDataDeclaration name _) = P.runProperName name
219−getName (P.TypeSynonymDeclaration name _ _) = P.runProperName name
220−getName (P.TypeClassDeclaration name _ _ _) = P.runProperName name
221−getName (P.TypeInstanceDeclaration name _ _ _ _) = show name
222−getName (P.PositionedDeclaration _ _ d) = getName d
223−getName _ = error "Invalid argument to getName"
224
137
225−canRenderDecl :: P.Declaration -> Bool
138+parseFile :: FilePath -> IO (FilePath, String)
226−canRenderDecl P.TypeDeclaration{} = True
139+parseFile input = (,) input <$> readFile input
227−canRenderDecl P.ExternDeclaration{} = True
228−canRenderDecl P.DataDeclaration{} = True
229−canRenderDecl P.ExternDataDeclaration{} = True
230−canRenderDecl P.TypeSynonymDeclaration{} = True
231−canRenderDecl P.TypeClassDeclaration{} = True
232−canRenderDecl P.TypeInstanceDeclaration{} = True
233−canRenderDecl (P.PositionedDeclaration _ _ d) = canRenderDecl d
234−canRenderDecl _ = False
235
140
236inputFile :: Parser FilePath
141inputFile :: Parser FilePath
237inputFile = strArgument $
142inputFile = strArgument $
@@ -242,24 +147,97 @@ instance Read Format where
242 readsPrec _ "etags" = [(Etags, "")]
147 readsPrec _ "etags" = [(Etags, "")]
243 readsPrec _ "ctags" = [(Ctags, "")]
148 readsPrec _ "ctags" = [(Ctags, "")]
244 readsPrec _ "markdown" = [(Markdown, "")]
149 readsPrec _ "markdown" = [(Markdown, "")]
245− readsPrec _ _ = []
150+ readsPrec _ _ = []
246
151
247format :: Parser Format
152format :: Parser Format
248format = option auto $ value Markdown
153format = option auto $ value Markdown
249 <> long "format"
154 <> long "format"
250 <> metavar "FORMAT"
155 <> metavar "FORMAT"
251− <> help "Set output FORMAT (markdown | etags | ctags)"
156+ <> help "Set output FORMAT (markdown | etags | ctags)"
252
157
158+docgenModule :: Parser String
159+docgenModule = strOption $
160+ long "docgen"
161+ <> help "A list of module names which should appear in the output. This can optionally include file paths to write individual modules to, by separating with a colon ':'. For example, Prelude:docs/Prelude.md. This option may be specified multiple times."
162+
253−pscDocsOptions :: Parser PSCDocsOptions
163+pscDocsOptions :: Parser (Format, [FilePath], [String])
254−pscDocsOptions = PSCDocsOptions <$> format <*> many inputFile
164+pscDocsOptions = (,,) <$> format <*> many inputFile <*> many docgenModule
165+
166+parseDocgen :: [String] -> Either String DocgenOutput
167+parseDocgen [] = Right EverythingToStdOut
168+parseDocgen xs = go xs
169+ where
170+ go = intersperse " "
171+ >>> concat
172+ >>> words
173+ >>> map parseItem
174+ >>> combine
175+
176+data DocgenOutputItem
177+ = IToStdOut P.ModuleName
178+ | IToFile (P.ModuleName, FilePath)
179+
180+parseItem :: String -> DocgenOutputItem
181+parseItem s = case elemIndex ':' s of
182+ Just i ->
183+ s # splitAt i
184+ >>> first P.moduleNameFromString
185+ >>> second (drop 1)
186+ >>> IToFile
187+ Nothing ->
188+ IToStdOut (P.moduleNameFromString s)
189+
190+ where
191+ infixr 1 #
192+ (#) = flip ($)
193+
194+combine :: [DocgenOutputItem] -> Either String DocgenOutput
195+combine [] = Right EverythingToStdOut
196+combine (x:xs) = foldM go (initial x) xs
197+ where
198+ initial (IToStdOut m) = ToStdOut [m]
199+ initial (IToFile m) = ToFiles [m]
200+
201+ go (ToStdOut ms) (IToStdOut m) = Right (ToStdOut (m:ms))
202+ go (ToFiles ms) (IToFile m) = Right (ToFiles (m:ms))
203+ go _ _ = Left "Can't mix module names and module name/file path pairs in the same invocation."
204+
205+buildOptions :: (Format, [FilePath], [String]) -> IO PSCDocsOptions
206+buildOptions (fmt, input, mapping) =
207+ case parseDocgen mapping of
208+ Right mapping' -> return (PSCDocsOptions fmt input mapping')
209+ Left err -> do
210+ hPutStrLn stderr "psc-docs: error in --docgen option:"
211+ hPutStrLn stderr (" " ++ err)
212+ exitFailure
255
213
256main :: IO ()
214main :: IO ()
257−main = execParser opts >>= docgen
215+main = execParser opts >>= buildOptions >>= docgen
258 where
216 where
259 opts = info (version <*> helper <*> pscDocsOptions) infoModList
217 opts = info (version <*> helper <*> pscDocsOptions) infoModList
260 infoModList = fullDesc <> headerInfo <> footerInfo
218 infoModList = fullDesc <> headerInfo <> footerInfo
261− headerInfo = header "psc-docs - Generate Markdown documentation from PureScript extern files"
219+ headerInfo = header "psc-docs - Generate Markdown documentation from PureScript source files"
220+ footerInfo = footerDoc $ Just $ PP.vcat
262− footerInfo = footer $ "psc-docs " ++ showVersion Paths.version
221+ [ examples, PP.empty, PP.text ("psc-docs " ++ showVersion Paths.version) ]
263
222
264 version :: Parser (a -> a)
223 version :: Parser (a -> a)
265 version = abortOption (InfoMsg (showVersion Paths.version)) $ long "version" <> help "Show the version number" <> hidden
224 version = abortOption (InfoMsg (showVersion Paths.version)) $ long "version" <> help "Show the version number" <> hidden
225+
226+examples :: PP.Doc
227+examples =
228+ PP.vcat $ map PP.text
229+ [ "Examples:"
230+ , " print documentation for Data.List to stdout:"
231+ , " psc-docs src/**/*.purs bower_components/*/src/**/*.purs \\"
232+ , " --docgen Data.List"
233+ , ""
234+ , " write documentation for Data.List to docs/Data.List.md:"
235+ , " psc-docs src/**/*.purs bower_components/*/src/**/*.purs \\"
236+ , " --docgen Data.List:docs/Data.List.md"
237+ , ""
238+ , " write documentation for Data.List to docs/Data.List.md, and"
239+ , " documentation for Data.List.Lazy to docs/Data.List.Lazy.md:"
240+ , " psc-docs src/**/*.purs bower_components/*/src/**/*.purs \\"
241+ , " --docgen Data.List:docs/Data.List.md \\"
242+ , " --docgen Data.List.Lazy:docs/Data.List.Lazy.md"
243+ ]
psc-publish/BoxesHelpers.hsnew file+38
@@ -0,0 +1,38 @@
1+module BoxesHelpers
2+ ( Boxes.Box
3+ , Boxes.nullBox
4+ , module BoxesHelpers
5+ ) where
6+
7+import System.IO (hPutStr, stderr)
8+import qualified Text.PrettyPrint.Boxes as Boxes
9+
10+width :: Int
11+width = 79
12+
13+indentWidth :: Int
14+indentWidth = 2
15+
16+para :: String -> Boxes.Box
17+para = Boxes.para Boxes.left width
18+
19+indented :: Boxes.Box -> Boxes.Box
20+indented b = Boxes.hcat Boxes.left [Boxes.emptyBox 1 indentWidth, b]
21+
22+successivelyIndented :: [String] -> Boxes.Box
23+successivelyIndented [] =
24+ Boxes.nullBox
25+successivelyIndented (x:xs) =
26+ Boxes.vcat Boxes.left [para x, indented (successivelyIndented xs)]
27+
28+vcat :: [Boxes.Box] -> Boxes.Box
29+vcat = Boxes.vcat Boxes.left
30+
31+spacer :: Boxes.Box
32+spacer = Boxes.emptyBox 1 1
33+
34+bulletedList :: (a -> String) -> [a] -> [Boxes.Box]
35+bulletedList f = map (indented . para . ("* " ++) . f)
36+
37+printToStderr :: Boxes.Box -> IO ()
38+printToStderr = hPutStr stderr . Boxes.render
psc-publish/ErrorsWarnings.hsnew file+317
@@ -0,0 +1,317 @@
1+{-# LANGUAGE OverloadedStrings #-}
2+
3+module ErrorsWarnings where
4+
5+import Data.Aeson.BetterErrors
6+import Data.Version
7+import Data.Maybe
8+import Data.List (intersperse)
9+import Data.List.NonEmpty (NonEmpty(..))
10+import qualified Data.List.NonEmpty as NonEmpty
11+
12+import qualified Data.Text as T
13+
14+import Control.Exception (IOException)
15+import Web.Bower.PackageMeta (BowerError, PackageName, runPackageName)
16+import qualified Web.Bower.PackageMeta as Bower
17+
18+import qualified Language.PureScript as P
19+import qualified Language.PureScript.Docs as D
20+
21+import BoxesHelpers
22+
23+-- | An error which meant that it was not possible to retrieve metadata for a
24+-- package.
25+data PackageError
26+ = UserError UserError
27+ | InternalError InternalError
28+ | OtherError OtherError
29+ deriving (Show)
30+
31+data PackageWarning
32+ = ResolutionNotVersion PackageName
33+ | UndeclaredDependency PackageName
34+ deriving (Show)
35+
36+-- | An error that should be fixed by the user.
37+data UserError
38+ = BowerJSONNotFound
39+ | CouldntParseBowerJSON (ParseError BowerError)
40+ | BowerJSONNameMissing
41+ | TagMustBeCheckedOut
42+ | AmbiguousVersions [Version] -- Invariant: should contain at least two elements
43+ | BadRepositoryField RepositoryFieldError
44+ | MissingDependencies (NonEmpty PackageName)
45+ | ParseAndDesugarError D.ParseDesugarError
46+ deriving (Show)
47+
48+data RepositoryFieldError
49+ = RepositoryFieldMissing
50+ | BadRepositoryType String
51+ | NotOnGithub
52+ deriving (Show)
53+
54+-- | An error that probably indicates a bug in this module.
55+data InternalError
56+ = JSONError JSONSource (ParseError BowerError)
57+ deriving (Show)
58+
59+data JSONSource
60+ = FromFile FilePath
61+ | FromBowerList
62+ deriving (Show)
63+
64+data OtherError
65+ = ProcessFailed String [String] IOException
66+ | IOExceptionThrown IOException
67+ deriving (Show)
68+
69+printError :: PackageError -> IO ()
70+printError = printToStderr . renderError
71+
72+renderError :: PackageError -> Box
73+renderError err =
74+ case err of
75+ UserError e ->
76+ vcat
77+ [ para (concat
78+ [ "There is a problem with your package, which meant that "
79+ , "it could not be published."
80+ ])
81+ , para "Details:"
82+ , indented (displayUserError e)
83+ ]
84+ InternalError e ->
85+ vcat
86+ [ para "Internal error: this is probably a bug. Please report it:"
87+ , indented (para "https://github.com/purescript/purescript/issues/new")
88+ , spacer
89+ , para "Details:"
90+ , successivelyIndented (displayInternalError e)
91+ ]
92+ OtherError e ->
93+ vcat
94+ [ para "An error occurred, and your package could not be published."
95+ , para "Details:"
96+ , indented (displayOtherError e)
97+ ]
98+
99+displayUserError :: UserError -> Box
100+displayUserError e = case e of
101+ BowerJSONNotFound ->
102+ para (concat
103+ [ "The bower.json file was not found. Please create one, or run "
104+ , "`pulp init`."
105+ ])
106+ CouldntParseBowerJSON err ->
107+ vcat
108+ [ successivelyIndented
109+ [ "The bower.json file could not be parsed as JSON:"
110+ , "aeson reported: " ++ show err
111+ ]
112+ , para "Please ensure that your bower.json file is valid JSON."
113+ ]
114+ BowerJSONNameMissing ->
115+ vcat
116+ [ successivelyIndented
117+ [ "In bower.json:"
118+ , "the \"name\" key was not found."
119+ ]
120+ , para "Please give your package a name first."
121+ ]
122+ TagMustBeCheckedOut ->
123+ vcat
124+ [ para (concat
125+ [ "psc-publish requires a tagged version to be checked out in "
126+ , "order to build documentation, and no suitable tag was found. "
127+ , "Please check out a previously tagged version, or tag a new "
128+ , "version."
129+ ])
130+ , spacer
131+ , para "Note: tagged versions must be in one of the following forms:"
132+ , indented (para "* v{MAJOR}.{MINOR}.{PATCH} (example: \"v1.6.2\")")
133+ , indented (para "* {MAJOR}.{MINOR}.{PATCH} (example: \"1.6.2\")")
134+ ]
135+ AmbiguousVersions vs ->
136+ vcat $
137+ [ para (concat
138+ [ "The currently checked out commit seems to have been tagged with "
139+ , "more than 1 version, and I don't know which one should be used. "
140+ , "Please either delete some of the tags, or create a new commit "
141+ , "to tag the desired verson with."
142+ ])
143+ , spacer
144+ , para "Tags for the currently checked out commit:"
145+ ] ++ bulletedList showVersion vs
146+ BadRepositoryField err ->
147+ displayRepositoryError err
148+ MissingDependencies pkgs ->
149+ let singular = NonEmpty.length pkgs == 1
150+ pl a b = if singular then b else a
151+ do_ = pl "do" "does"
152+ dependencies = pl "dependencies" "dependency"
153+ them = pl "them" "it"
154+ in vcat $
155+ [ para (concat
156+ [ "The following Bower ", dependencies, " ", do_, " not appear to be "
157+ , "installed:"
158+ ])
159+ ] ++
160+ bulletedList runPackageName (NonEmpty.toList pkgs)
161+ ++
162+ [ spacer
163+ , para (concat
164+ [ "Please install ", them, " first, by running `bower install`."
165+ ])
166+ ]
167+ ParseAndDesugarError (D.ParseError err) ->
168+ vcat
169+ [ para "Parse error:"
170+ , indented (para (show err))
171+ ]
172+ ParseAndDesugarError (D.SortModulesError err) ->
173+ vcat
174+ [ para "Error in sortModules:"
175+ , indented (para (P.prettyPrintMultipleErrors False err))
176+ ]
177+ ParseAndDesugarError (D.DesugarError err) ->
178+ vcat
179+ [ para "Error while desugaring:"
180+ , indented (para (P.prettyPrintMultipleErrors False err))
181+ ]
182+
183+displayRepositoryError :: RepositoryFieldError -> Box
184+displayRepositoryError err = case err of
185+ RepositoryFieldMissing ->
186+ vcat
187+ [ para (concat
188+ [ "The 'repository' field is not present in your bower.json file. "
189+ , "Without this information, Pursuit would not be able to generate "
190+ , "source links in your package's documentation. Please add one - like "
191+ , "this, for example:"
192+ ])
193+ , spacer
194+ , indented (vcat
195+ [ para "\"repository\": {"
196+ , indented (para "\"type\": \"git\",")
197+ , indented (para "\"url\": \"git://github.com/purescript/purescript-prelude.git\"")
198+ , para "}"
199+ ]
200+ )
201+ ]
202+ BadRepositoryType ty ->
203+ para (concat
204+ [ "In your bower.json file, the repository type is currently listed as "
205+ , "\"" ++ ty ++ "\". Currently, only git repositories are supported. "
206+ , "Please publish your code in a git repository, and then update the "
207+ , "repository type in your bower.json file to \"git\"."
208+ ])
209+ NotOnGithub ->
210+ vcat
211+ [ para (concat
212+ [ "The repository url in your bower.json file does not point to a "
213+ , "GitHub repository. Currently, Pursuit does not support packages "
214+ , "which are not hosted on GitHub."
215+ ])
216+ , spacer
217+ , para (concat
218+ [ "Please update your bower.json file to point to a GitHub repository. "
219+ , "Alternatively, if you would prefer not to host your package on "
220+ , "GitHub, please open an issue:"
221+ ])
222+ , indented (para "https://github.com/purescript/purescript/issues/new")
223+ ]
224+
225+displayInternalError :: InternalError -> [String]
226+displayInternalError e = case e of
227+ JSONError src r ->
228+ [ "Error in JSON " ++ displayJSONSource src ++ ":"
229+ , T.unpack (Bower.displayError r)
230+ ]
231+
232+displayJSONSource :: JSONSource -> String
233+displayJSONSource s = case s of
234+ FromFile fp ->
235+ "in file " ++ show fp
236+ FromBowerList ->
237+ "in the output of `bower list --json --offline`"
238+
239+displayOtherError :: OtherError -> Box
240+displayOtherError e = case e of
241+ ProcessFailed prog args exc ->
242+ successivelyIndented
243+ [ "While running `" ++ prog ++ " " ++ unwords args ++ "`:"
244+ , show exc
245+ ]
246+ IOExceptionThrown exc ->
247+ successivelyIndented
248+ [ "An IO exception occurred:", show exc ]
249+
250+renderWarnings :: [PackageWarning] -> Box
251+renderWarnings =
252+ collectWarnings
253+ [ (getResolutionNotVersion, warnResolutionNotVersions)
254+ , (getUndeclaredDependency, warnUndeclaredDependencies)
255+ ]
256+ where
257+ collectWarnings patterns warns =
258+ let boxes = mapMaybe (collectWarnings' warns) patterns
259+ in vcat
260+ [ para "Warnings:"
261+ , indented (vcat (intersperse spacer boxes))
262+ ]
263+
264+ getResolutionNotVersion (ResolutionNotVersion n) = Just n
265+ getResolutionNotVersion _ = Nothing
266+
267+ getUndeclaredDependency (UndeclaredDependency n) = Just n
268+ getUndeclaredDependency _ = Nothing
269+
270+collectWarnings' :: [PackageWarning] -> ((PackageWarning -> Maybe a), (NonEmpty a -> Box)) -> Maybe Box
271+collectWarnings' warns (pattern, render) =
272+ case mapMaybe pattern warns of
273+ [] -> Nothing
274+ (x:xs) -> Just (render (x :| xs))
275+
276+warnResolutionNotVersions :: NonEmpty PackageName -> Box
277+warnResolutionNotVersions pkgNames =
278+ let singular = NonEmpty.length pkgNames == 1
279+ pl a b = if singular then b else a
280+
281+ packages = pl "packages" "package"
282+ were = pl "were" "was"
283+ anyOfThese = pl "any of these" "this"
284+ these = pl "these" "this"
285+ in vcat $
286+ [ para (concat
287+ ["The following ", packages, " ", were, " not resolved to a version:"])
288+ ] ++
289+ bulletedList runPackageName (NonEmpty.toList pkgNames)
290+ ++
291+ [ spacer
292+ , para (concat
293+ ["Links to types in ", anyOfThese, " ", packages, " will not work. In "
294+ , "order to make links work, edit your bower.json to specify a version"
295+ , " or a version range for ", these, " ", packages, ", and rerun "
296+ , "`bower install`."
297+ ])
298+ ]
299+
300+warnUndeclaredDependencies :: NonEmpty PackageName -> Box
301+warnUndeclaredDependencies pkgNames =
302+ let singular = NonEmpty.length pkgNames == 1
303+ pl a b = if singular then b else a
304+
305+ packages = pl "packages" "package"
306+ are = pl "are" "is"
307+ dependencies = pl "dependencies" "a dependency"
308+ in vcat $
309+ [ para (concat
310+ [ "The following Bower ", packages, " ", are, " installed, but not "
311+ , "declared as ", dependencies, " in your bower.json file:"
312+ ])
313+ ] ++
314+ bulletedList runPackageName (NonEmpty.toList pkgNames)
315+
316+printWarnings :: [PackageWarning] -> IO ()
317+printWarnings = printToStderr . renderWarnings
psc-publish/Main.hsnew file+279
@@ -0,0 +1,279 @@
1+{-# LANGUAGE OverloadedStrings #-}
2+{-# LANGUAGE RecordWildCards #-}
3+{-# LANGUAGE TupleSections #-}
4+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
5+
6+import Prelude hiding (userError)
7+
8+import Data.Maybe
9+import Data.Char (isSpace)
10+import Data.String (fromString)
11+import Data.List (stripPrefix, isSuffixOf, (\\))
12+import Data.List.Split (splitOn)
13+import Data.List.NonEmpty (NonEmpty(..))
14+import Data.Version
15+import Safe (headMay)
16+
17+import qualified Data.ByteString.Lazy.Char8 as BL
18+import qualified Data.Text as T
19+
20+import qualified Data.Aeson as A
21+import Data.Aeson.BetterErrors
22+
23+import Control.Applicative
24+import Control.Category ((>>>))
25+import Control.Arrow ((***))
26+import Control.Exception (catch, try)
27+import Control.Monad.Trans.Except
28+import Control.Monad.Error.Class (MonadError(..))
29+import Control.Monad.Writer
30+
31+import System.Directory (doesFileExist)
32+import System.Process (readProcess)
33+import System.Exit (exitFailure)
34+import qualified System.FilePath.Glob as Glob
35+
36+import Web.Bower.PackageMeta (PackageMeta(..), BowerError(..), PackageName,
37+ runPackageName, parsePackageName, Repository(..))
38+import qualified Web.Bower.PackageMeta as Bower
39+
40+import qualified Language.PureScript.Docs as D
41+import Utils
42+import ErrorsWarnings
43+
44+main :: IO ()
45+main = do
46+ pkg <- preparePackage
47+ BL.putStrLn (A.encode pkg)
48+
49+-- | Attempt to retrieve package metadata from the current directory.
50+-- Calls exitFailure if no package metadata could be retrieved.
51+preparePackage :: IO D.UploadedPackage
52+preparePackage =
53+ runPrepareM preparePackage'
54+ >>= either (\e -> printError e >> exitFailure)
55+ handleWarnings
56+ where
57+ handleWarnings (result, warns) = do
58+ printWarnings warns
59+ return result
60+
61+newtype PrepareM a =
62+ PrepareM { unPrepareM :: WriterT [PackageWarning] (ExceptT PackageError IO) a }
63+ deriving (Functor, Applicative, Monad,
64+ MonadWriter [PackageWarning],
65+ MonadError PackageError)
66+
67+-- This MonadIO instance ensures that IO errors don't crash the program.
68+instance MonadIO PrepareM where
69+ liftIO act =
70+ lift' (try act) >>= either (otherError . IOExceptionThrown) return
71+ where
72+ lift' :: IO a -> PrepareM a
73+ lift' = PrepareM . lift . lift
74+
75+runPrepareM :: PrepareM a -> IO (Either PackageError (a, [PackageWarning]))
76+runPrepareM = runExceptT . runWriterT . unPrepareM
77+
78+warn :: PackageWarning -> PrepareM ()
79+warn w = tell [w]
80+
81+userError :: UserError -> PrepareM a
82+userError = throwError . UserError
83+
84+internalError :: InternalError -> PrepareM a
85+internalError = throwError . InternalError
86+
87+otherError :: OtherError -> PrepareM a
88+otherError = throwError . OtherError
89+
90+catchLeft :: Applicative f => Either a b -> (a -> f b) -> f b
91+catchLeft a f = either f pure a
92+
93+preparePackage' :: PrepareM D.UploadedPackage
94+preparePackage' = do
95+ exists <- liftIO (doesFileExist "bower.json")
96+ unless exists (userError BowerJSONNotFound)
97+
98+ pkgMeta <- liftIO (Bower.decodeFile "bower.json")
99+ >>= flip catchLeft (userError . CouldntParseBowerJSON)
100+ pkgVersion <- getVersionFromGitTag
101+ pkgGithub <- getBowerInfo pkgMeta
102+ (pkgBookmarks, pkgModules) <- getModulesAndBookmarks
103+
104+ let declaredDeps = map fst (bowerDependencies pkgMeta ++ bowerDevDependencies pkgMeta)
105+ pkgResolvedDependencies <- getResolvedDependencies declaredDeps
106+
107+ let pkgUploader = D.NotYetKnown
108+
109+ return D.Package{..}
110+
111+getModulesAndBookmarks :: PrepareM ([D.Bookmark], [D.RenderedModule])
112+getModulesAndBookmarks = do
113+ (inputFiles, depsFiles) <- liftIO getInputAndDepsFiles
114+ liftIO (D.parseAndDesugar inputFiles depsFiles renderModules)
115+ >>= either (userError . ParseAndDesugarError) return
116+ where
117+ renderModules bookmarks modules =
118+ return (bookmarks, map D.renderModule modules)
119+
120+getVersionFromGitTag :: PrepareM Version
121+getVersionFromGitTag = do
122+ out <- readProcess' "git" ["tag", "--list", "--points-at", "HEAD"] ""
123+ let vs = map clean (lines out)
124+ case mapMaybe D.parseVersion' vs of
125+ [] -> userError TagMustBeCheckedOut
126+ [x] -> return x
127+ xs -> userError (AmbiguousVersions xs)
128+ where
129+ clean =
130+ trimWhitespace >>> dropPrefix "v"
131+ trimWhitespace =
132+ dropWhile isSpace >>> reverse >>> dropWhile isSpace >>> reverse
133+ dropPrefix prefix str =
134+ fromMaybe str (stripPrefix prefix str)
135+
136+getBowerInfo :: PackageMeta -> PrepareM (D.GithubUser, D.GithubRepo)
137+getBowerInfo = either (userError . BadRepositoryField) return . tryExtract
138+ where
139+ tryExtract pkgMeta =
140+ case bowerRepository pkgMeta of
141+ Nothing -> Left RepositoryFieldMissing
142+ Just Repository{..} -> do
143+ unless (repositoryType == "git")
144+ (Left (BadRepositoryType repositoryType))
145+ maybe (Left NotOnGithub) Right (extractGithub repositoryUrl)
146+
147+extractGithub :: String -> Maybe (D.GithubUser, D.GithubRepo)
148+extractGithub =
149+ stripPrefix "git://github.com/"
150+ >>> fmap (splitOn "/")
151+ >=> takeTwo
152+ >>> fmap (D.GithubUser *** (D.GithubRepo . dropDotGit))
153+
154+ where
155+ takeTwo :: [a] -> Maybe (a, a)
156+ takeTwo [x, y] = Just (x, y)
157+ takeTwo _ = Nothing
158+
159+ dropDotGit :: String -> String
160+ dropDotGit str
161+ | ".git" `isSuffixOf` str = take (length str - 4) str
162+ | otherwise = str
163+
164+readProcess' :: String -> [String] -> String -> PrepareM String
165+readProcess' prog args stdin = do
166+ out <- liftIO (catch (Right <$> readProcess prog args stdin)
167+ (return . Left))
168+ either (otherError . ProcessFailed prog args) return out
169+
170+data DependencyStatus
171+ = Missing
172+ | ResolvedOther String
173+ -- ^ Resolved, but to something other than a version. The String argument
174+ -- is the resolution type. The values it can take that I'm aware of are
175+ -- "commit" and "branch".
176+ | ResolvedVersion String
177+ -- ^ Resolved to a version. The String argument is the resolution tag (eg,
178+ -- "v0.1.0").
179+ deriving (Show, Eq)
180+
181+-- Go through all bower dependencies which contain purescript code, and
182+-- extract their versions.
183+--
184+-- In the case where a bower dependency is taken from a particular version,
185+-- that's easy; take that version. In any other case (eg, a branch, or a commit
186+-- sha) we print a warning that documentation links will not work, and avoid
187+-- linking to documentation for any types from that package.
188+--
189+-- The rationale for this is: people will prefer to use a released version
190+-- where possible. If they are not using a released version, then this is
191+-- probably for a reason. However, docs are only ever available for released
192+-- versions. Therefore there will probably be no version of the docs which is
193+-- appropriate to link to, and we should omit links.
194+getResolvedDependencies :: [PackageName] -> PrepareM [(PackageName, Version)]
195+getResolvedDependencies declaredDeps = do
196+ depsBS <- fromString <$> readProcess' "bower" ["list", "--json", "--offline"] ""
197+
198+ deps <- catchLeft (parse asBowerResolvedDependencies depsBS)
199+ (internalError . JSONError FromBowerList)
200+
201+ warnUndeclared declaredDeps (map fst deps)
202+ handleDeps deps
203+
204+ where
205+ asBowerResolvedDependencies ::
206+ Parse BowerError [(PackageName, DependencyStatus)]
207+ asBowerResolvedDependencies =
208+ key "dependencies"
209+ (eachInObjectWithKey (parsePackageName . T.unpack) asDependencyStatus)
210+
211+asDependencyStatus :: Parse e DependencyStatus
212+asDependencyStatus = do
213+ isMissing <- keyOrDefault "missing" False asBool
214+ if isMissing
215+ then
216+ return Missing
217+ else
218+ key "pkgMeta" $
219+ key "_resolution" $ do
220+ type_ <- key "type" asString
221+ case type_ of
222+ "version" -> ResolvedVersion <$> key "tag" asString
223+ other -> return (ResolvedOther other)
224+
225+warnUndeclared :: [PackageName] -> [PackageName] -> PrepareM ()
226+warnUndeclared declared actual =
227+ mapM_ (warn . UndeclaredDependency) (actual \\ declared)
228+
229+handleDeps ::
230+ [(PackageName, DependencyStatus)] -> PrepareM [(PackageName, Version)]
231+handleDeps deps = do
232+ let (missing, notVersion, installed) = partitionDeps deps
233+ case missing of
234+ (x:xs) ->
235+ userError (MissingDependencies (x :| xs))
236+ [] -> do
237+ mapM_ (warn . ResolutionNotVersion . fst) notVersion
238+ let withVersions = mapMaybe tryExtractVersion installed
239+ filterM (liftIO . isPureScript . bowerDir . fst) withVersions
240+
241+ where
242+ partitionDeps = foldr go ([], [], [])
243+ go (pkgName, d) (ms, os, is) =
244+ case d of
245+ Missing -> (pkgName : ms, os, is)
246+ ResolvedOther o -> (ms, (pkgName, o) : os, is)
247+ ResolvedVersion v -> (ms, os, (pkgName, v) : is)
248+
249+ bowerDir pkgName = "bower_components/" ++ runPackageName pkgName
250+
251+tryExtractVersion :: (PackageName, String) -> Maybe (PackageName, Version)
252+tryExtractVersion (pkgName, tag) =
253+ let tag' = fromMaybe tag (stripPrefix "v" tag)
254+ in (pkgName,) <$> D.parseVersion' tag'
255+
256+-- | Returns whether it looks like there is a purescript package checked out
257+-- in the given directory.
258+isPureScript :: FilePath -> IO Bool
259+isPureScript dir = do
260+ files <- Glob.globDir1 purescriptSourceFiles dir
261+ return (not (null files))
262+
263+getInputAndDepsFiles :: IO ([FilePath], [(PackageName, FilePath)])
264+getInputAndDepsFiles = do
265+ inputFiles <- globRelative purescriptSourceFiles
266+ depsFiles' <- globRelative purescriptDepsFiles
267+ return (inputFiles, mapMaybe withPackageName depsFiles')
268+
269+withPackageName :: FilePath -> Maybe (PackageName, FilePath)
270+withPackageName fp = (,fp) <$> getPackageName fp
271+
272+getPackageName :: FilePath -> Maybe PackageName
273+getPackageName fp = do
274+ let xs = splitOn "/" fp
275+ ys <- stripPrefix ["bower_components"] xs
276+ y <- headMay ys
277+ case Bower.mkPackageName y of
278+ Right name -> Just name
279+ Left _ -> Nothing
psc-publish/Utils.hsnew file+22
@@ -0,0 +1,22 @@
1+
2+module Utils where
3+
4+import Data.List
5+import Data.Maybe
6+import System.Directory
7+import qualified System.FilePath.Glob as Glob
8+
9+-- | Glob relative to the current directory, and produce relative pathnames.
10+globRelative :: Glob.Pattern -> IO [FilePath]
11+globRelative pat = do
12+ currentDir <- getCurrentDirectory
13+ filesAbsolute <- Glob.globDir1 pat currentDir
14+ return (mapMaybe (stripPrefix (currentDir ++ "/")) filesAbsolute)
15+
16+-- | Glob pattern for PureScript source files.
17+purescriptSourceFiles :: Glob.Pattern
18+purescriptSourceFiles = Glob.compile "src/**/*.purs"
19+
20+-- | Glob pattern for PureScript dependency files.
21+purescriptDepsFiles :: Glob.Pattern
22+purescriptDepsFiles = Glob.compile "bower_components/*/src/**/*.purs"
psc-publish/tests/Test.hsnew file+76
@@ -0,0 +1,76 @@
1+{-# OPTIONS_GHC -fno-warn-missing-signatures #-}
2+{-# OPTIONS_GHC -fno-warn-unused-imports #-}
3+
4+-- | To run these tests:
5+--
6+-- * `cabal repl psc-publish`
7+-- * `:l psc-publish/tests/Test.hs`
8+-- * `test`
9+
10+module Test where
11+
12+import Control.Monad
13+import Control.Applicative
14+import System.Process
15+import System.Directory
16+import qualified Data.ByteString.Lazy as BL
17+import Data.ByteString.Lazy (ByteString)
18+import qualified Data.Aeson as A
19+import Data.Aeson.BetterErrors
20+
21+import Main
22+import Language.PureScript.Docs
23+
24+packageName = "purescript-integers"
25+packageUrl = "https://github.com/purescript/" ++ packageName
26+packageDir = "tmp/" ++ packageName
27+
28+pushd :: FilePath -> IO a -> IO a
29+pushd dir act = do
30+ original <- getCurrentDirectory
31+ setCurrentDirectory dir
32+ result <- act
33+ setCurrentDirectory original
34+ return result
35+
36+clonePackage :: IO ()
37+clonePackage = do
38+ createDirectoryIfMissing True packageDir
39+ pushd packageDir $ do
40+ exists <- doesDirectoryExist ".git"
41+ unless exists $ do
42+ putStrLn ("Cloning " ++ packageName ++ " into " ++ packageDir ++ "...")
43+ readProcess "git" ["clone", packageUrl, "."] "" >>= putStr
44+
45+bowerInstall :: IO ()
46+bowerInstall = do
47+ pushd packageDir $ do
48+ readProcess "bower" ["install"] "" >>= putStr
49+
50+getPackage :: IO UploadedPackage
51+getPackage = do
52+ clonePackage
53+ bowerInstall
54+ pushd packageDir preparePackage
55+
56+data TestResult
57+ = ParseFailed (ParseError UploadedPackageError)
58+ | Mismatch ByteString ByteString -- ^ encoding before, encoding after
59+ | Pass ByteString
60+ deriving (Show)
61+
62+-- | Test JSON encoding/decoding; parse the package, roundtrip to/from JSON,
63+-- and check we get the same string.
64+test :: IO TestResult
65+test = roundTrip <$> getPackage
66+
67+roundTrip :: UploadedPackage -> TestResult
68+roundTrip pkg =
69+ let before = A.encode pkg
70+ in case parse asUploadedPackage before of
71+ Left err -> ParseFailed err
72+ Right parsed -> do
73+ let after = A.encode parsed
74+ if before == after
75+ then Pass before
76+ else Mismatch before after
psci/Completion.hs+5−14
@@ -204,21 +204,12 @@ identNames = nubOnFst . mapMaybe getDeclName . P.exportedDeclarations
204 getDeclName _ = Nothing
204 getDeclName _ = Nothing
205
205
206dctorNames :: P.Module -> [(N.ProperName, P.Declaration)]
206dctorNames :: P.Module -> [(N.ProperName, P.Declaration)]
207−dctorNames m = nubOnFst $ concatMap dctors dnames
207+dctorNames = nubOnFst . concatMap go . P.exportedDeclarations
208 where
208 where
209− getDataDeclName :: P.Declaration -> Maybe (N.ProperName, P.Declaration)
209+ go :: P.Declaration -> [(N.ProperName, P.Declaration)]
210− getDataDeclName d@(P.DataDeclaration _ name _ _) = Just (name, d)
210+ go decl@(P.DataDeclaration _ _ _ ctors) = map (\n -> (n, decl)) (map fst ctors)
211− getDataDeclName (P.PositionedDeclaration _ _ d) = getDataDeclName d
211+ go (P.PositionedDeclaration _ _ d) = go d
212− getDataDeclName _ = Nothing
212+ go _ = []
213−
214− dnames :: [(N.ProperName, P.Declaration)]
215− dnames = (mapMaybe getDataDeclName onlyDataDecls)
216−
217− onlyDataDecls :: [P.Declaration]
218− onlyDataDecls = (filter P.isDataDecl (P.exportedDeclarations m))
219−
220− dctors :: (N.ProperName, P.Declaration) -> [(N.ProperName, P.Declaration)]
221− dctors (name, decl) = map (\n -> (n, decl)) (map fst (P.exportedDctors m name))
222
213
223moduleNames :: [P.Module] -> [String]
214moduleNames :: [P.Module] -> [String]
224moduleNames ms = nub [show moduleName | P.Module _ moduleName _ _ <- ms]
215moduleNames ms = nub [show moduleName | P.Module _ moduleName _ _ <- ms]
purescript.cabal+39−2
@@ -26,6 +26,7 @@ library
26 build-depends: base >=4.6 && <5,
26 build-depends: base >=4.6 && <5,
27 containers -any,
27 containers -any,
28 unordered-containers -any,
28 unordered-containers -any,
29+ dlist -any,
29 directory >= 1.2,
30 directory >= 1.2,
30 filepath -any,
31 filepath -any,
31 mtl >= 2.1.0 && < 2.3.0,
32 mtl >= 2.1.0 && < 2.3.0,
@@ -35,7 +36,14 @@ library
35 utf8-string >= 1 && < 2,
36 utf8-string >= 1 && < 2,
36 pattern-arrows >= 0.0.2 && < 0.1,
37 pattern-arrows >= 0.0.2 && < 0.1,
37 time -any,
38 time -any,
38− boxes >= 0.1.4 && < 0.2.0
39+ boxes >= 0.1.4 && < 0.2.0,
40+ aeson >= 0.8 && < 0.9,
41+ vector -any,
42+ bower-json >= 0.7,
43+ aeson-better-errors >= 0.7,
44+ bytestring -any,
45+ text -any,
46+ split -any
39 exposed-modules: Language.PureScript
47 exposed-modules: Language.PureScript
40 Language.PureScript.AST
48 Language.PureScript.AST
41 Language.PureScript.AST.Binders
49 Language.PureScript.AST.Binders
@@ -43,6 +51,7 @@ library
43 Language.PureScript.AST.Operators
51 Language.PureScript.AST.Operators
44 Language.PureScript.AST.SourcePos
52 Language.PureScript.AST.SourcePos
45 Language.PureScript.AST.Traversals
53 Language.PureScript.AST.Traversals
54+ Language.PureScript.AST.Exported
46 Language.PureScript.CodeGen
55 Language.PureScript.CodeGen
47 Language.PureScript.CodeGen.Externs
56 Language.PureScript.CodeGen.Externs
48 Language.PureScript.CodeGen.JS
57 Language.PureScript.CodeGen.JS
@@ -111,9 +120,20 @@ library
111 Language.PureScript.TypeClassDictionaries
120 Language.PureScript.TypeClassDictionaries
112 Language.PureScript.Types
121 Language.PureScript.Types
113
122
123+ Language.PureScript.Docs
124+ Language.PureScript.Docs.Render
125+ Language.PureScript.Docs.Types
126+ Language.PureScript.Docs.RenderedCode
127+ Language.PureScript.Docs.RenderedCode.Types
128+ Language.PureScript.Docs.RenderedCode.Render
129+ Language.PureScript.Docs.AsMarkdown
130+ Language.PureScript.Docs.ParseAndDesugar
131+ Language.PureScript.Docs.Utils.MonoidExtras
132+
114 Control.Monad.Unify
133 Control.Monad.Unify
115 Control.Monad.Supply
134 Control.Monad.Supply
116 Control.Monad.Supply.Class
135 Control.Monad.Supply.Class
136+
117 exposed: True
137 exposed: True
118 buildable: True
138 buildable: True
119 hs-source-dirs: src
139 hs-source-dirs: src
@@ -158,7 +178,8 @@ executable psci
158
178
159executable psc-docs
179executable psc-docs
160 build-depends: base >=4 && <5, purescript -any,
180 build-depends: base >=4 && <5, purescript -any,
161− optparse-applicative >= 0.10.0, process -any, mtl -any
181+ optparse-applicative >= 0.10.0, process -any, mtl -any,
182+ split -any, ansi-wl-pprint -any
162 main-is: Main.hs
183 main-is: Main.hs
163 buildable: True
184 buildable: True
164 hs-source-dirs: psc-docs
185 hs-source-dirs: psc-docs
@@ -167,6 +188,22 @@ executable psc-docs
167 Tags
188 Tags
168 ghc-options: -Wall -O2
189 ghc-options: -Wall -O2
169
190
191+executable psc-publish
192+ build-depends: base >=4 && <5, purescript -any,
193+ optparse-applicative >= 0.10.0, process -any, mtl -any,
194+ pattern-arrows -any, aeson -any, bytestring -any,
195+ directory -any, transformers -any, text -any, containers
196+ -any, boxes -any, split -any, Glob -any, aeson-better-errors
197+ -any, transformers-compat -any, bower-json -any, semigroups
198+ -any, safe -any
199+ main-is: Main.hs
200+ buildable: True
201+ hs-source-dirs: psc-publish
202+ other-modules: Utils
203+ ErrorsWarnings
204+ BoxesHelpers
205+ ghc-options: -Wall -O2
206+
170executable psc-hierarchy
207executable psc-hierarchy
171 build-depends: base >=4 && <5, purescript -any, optparse-applicative >= 0.10.0,
208 build-depends: base >=4 && <5, purescript -any, optparse-applicative >= 0.10.0,
172 process -any, mtl -any, parsec -any, filepath -any, directory -any
209 process -any, mtl -any, parsec -any, filepath -any, directory -any
src/Language/PureScript/AST.hs+1
@@ -21,3 +21,4 @@ import Language.PureScript.AST.Declarations as AST
21import Language.PureScript.AST.Operators as AST
21import Language.PureScript.AST.Operators as AST
22import Language.PureScript.AST.SourcePos as AST
22import Language.PureScript.AST.SourcePos as AST
23import Language.PureScript.AST.Traversals as AST
23import Language.PureScript.AST.Traversals as AST
24+import Language.PureScript.AST.Exported as AST
src/Language/PureScript/AST/Declarations.hs−47
@@ -40,53 +40,6 @@ data Module = Module [Comment] ModuleName [Declaration] (Maybe [DeclarationRef])
40getModuleName :: Module -> ModuleName
40getModuleName :: Module -> ModuleName
41getModuleName (Module _ name _ _) = name
41getModuleName (Module _ name _ _) = name
42
42
43−-- |
44−-- Test if a declaration is exported, given a module's export list.
45−--
46−isExported :: Maybe [DeclarationRef] -> Declaration -> Bool
47−isExported Nothing _ = True
48−isExported _ TypeInstanceDeclaration{} = True
49−isExported exps (PositionedDeclaration _ _ d) = isExported exps d
50−isExported (Just exps) decl = any (matches decl) exps
51− where
52− matches (TypeDeclaration ident _) (ValueRef ident') = ident == ident'
53− matches (ValueDeclaration ident _ _ _) (ValueRef ident') = ident == ident'
54− matches (ExternDeclaration _ ident _ _) (ValueRef ident') = ident == ident'
55− matches (DataDeclaration _ ident _ _) (TypeRef ident' _) = ident == ident'
56− matches (ExternDataDeclaration ident _) (TypeRef ident' _) = ident == ident'
57− matches (TypeSynonymDeclaration ident _ _) (TypeRef ident' _) = ident == ident'
58− matches (TypeClassDeclaration ident _ _ _) (TypeClassRef ident') = ident == ident'
59− matches (PositionedDeclaration _ _ d) r = d `matches` r
60− matches d (PositionedDeclarationRef _ _ r) = d `matches` r
61− matches _ _ = False
62−
63−exportedDeclarations :: Module -> [Declaration]
64−exportedDeclarations (Module _ _ decls exps) = filter (isExported exps) (flattenDecls decls)
65−
66−-- |
67−-- Test if a data constructor for a given type is exported, given a module's export list.
68−--
69−isDctorExported :: ProperName -> Maybe [DeclarationRef] -> ProperName -> Bool
70−isDctorExported _ Nothing _ = True
71−isDctorExported ident (Just exps) ctor = test `any` exps
72− where
73− test (PositionedDeclarationRef _ _ d) = test d
74− test (TypeRef ident' Nothing) = ident == ident'
75− test (TypeRef ident' (Just ctors)) = ident == ident' && ctor `elem` ctors
76− test _ = False
77−
78−-- |
79−-- Return the exported data constructors for a given type.
80−--
81−exportedDctors :: Module -> ProperName -> [(ProperName, [Type])]
82−exportedDctors (Module _ _ decls exps) ident =
83− filter (isDctorExported ident exps . fst) dctors
84− where
85− dctors = concatMap getDctors (flattenDecls decls)
86− getDctors (DataDeclaration _ _ _ ctors) = ctors
87− getDctors (PositionedDeclaration _ _ d) = getDctors d
88− getDctors _ = []
89−
90-- |
43-- |
91-- An item in a list of explicit imports or exports
44-- An item in a list of explicit imports or exports
92--
45--
src/Language/PureScript/AST/Exported.hsnew file+132
@@ -0,0 +1,132 @@
1+
2+module Language.PureScript.AST.Exported (
3+ exportedDeclarations,
4+ isExported
5+) where
6+
7+import Control.Category ((>>>))
8+import Data.Maybe (mapMaybe)
9+
10+import Language.PureScript.AST.Declarations
11+import Language.PureScript.Types
12+import Language.PureScript.Names
13+
14+-- |
15+-- Return a list of all declarations which are exported from a module.
16+-- This function descends into data declarations to filter out unexported
17+-- data constructors, and also filters out type instance declarations if
18+-- they refer to classes or types which are not themselves exported.
19+--
20+-- Note that this function assumes that the module has already had its imports
21+-- desugared using 'Language.PureScript.Sugar.Names.desugarImports'. It will
22+-- produce incorrect results if this is not the case - for example, type class
23+-- instances will be incorrectly removed in some cases.
24+--
25+exportedDeclarations :: Module -> [Declaration]
26+exportedDeclarations (Module _ _ decls exps) = go decls
27+ where
28+ go = flattenDecls
29+ >>> filter (isExported exps)
30+ >>> map (filterDataConstructors exps)
31+ >>> filterInstances exps
32+
33+-- |
34+-- Filter out all data constructors from a declaration which are not exported.
35+-- If the supplied declaration is not a data declaration, this function returns
36+-- it unchanged.
37+--
38+filterDataConstructors :: Maybe [DeclarationRef] -> Declaration -> Declaration
39+filterDataConstructors exps (DataDeclaration dType tyName tyArgs dctors) =
40+ DataDeclaration dType tyName tyArgs $
41+ filter (isDctorExported tyName exps . fst) dctors
42+filterDataConstructors exps (PositionedDeclaration srcSpan coms d) =
43+ PositionedDeclaration srcSpan coms (filterDataConstructors exps d)
44+filterDataConstructors _ other = other
45+
46+-- |
47+-- Filter out all the type instances from a list of declarations which
48+-- reference a type or type class which is both local and not exported.
49+--
50+-- Note that this function assumes that the module has already had its imports
51+-- desugared using "Language.PureScript.Sugar.Names.desugarImports". It will
52+-- produce incorrect results if this is not the case - for example, type class
53+-- instances will be incorrectly removed in some cases.
54+--
55+filterInstances :: Maybe [DeclarationRef] -> [Declaration] -> [Declaration]
56+filterInstances Nothing = id
57+filterInstances (Just exps) =
58+ let refs = mapMaybe typeName exps ++ mapMaybe typeClassName exps
59+ in filter (all (visibleOutside refs) . typeInstanceConstituents)
60+ where
61+ -- Given a Qualified ProperName, and a list of all exported types and type
62+ -- classes, returns whether the supplied Qualified ProperName is visible
63+ -- outside this module. This is true if one of the following hold:
64+ --
65+ -- * the name is defined in the same module and is exported,
66+ -- * the name is defined in a different module (and must be exported from
67+ -- that module; the code would fail to compile otherwise).
68+ visibleOutside _ (Qualified (Just _) _) = True
69+ visibleOutside refs (Qualified Nothing n) = any (== n) refs
70+
71+ typeName (TypeRef n _) = Just n
72+ typeName (PositionedDeclarationRef _ _ r) = typeName r
73+ typeName _ = Nothing
74+
75+ typeClassName (TypeClassRef n) = Just n
76+ typeClassName (PositionedDeclarationRef _ _ r) = typeClassName r
77+ typeClassName _ = Nothing
78+
79+-- |
80+-- Get all type and type class names referenced by a type instance declaration.
81+--
82+typeInstanceConstituents :: Declaration -> [Qualified ProperName]
83+typeInstanceConstituents (TypeInstanceDeclaration _ constraints className tys _) =
84+ className : (concatMap fromConstraint constraints ++ concatMap fromType tys)
85+ where
86+
87+ fromConstraint (name, tys') = name : concatMap fromType tys'
88+ fromType = everythingOnTypes (++) go
89+
90+ -- Note that type synonyms are disallowed in instance declarations, so
91+ -- we don't need to handle them here.
92+ go (TypeConstructor n) = [n]
93+ go (ConstrainedType cs _) = concatMap fromConstraint cs
94+ go _ = []
95+
96+typeInstanceConstituents (PositionedDeclaration _ _ d) = typeInstanceConstituents d
97+typeInstanceConstituents _ = []
98+
99+
100+-- |
101+-- Test if a declaration is exported, given a module's export list. Prefer
102+-- 'exportedDeclarations' to this function, where possible.
103+--
104+isExported :: Maybe [DeclarationRef] -> Declaration -> Bool
105+isExported Nothing _ = True
106+isExported _ TypeInstanceDeclaration{} = True
107+isExported exps (PositionedDeclaration _ _ d) = isExported exps d
108+isExported (Just exps) decl = any (matches decl) exps
109+ where
110+ matches (TypeDeclaration ident _) (ValueRef ident') = ident == ident'
111+ matches (ValueDeclaration ident _ _ _) (ValueRef ident') = ident == ident'
112+ matches (ExternDeclaration _ ident _ _) (ValueRef ident') = ident == ident'
113+ matches (DataDeclaration _ ident _ _) (TypeRef ident' _) = ident == ident'
114+ matches (ExternDataDeclaration ident _) (TypeRef ident' _) = ident == ident'
115+ matches (TypeSynonymDeclaration ident _ _) (TypeRef ident' _) = ident == ident'
116+ matches (TypeClassDeclaration ident _ _ _) (TypeClassRef ident') = ident == ident'
117+ matches (PositionedDeclaration _ _ d) r = d `matches` r
118+ matches d (PositionedDeclarationRef _ _ r) = d `matches` r
119+ matches _ _ = False
120+
121+-- |
122+-- Test if a data constructor for a given type is exported, given a module's
123+-- export list. Prefer 'exportedDeclarations' to this function, where possible.
124+--
125+isDctorExported :: ProperName -> Maybe [DeclarationRef] -> ProperName -> Bool
126+isDctorExported _ Nothing _ = True
127+isDctorExported ident (Just exps) ctor = test `any` exps
128+ where
129+ test (PositionedDeclarationRef _ _ d) = test d
130+ test (TypeRef ident' Nothing) = ident == ident'
131+ test (TypeRef ident' (Just ctors)) = ident == ident' && ctor `elem` ctors
132+ test _ = False
src/Language/PureScript/AST/SourcePos.hs+16−3
@@ -12,11 +12,13 @@
12--
12--
13-----------------------------------------------------------------------------
13-----------------------------------------------------------------------------
14
14
15−{-# LANGUAGE DeriveDataTypeable, ScopedTypeVariables #-}
15+{-# LANGUAGE DeriveDataTypeable, ScopedTypeVariables, RecordWildCards, OverloadedStrings #-}
16
16
17module Language.PureScript.AST.SourcePos where
17module Language.PureScript.AST.SourcePos where
18
18
19import qualified Data.Data as D
19import qualified Data.Data as D
20+import Data.Aeson ((.=))
21+import qualified Data.Aeson as A
20
22
21-- |
23-- |
22-- Source position information
24-- Source position information
@@ -30,13 +32,17 @@ data SourcePos = SourcePos
30 -- Column number
32 -- Column number
31 --
33 --
32 , sourcePosColumn :: Int
34 , sourcePosColumn :: Int
33− } deriving (Eq, Show, D.Data, D.Typeable)
35+ } deriving (Eq, Ord, Show, D.Data, D.Typeable)
34
36
35displaySourcePos :: SourcePos -> String
37displaySourcePos :: SourcePos -> String
36displaySourcePos sp =
38displaySourcePos sp =
37 "line " ++ show (sourcePosLine sp) ++
39 "line " ++ show (sourcePosLine sp) ++
38 ", column " ++ show (sourcePosColumn sp)
40 ", column " ++ show (sourcePosColumn sp)
39
41
42+instance A.ToJSON SourcePos where
43+ toJSON SourcePos{..} =
44+ A.toJSON [sourcePosLine, sourcePosColumn]
45+
40data SourceSpan = SourceSpan
46data SourceSpan = SourceSpan
41 { -- |
47 { -- |
42 -- Source name
48 -- Source name
@@ -49,10 +55,17 @@ data SourceSpan = SourceSpan
49 -- End of the span
55 -- End of the span
50 --
56 --
51 , spanEnd :: SourcePos
57 , spanEnd :: SourcePos
52− } deriving (Eq, Show, D.Data, D.Typeable)
58+ } deriving (Eq, Ord, Show, D.Data, D.Typeable)
53
59
54displaySourceSpan :: SourceSpan -> String
60displaySourceSpan :: SourceSpan -> String
55displaySourceSpan sp =
61displaySourceSpan sp =
56 spanName sp ++ " " ++
62 spanName sp ++ " " ++
57 displaySourcePos (spanStart sp) ++ " - " ++
63 displaySourcePos (spanStart sp) ++ " - " ++
58 displaySourcePos (spanEnd sp)
64 displaySourcePos (spanEnd sp)
65+
66+instance A.ToJSON SourceSpan where
67+ toJSON SourceSpan{..} =
68+ A.object [ "name" .= spanName
69+ , "start" .= spanStart
70+ , "end" .= spanEnd
71+ ]
src/Language/PureScript/Docs.hsnew file+13
@@ -0,0 +1,13 @@
1+
2+-- | Data types and functions for rendering generated documentation from
3+-- PureScript code, in a variety of formats.
4+
5+module Language.PureScript.Docs (
6+ module Docs
7+) where
8+
9+import Language.PureScript.Docs.Types as Docs
10+import Language.PureScript.Docs.RenderedCode.Types as Docs
11+import Language.PureScript.Docs.RenderedCode.Render as Docs
12+import Language.PureScript.Docs.Render as Docs
13+import Language.PureScript.Docs.ParseAndDesugar as Docs
src/Language/PureScript/Docs/AsMarkdown.hsnew file+102
@@ -0,0 +1,102 @@
1+{-# LANGUAGE RecordWildCards #-}
2+
3+module Language.PureScript.Docs.AsMarkdown (
4+ renderModulesAsMarkdown
5+) where
6+
7+import Control.Monad.Writer hiding (First)
8+import Data.Foldable (for_)
9+import Data.List (partition)
10+
11+import qualified Language.PureScript as P
12+
13+import Language.PureScript.Docs.Types
14+import Language.PureScript.Docs.RenderedCode
15+import qualified Language.PureScript.Docs.Render as Render
16+
17+-- |
18+-- Take a list of modules and render them all in order, returning a single
19+-- Markdown-formatted String.
20+--
21+renderModulesAsMarkdown :: [P.Module] -> String
22+renderModulesAsMarkdown =
23+ runDocs . modulesAsMarkdown . map Render.renderModule
24+
25+modulesAsMarkdown :: [RenderedModule] -> Docs
26+modulesAsMarkdown = mapM_ moduleAsMarkdown
27+
28+moduleAsMarkdown :: RenderedModule -> Docs
29+moduleAsMarkdown RenderedModule{..} = do
30+ headerLevel 2 $ "Module " ++ rmName
31+ spacer
32+ for_ rmComments tell'
33+ mapM_ declAsMarkdown rmDeclarations
34+ spacer
35+
36+declAsMarkdown :: RenderedDeclaration -> Docs
37+declAsMarkdown RenderedDeclaration{..} = do
38+ headerLevel 4 (ticks rdTitle)
39+ spacer
40+
41+ let (instances, children) = partition ((==) ChildInstance . rcdType) rdChildren
42+ fencedBlock $ do
43+ tell' (codeToString rdCode)
44+ zipWithM_ (\f c -> tell' (childToString f c)) (First : repeat NotFirst) children
45+ spacer
46+
47+ unless (null instances) $ do
48+ headerLevel 5 "Instances"
49+ fencedBlock $ do
50+ mapM_ (tell' . childToString NotFirst) instances
51+ spacer
52+
53+ for_ rdComments tell'
54+
55+codeToString :: RenderedCode -> String
56+codeToString = outputWith elemAsMarkdown
57+ where
58+ elemAsMarkdown (Syntax x) = x
59+ elemAsMarkdown (Ident x) = x
60+ elemAsMarkdown (Ctor x _) = x
61+ elemAsMarkdown (Kind x) = x
62+ elemAsMarkdown (Keyword x) = x
63+ elemAsMarkdown Space = " "
64+
65+childToString :: First -> RenderedChildDeclaration -> String
66+childToString f RenderedChildDeclaration{..} =
67+ case rcdType of
68+ ChildDataConstructor ->
69+ let c = if f == First then "=" else "|"
70+ in " " ++ c ++ " " ++ codeToString rcdCode
71+ ChildTypeClassMember ->
72+ " " ++ codeToString rcdCode
73+ ChildInstance ->
74+ codeToString rcdCode
75+
76+data First
77+ = First
78+ | NotFirst
79+ deriving (Show, Eq, Ord)
80+
81+type Docs = Writer [String] ()
82+
83+runDocs :: Docs -> String
84+runDocs = unlines . execWriter
85+
86+tell' :: String -> Docs
87+tell' = tell . (:[])
88+
89+spacer :: Docs
90+spacer = tell' ""
91+
92+headerLevel :: Int -> String -> Docs
93+headerLevel level hdr = tell' (replicate level '#' ++ ' ' : hdr)
94+
95+fencedBlock :: Docs -> Docs
96+fencedBlock inner = do
97+ tell' "``` purescript"
98+ inner
99+ tell' "```"
100+
101+ticks :: String -> String
102+ticks = ("`" ++) . (++ "`")
src/Language/PureScript/Docs/ParseAndDesugar.hsnew file+124
@@ -0,0 +1,124 @@
1+{-# LANGUAGE TupleSections #-}
2+
3+module Language.PureScript.Docs.ParseAndDesugar
4+ ( parseAndDesugar
5+ , ParseDesugarError(..)
6+ ) where
7+
8+import qualified Data.Map as M
9+import Control.Arrow (first)
10+import Control.Monad
11+import Control.Applicative
12+
13+import Control.Monad.Trans.Except
14+import Control.Monad.Error.Class (MonadError(..))
15+import Control.Monad.IO.Class (MonadIO(..))
16+
17+import Web.Bower.PackageMeta (PackageName)
18+
19+import qualified Text.Parsec as Parsec
20+import qualified Language.PureScript as P
21+import qualified Language.PureScript.Constants as C
22+import Language.PureScript.Docs.Types
23+import Language.PureScript.Docs.Render
24+
25+data ParseDesugarError
26+ = ParseError Parsec.ParseError
27+ | SortModulesError P.MultipleErrors
28+ | DesugarError P.MultipleErrors
29+ deriving (Show)
30+
31+-- |
32+-- Given:
33+--
34+-- * A list of local source files
35+-- * A list of source files from external dependencies, together with their
36+-- package names
37+-- * A callback, taking a list of bookmarks, and a list of desugared modules
38+--
39+-- This function does the following:
40+--
41+-- * Parse all of the input and dependency source files
42+-- * Partially desugar all of the resulting modules
43+-- * Collect a list of bookmarks from the whole set of source files
44+-- * Collect a list of desugared modules from just the input source files (not
45+-- dependencies)
46+-- * Call the callback with the bookmarks and desugared module list.
47+parseAndDesugar ::
48+ [FilePath]
49+ -> [(PackageName, FilePath)]
50+ -> ([Bookmark] -> [P.Module] -> IO a)
51+ -> IO (Either ParseDesugarError a)
52+parseAndDesugar inputFiles depsFiles callback = do
53+ inputFiles' <- mapM (parseAs Local) inputFiles
54+ depsFiles' <- mapM (\(pkgName, f) -> parseAs (FromDep pkgName) f) depsFiles
55+
56+ runExceptT $ do
57+ let eParsed = P.parseModulesFromFiles fileInfoToString (inputFiles' ++ depsFiles')
58+ ms <- throwLeft ParseError eParsed
59+
60+ let depsModules = getDepsModuleNames (map (\(fp, m) -> (,m) <$> fp) ms)
61+ let eSorted = P.sortModules . map (importPrim . importPrelude . snd) $ ms
62+ (ms', _) <- throwLeft SortModulesError eSorted
63+
64+ modules <- throwLeft DesugarError (desugar ms')
65+ let modules' = map (addPackage depsModules) modules
66+ bookmarks = concatMap collectBookmarks modules'
67+ liftIO (callback bookmarks (takeLocals modules'))
68+
69+ where
70+ throwLeft f = either (throwError . f) return
71+
72+-- | Specifies whether a PureScript source file is considered as:
73+--
74+-- 1) with the `Local` constructor, a target source file, i.e., we want to see
75+-- its modules in the output
76+-- 2) with the `FromDep` constructor, a dependencies source file, i.e. we do
77+-- not want its modules in the output; it is there to enable desugaring, and
78+-- to ensure that links between modules are constructed correctly.
79+type FileInfo = InPackage FilePath
80+
81+fileInfoToString :: FileInfo -> FilePath
82+fileInfoToString (Local fn) = fn
83+fileInfoToString (FromDep _ fn) = fn
84+
85+addDefaultImport :: P.ModuleName -> P.Module -> P.Module
86+addDefaultImport toImport m@(P.Module coms mn decls exps) =
87+ if isExistingImport `any` decls || mn == toImport then m
88+ else P.Module coms mn (P.ImportDeclaration toImport P.Implicit Nothing : decls) exps
89+ where
90+ isExistingImport (P.ImportDeclaration mn' _ _) | mn' == toImport = True
91+ isExistingImport (P.PositionedDeclaration _ _ d) = isExistingImport d
92+ isExistingImport _ = False
93+
94+importPrim :: P.Module -> P.Module
95+importPrim = addDefaultImport (P.ModuleName [P.ProperName C.prim])
96+
97+importPrelude :: P.Module -> P.Module
98+importPrelude = addDefaultImport (P.ModuleName [P.ProperName C.prelude])
99+
100+desugar :: [P.Module] -> Either P.MultipleErrors [P.Module]
101+desugar = P.evalSupplyT 0 . desugar'
102+ where
103+ desugar' :: [P.Module] -> P.SupplyT (Either P.MultipleErrors) [P.Module]
104+ desugar' = mapM P.desugarDoModule >=> P.desugarCasesModule >=> P.desugarImports
105+
106+parseFile :: FilePath -> IO (FilePath, String)
107+parseFile input' = (,) input' <$> readFile input'
108+
109+parseAs :: (FilePath -> a) -> FilePath -> IO (a, String)
110+parseAs g = fmap (first g) . parseFile
111+
112+getDepsModuleNames :: [InPackage (FilePath, P.Module)] -> M.Map P.ModuleName PackageName
113+getDepsModuleNames = foldl go M.empty
114+ where
115+ go deps p = deps # case p of
116+ Local _ -> id
117+ FromDep pkgName (_, m) -> M.insert (P.getModuleName m) pkgName
118+ (#) = flip ($)
119+
120+addPackage :: M.Map P.ModuleName PackageName -> P.Module -> InPackage P.Module
121+addPackage depsModules m =
122+ case M.lookup (P.getModuleName m) depsModules of
123+ Just pkgName -> FromDep pkgName m
124+ Nothing -> Local m
src/Language/PureScript/Docs/Render.hsnew file+239
@@ -0,0 +1,239 @@
1+{-# LANGUAGE TupleSections #-}
2+{-# LANGUAGE OverloadedStrings #-}
3+{-# LANGUAGE RecordWildCards #-}
4+{-# LANGUAGE ViewPatterns #-}
5+
6+-- | Functions for rendering documentation generated from PureScript code.
7+
8+module Language.PureScript.Docs.Render (
9+ renderModule,
10+ collectBookmarks
11+) where
12+
13+import Control.Monad
14+import Data.Either
15+import Data.Monoid ((<>))
16+import Data.Maybe (mapMaybe)
17+import Data.List (nub)
18+
19+import qualified Language.PureScript as P
20+
21+import Language.PureScript.Docs.RenderedCode
22+import Language.PureScript.Docs.Types
23+import Language.PureScript.Docs.Utils.MonoidExtras
24+
25+-- |
26+-- Render a single Module.
27+--
28+renderModule :: P.Module -> RenderedModule
29+renderModule m@(P.Module coms moduleName _ _) =
30+ RenderedModule (show moduleName) comments declarations
31+ where
32+ comments = renderComments coms
33+ declarations = groupChildren declarationsWithChildren
34+ declarationsWithChildren = mapMaybe go (P.exportedDeclarations m)
35+ go decl = getDeclarationTitle decl
36+ >>= renderDeclaration decl
37+
38+-- | An intermediate stage which we go through during rendering.
39+--
40+-- In the first pass, we take all top level declarations in the module, and
41+-- render those which should appear at the top level in the output, as well as
42+-- those which should appear as children of other declarations in the output.
43+--
44+-- In the second pass, we move all children under their respective parents,
45+-- or discard them if none are found.
46+--
47+-- This two-pass system is only necessary for type instance declarations, since
48+-- they appear at the top level in the AST, and since they might need to appear
49+-- as children in two places (for example, if a data type defined in a module
50+-- is an instance of a type class also defined in that module).
51+--
52+-- This data type is used as an intermediate type between the two stages. The
53+-- Left case is a child declaration, together with a list of parent declaration
54+-- titles which this may appear as a child of.
55+--
56+-- The Right case is a top level declaration which should pass straight through
57+-- the second stage; the only way it might change is if child declarations are
58+-- added to it.
59+type IntermediateDeclaration
60+ = Either ([String], RenderedChildDeclaration) RenderedDeclaration
61+
62+-- | Move child declarations into their respective parents; the second pass.
63+-- See the comments under the type synonym IntermediateDeclaration for more
64+-- information.
65+groupChildren :: [IntermediateDeclaration] -> [RenderedDeclaration]
66+groupChildren (partitionEithers -> (children, toplevels)) =
67+ foldl go toplevels children
68+ where
69+ go ds (parentTitles, child) =
70+ map (\d ->
71+ if rdTitle d `elem` parentTitles
72+ then d { rdChildren = rdChildren d ++ [child] }
73+ else d) ds
74+
75+getDeclarationTitle :: P.Declaration -> Maybe String
76+getDeclarationTitle (P.TypeDeclaration name _) = Just (show name)
77+getDeclarationTitle (P.ExternDeclaration _ name _ _) = Just (show name)
78+getDeclarationTitle (P.DataDeclaration _ name _ _) = Just (show name)
79+getDeclarationTitle (P.ExternDataDeclaration name _) = Just (show name)
80+getDeclarationTitle (P.TypeSynonymDeclaration name _ _) = Just (show name)
81+getDeclarationTitle (P.TypeClassDeclaration name _ _ _) = Just (show name)
82+getDeclarationTitle (P.TypeInstanceDeclaration name _ _ _ _) = Just (show name)
83+getDeclarationTitle (P.PositionedDeclaration _ _ d) = getDeclarationTitle d
84+getDeclarationTitle _ = Nothing
85+
86+basicDeclaration :: String -> RenderedCode -> Maybe IntermediateDeclaration
87+basicDeclaration title code = Just (Right (RenderedDeclaration title Nothing code Nothing []))
88+
89+renderDeclaration :: P.Declaration -> String -> Maybe IntermediateDeclaration
90+renderDeclaration (P.TypeDeclaration ident' ty) title =
91+ basicDeclaration title code
92+ where
93+ code = ident (show ident')
94+ <> sp <> syntax "::" <> sp
95+ <> renderType ty
96+renderDeclaration (P.ExternDeclaration _ ident' _ ty) title =
97+ basicDeclaration title code
98+ where
99+ code = ident (show ident')
100+ <> sp <> syntax "::" <> sp
101+ <> renderType ty
102+renderDeclaration (P.DataDeclaration dtype name args ctors) title =
103+ Just (Right (RenderedDeclaration title Nothing code Nothing children))
104+ where
105+ typeApp = foldl P.TypeApp (P.TypeConstructor (P.Qualified Nothing name)) (map toTypeVar args)
106+ code = keyword (show dtype) <> sp <> renderType typeApp
107+ children = map renderCtor ctors
108+ -- TODO: Comments for data constructors?
109+ renderCtor (ctor', tys) =
110+ let typeApp' = foldl P.TypeApp (P.TypeConstructor (P.Qualified Nothing ctor')) tys
111+ childCode = renderType typeApp'
112+ in RenderedChildDeclaration (show ctor') Nothing childCode Nothing ChildDataConstructor
113+renderDeclaration (P.ExternDataDeclaration name kind') title =
114+ basicDeclaration title code
115+ where
116+ code = keywordData <> sp
117+ <> renderType (P.TypeConstructor (P.Qualified Nothing name))
118+ <> sp <> syntax "::" <> sp
119+ <> renderKind kind'
120+renderDeclaration (P.TypeSynonymDeclaration name args ty) title =
121+ basicDeclaration title code
122+ where
123+ typeApp = foldl P.TypeApp (P.TypeConstructor (P.Qualified Nothing name)) (map toTypeVar args)
124+ code = mintersperse sp
125+ [ keywordType
126+ , renderType typeApp
127+ , syntax "="
128+ , renderType ty
129+ ]
130+renderDeclaration (P.TypeClassDeclaration name args implies ds) title = do
131+ Just (Right (RenderedDeclaration title Nothing code Nothing children))
132+ where
133+ code = mintersperse sp $
134+ [keywordClass]
135+ ++ maybe [] (:[]) superclasses
136+ ++ [renderType classApp]
137+ ++ if (not (null ds)) then [keywordWhere] else []
138+
139+ superclasses
140+ | null implies = Nothing
141+ | otherwise = Just $
142+ syntax "("
143+ <> mintersperse (syntax "," <> sp) (map renderImplies implies)
144+ <> syntax ") <="
145+
146+ renderImplies (pn, tys) =
147+ let supApp = foldl P.TypeApp (P.TypeConstructor pn) tys
148+ in renderType supApp
149+
150+ classApp = foldl P.TypeApp (P.TypeConstructor (P.Qualified Nothing name)) (map toTypeVar args)
151+
152+ children = map renderClassMember ds
153+
154+ -- TODO: Comments for type class members
155+ renderClassMember (P.PositionedDeclaration _ _ d) = renderClassMember d
156+ renderClassMember (P.TypeDeclaration ident' ty) =
157+ let childCode =
158+ mintersperse sp
159+ [ ident (show ident')
160+ , syntax "::"
161+ , renderType ty
162+ ]
163+ in RenderedChildDeclaration (show ident') Nothing childCode Nothing ChildTypeClassMember
164+ renderClassMember _ = error "Invalid argument to renderClassMember."
165+renderDeclaration (P.TypeInstanceDeclaration name constraints className tys _) title = do
166+ Just (Left (classNameString : typeNameStrings, childDecl))
167+ where
168+ classNameString = unQual className
169+ typeNameStrings = nub (concatMap (P.everythingOnTypes (++) extractProperNames) tys)
170+ unQual x = let (P.Qualified _ y) = x in show y
171+
172+ extractProperNames (P.TypeConstructor n) = [unQual n]
173+ extractProperNames (P.SaturatedTypeSynonym n _) = [unQual n]
174+ extractProperNames _ = []
175+
176+ childDecl = RenderedChildDeclaration title Nothing code Nothing ChildInstance
177+
178+ code =
179+ mintersperse sp $
180+ [ keywordInstance
181+ , ident (show name)
182+ , syntax "::"
183+ ] ++ maybe [] (:[]) constraints'
184+ ++ [ renderType classApp ]
185+
186+ constraints'
187+ | null constraints = Nothing
188+ | otherwise = Just (syntax "(" <> renderedConstraints <> syntax ") =>")
189+
190+ renderedConstraints = mintersperse (syntax "," <> sp) (map renderConstraint constraints)
191+
192+ renderConstraint (pn, tys') =
193+ let supApp = foldl P.TypeApp (P.TypeConstructor pn) tys'
194+ in renderType supApp
195+
196+ classApp = foldl P.TypeApp (P.TypeConstructor className) tys
197+renderDeclaration (P.PositionedDeclaration srcSpan com d') title =
198+ fmap (addComments . addSourceSpan) (renderDeclaration d' title)
199+ where
200+ addComments (Left (t, d)) = Left (t, d { rcdComments = renderComments com })
201+ addComments (Right d) = Right (d { rdComments = renderComments com })
202+
203+ addSourceSpan (Left (t, d)) = Left (t, d { rcdSourceSpan = Just srcSpan })
204+ addSourceSpan (Right d) = Right (d { rdSourceSpan = Just srcSpan })
205+renderDeclaration _ _ = Nothing
206+
207+renderComments :: [P.Comment] -> Maybe String
208+renderComments cs = do
209+ let raw = concatMap toLines cs
210+ guard (all hasPipe raw && not (null raw))
211+ return (go raw)
212+ where
213+ go = unlines . map stripPipes
214+
215+ toLines (P.LineComment s) = [s]
216+ toLines (P.BlockComment s) = lines s
217+
218+ hasPipe s = case dropWhile (== ' ') s of { ('|':_) -> True; _ -> False }
219+
220+ stripPipes = dropPipe . dropWhile (== ' ')
221+
222+ dropPipe ('|':' ':s) = s
223+ dropPipe ('|':s) = s
224+ dropPipe s = s
225+
226+toTypeVar :: (String, Maybe P.Kind) -> P.Type
227+toTypeVar (s, Nothing) = P.TypeVar s
228+toTypeVar (s, Just k) = P.KindedType (P.TypeVar s) k
229+
230+collectBookmarks :: InPackage P.Module -> [Bookmark]
231+collectBookmarks (Local m) = map Local (collectBookmarks' m)
232+collectBookmarks (FromDep pkg m) = map (FromDep pkg) (collectBookmarks' m)
233+
234+collectBookmarks' :: P.Module -> [(P.ModuleName, String)]
235+collectBookmarks' m =
236+ map (P.getModuleName m, )
237+ (mapMaybe getDeclarationTitle
238+ (P.exportedDeclarations m))
239+
src/Language/PureScript/Docs/RenderedCode.hsnew file+11
@@ -0,0 +1,11 @@
1+
2+-- | Data types and functions for representing a simplified form of PureScript
3+-- code, intended for use in e.g. HTML documentation.
4+
5+module Language.PureScript.Docs.RenderedCode (
6+ module RenderedCode
7+) where
8+
9+import Language.PureScript.Docs.RenderedCode.Types as RenderedCode
10+import Language.PureScript.Docs.RenderedCode.Render as RenderedCode
11+
src/Language/PureScript/Docs/RenderedCode/Render.hsnew file+165
@@ -0,0 +1,165 @@
1+
2+-- | Functions for producing RenderedCode values from PureScript Type values.
3+
4+module Language.PureScript.Docs.RenderedCode.Render (
5+ renderType,
6+ renderTypeAtom,
7+ renderRow,
8+ renderKind
9+) where
10+
11+import Data.Monoid ((<>), mconcat, mempty)
12+import Data.Maybe (fromMaybe)
13+
14+import Control.Arrow ((<+>))
15+import Control.PatternArrows
16+
17+import Language.PureScript.Names
18+import Language.PureScript.Types
19+import Language.PureScript.Kinds
20+import Language.PureScript.Pretty.Kinds
21+import Language.PureScript.Environment
22+
23+import Language.PureScript.Docs.RenderedCode.Types
24+import Language.PureScript.Docs.Utils.MonoidExtras
25+
26+typeLiterals :: Pattern () Type RenderedCode
27+typeLiterals = mkPattern match
28+ where
29+ match TypeWildcard =
30+ Just (syntax "_")
31+ match (TypeVar var) =
32+ Just (ident var)
33+ match (PrettyPrintObject row) =
34+ Just $ mintersperse sp
35+ [ syntax "{"
36+ , renderRow row
37+ , syntax "}"
38+ ]
39+ match (TypeConstructor (Qualified mn name)) =
40+ Just (ctor (show name) (maybeToContainingModule mn))
41+ match (ConstrainedType deps ty) =
42+ Just $ mintersperse sp
43+ [ syntax "(" <> constraints <> syntax ")"
44+ , syntax "=>"
45+ , renderType ty
46+ ]
47+ where
48+ constraints = mintersperse (syntax "," <> sp) (map renderDep deps)
49+ renderDep (pn, tys) =
50+ let instApp = foldl TypeApp (TypeConstructor pn) tys
51+ in renderType instApp
52+ match REmpty =
53+ Just (syntax "()")
54+ match row@RCons{} =
55+ Just (syntax "(" <> renderRow row <> syntax ")")
56+ match _ =
57+ Nothing
58+
59+-- |
60+-- Render code representing a Row
61+--
62+renderRow :: Type -> RenderedCode
63+renderRow = uncurry renderRow' . rowToList
64+ where
65+ renderRow' h t = renderHead h <> renderTail t
66+
67+renderHead :: [(String, Type)] -> RenderedCode
68+renderHead = mintersperse (syntax "," <> sp) . map renderLabel
69+
70+renderLabel :: (String, Type) -> RenderedCode
71+renderLabel (label, ty) =
72+ mintersperse sp
73+ [ ident label
74+ , syntax "::"
75+ , renderType ty
76+ ]
77+
78+renderTail :: Type -> RenderedCode
79+renderTail REmpty = mempty
80+renderTail other = sp <> syntax "|" <> sp <> renderType other
81+
82+typeApp :: Pattern () Type (Type, Type)
83+typeApp = mkPattern match
84+ where
85+ match (TypeApp f x) = Just (f, x)
86+ match _ = Nothing
87+
88+appliedFunction :: Pattern () Type (Type, Type)
89+appliedFunction = mkPattern match
90+ where
91+ match (PrettyPrintFunction arg ret) = Just (arg, ret)
92+ match _ = Nothing
93+
94+kinded :: Pattern () Type (Kind, Type)
95+kinded = mkPattern match
96+ where
97+ match (KindedType t k) = Just (k, t)
98+ match _ = Nothing
99+
100+matchTypeAtom :: Pattern () Type RenderedCode
101+matchTypeAtom = typeLiterals <+> fmap parens matchType
102+ where
103+ parens x = syntax "(" <> x <> syntax ")"
104+
105+matchType :: Pattern () Type RenderedCode
106+matchType = buildPrettyPrinter operators matchTypeAtom
107+ where
108+ operators :: OperatorTable () Type RenderedCode
109+ operators =
110+ OperatorTable [ [ AssocL typeApp $ \f x -> f <> sp <> x ]
111+ , [ AssocR appliedFunction $ \arg ret -> mintersperse sp [arg, syntax "->", ret] ]
112+ , [ Wrap forall_ $ \idents ty -> mconcat [syntax "forall", sp, mintersperse sp (map ident idents), syntax ".", sp, ty] ]
113+ , [ Wrap kinded $ \k ty -> mintersperse sp [ty, syntax "::", renderKind k] ]
114+ ]
115+
116+forall_ :: Pattern () Type ([String], Type)
117+forall_ = mkPattern match
118+ where
119+ match (PrettyPrintForAll idents ty) = Just (idents, ty)
120+ match _ = Nothing
121+
122+insertPlaceholders :: Type -> Type
123+insertPlaceholders =
124+ everywhereOnTypesTopDown convertForAlls . everywhereOnTypes convert
125+
126+dePrim :: Type -> Type
127+dePrim ty@(TypeConstructor (Qualified _ name))
128+ | ty == tyBoolean || ty == tyNumber || ty == tyString =
129+ TypeConstructor $ Qualified Nothing name
130+dePrim other = other
131+
132+convert :: Type -> Type
133+convert (TypeApp (TypeApp f arg) ret) | f == tyFunction = PrettyPrintFunction arg ret
134+convert (TypeApp o r) | o == tyObject = PrettyPrintObject r
135+convert other = other
136+
137+convertForAlls :: Type -> Type
138+convertForAlls (ForAll i ty _) = go [i] ty
139+ where
140+ go idents (ForAll ident' ty' _) = go (ident' : idents) ty'
141+ go idents other = PrettyPrintForAll idents other
142+convertForAlls other = other
143+
144+preprocessType :: Type -> Type
145+preprocessType = dePrim . insertPlaceholders
146+
147+-- |
148+-- Render code representing a Kind
149+--
150+renderKind :: Kind -> RenderedCode
151+renderKind = kind . prettyPrintKind
152+
153+-- |
154+-- Render code representing a Type, as it should appear inside parentheses
155+--
156+renderTypeAtom :: Type -> RenderedCode
157+renderTypeAtom = fromMaybe (error "Incomplete pattern") . pattern matchTypeAtom () . preprocessType
158+
159+
160+-- |
161+-- Render code representing a Type
162+--
163+renderType :: Type -> RenderedCode
164+renderType = fromMaybe (error "Incomplete pattern") . pattern matchType () . preprocessType
165+
src/Language/PureScript/Docs/RenderedCode/Types.hsnew file+191
@@ -0,0 +1,191 @@
1+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
2+{-# LANGUAGE OverloadedStrings #-}
3+
4+-- | Data types and functions for representing a simplified form of PureScript
5+-- code, intended for use in e.g. HTML documentation.
6+
7+module Language.PureScript.Docs.RenderedCode.Types
8+ ( RenderedCodeElement(..)
9+ , asRenderedCodeElement
10+ , ContainingModule(..)
11+ , asContainingModule
12+ , containingModuleToMaybe
13+ , maybeToContainingModule
14+ , fromContainingModule
15+ , RenderedCode
16+ , asRenderedCode
17+ , outputWith
18+ , sp
19+ , syntax
20+ , ident
21+ , ctor
22+ , kind
23+ , keyword
24+ , keywordForall
25+ , keywordData
26+ , keywordNewtype
27+ , keywordType
28+ , keywordClass
29+ , keywordInstance
30+ , keywordWhere
31+ ) where
32+
33+import Control.Applicative ((<$>), (<*>), (*>), pure)
34+import Data.Foldable
35+import Data.Monoid
36+import qualified Data.Aeson as A
37+import Data.Aeson.BetterErrors
38+import Control.Monad.Error.Class (MonadError(..))
39+
40+import qualified Language.PureScript as P
41+
42+-- |
43+-- A single element in a rendered code fragment. The intention is to support
44+-- multiple output formats. For example, plain text, or highlighted HTML.
45+--
46+data RenderedCodeElement
47+ = Syntax String
48+ | Ident String
49+ | Ctor String ContainingModule
50+ | Kind String
51+ | Keyword String
52+ | Space
53+ deriving (Show, Eq, Ord)
54+
55+instance A.ToJSON RenderedCodeElement where
56+ toJSON (Syntax str) =
57+ A.toJSON ["syntax", str]
58+ toJSON (Ident str) =
59+ A.toJSON ["ident", str]
60+ toJSON (Ctor str mn) =
61+ A.toJSON ["ctor", A.toJSON str, A.toJSON mn ]
62+ toJSON (Kind str) =
63+ A.toJSON ["kind", str]
64+ toJSON (Keyword str) =
65+ A.toJSON ["keyword", str]
66+ toJSON Space =
67+ A.toJSON ["space" :: String]
68+
69+asRenderedCodeElement :: Parse String RenderedCodeElement
70+asRenderedCodeElement =
71+ a Syntax "syntax" <|>
72+ a Ident "ident" <|>
73+ asCtor <|>
74+ a Kind "kind" <|>
75+ a Keyword "keyword" <|>
76+ asSpace <|>
77+ unableToParse
78+ where
79+ p <|> q = catchError p (const q)
80+
81+ a ctor' ctorStr = ctor' <$> (nth 0 (withString (eq ctorStr)) *> nth 1 asString)
82+ asCtor = nth 0 (withString (eq "ctor")) *> (Ctor <$> nth 1 asString <*> nth 2 asContainingModule)
83+ asSpace = nth 0 (withString (eq "space")) *> pure Space
84+
85+ eq s s' = if s == s' then Right () else Left ""
86+
87+ unableToParse = withString (Left . show)
88+
89+-- |
90+-- This type is isomorphic to 'Maybe' 'P.ModuleName'. It makes code a bit easier
91+-- to read, as the meaning is more explicit.
92+--
93+data ContainingModule
94+ = ThisModule
95+ | OtherModule P.ModuleName
96+ deriving (Show, Eq, Ord)
97+
98+instance A.ToJSON ContainingModule where
99+ toJSON mn = A.toJSON (P.runModuleName <$> containingModuleToMaybe mn)
100+
101+asContainingModule :: Parse e ContainingModule
102+asContainingModule =
103+ maybeToContainingModule <$> perhaps (P.moduleNameFromString <$> asString)
104+
105+-- |
106+-- Convert a 'Maybe' 'P.ModuleName' to a 'ContainingModule', using the obvious
107+-- isomorphism.
108+--
109+maybeToContainingModule :: Maybe P.ModuleName -> ContainingModule
110+maybeToContainingModule Nothing = ThisModule
111+maybeToContainingModule (Just mn) = OtherModule mn
112+
113+-- |
114+-- Convert a 'ContainingModule' to a 'Maybe' 'P.ModuleName', using the obvious
115+-- isomorphism.
116+--
117+containingModuleToMaybe :: ContainingModule -> Maybe P.ModuleName
118+containingModuleToMaybe ThisModule = Nothing
119+containingModuleToMaybe (OtherModule mn) = Just mn
120+
121+-- |
122+-- A version of 'fromMaybe' for 'ContainingModule' values.
123+--
124+fromContainingModule :: P.ModuleName -> ContainingModule -> P.ModuleName
125+fromContainingModule def ThisModule = def
126+fromContainingModule _ (OtherModule mn) = mn
127+
128+-- |
129+-- A type representing a highly simplified version of PureScript code, intended
130+-- for use in output formats like plain text or HTML.
131+--
132+newtype RenderedCode
133+ = RC { unRC :: [RenderedCodeElement] }
134+ deriving (Show, Eq, Ord, Monoid)
135+
136+instance A.ToJSON RenderedCode where
137+ toJSON (RC elems) = A.toJSON elems
138+
139+asRenderedCode :: Parse String RenderedCode
140+asRenderedCode = RC <$> eachInArray asRenderedCodeElement
141+
142+-- |
143+-- This function allows conversion of a 'RenderedCode' value into a value of
144+-- some other type (for example, plain text, or HTML). The first argument
145+-- is a function specifying how each individual 'RenderedCodeElement' should be
146+-- rendered.
147+--
148+outputWith :: Monoid a => (RenderedCodeElement -> a) -> RenderedCode -> a
149+outputWith f = foldMap f . unRC
150+
151+-- |
152+-- A 'RenderedCode' fragment representing a space.
153+--
154+sp :: RenderedCode
155+sp = RC [Space]
156+
157+syntax :: String -> RenderedCode
158+syntax x = RC [Syntax x]
159+
160+ident :: String -> RenderedCode
161+ident x = RC [Ident x]
162+
163+ctor :: String -> ContainingModule -> RenderedCode
164+ctor x m = RC [Ctor x m]
165+
166+kind :: String -> RenderedCode
167+kind x = RC [Kind x]
168+
169+keyword :: String -> RenderedCode
170+keyword kw = RC [Keyword kw]
171+
172+keywordForall :: RenderedCode
173+keywordForall = keyword "forall"
174+
175+keywordData :: RenderedCode
176+keywordData = keyword "data"
177+
178+keywordNewtype :: RenderedCode
179+keywordNewtype = keyword "newtype"
180+
181+keywordType :: RenderedCode
182+keywordType = keyword "type"
183+
184+keywordClass :: RenderedCode
185+keywordClass = keyword "class"
186+
187+keywordInstance :: RenderedCode
188+keywordInstance = keyword "instance"
189+
190+keywordWhere :: RenderedCode
191+keywordWhere = keyword "where"
src/Language/PureScript/Docs/Types.hsnew file+330
@@ -0,0 +1,330 @@
1+{-# LANGUAGE RecordWildCards #-}
2+{-# LANGUAGE OverloadedStrings #-}
3+{-# LANGUAGE TupleSections #-}
4+{-# LANGUAGE RankNTypes #-}
5+
6+module Language.PureScript.Docs.Types
7+ ( module Language.PureScript.Docs.Types
8+ , module ReExports
9+ )
10+ where
11+
12+import Control.Arrow (first, (***))
13+import Control.Applicative ((<$>), (<*>))
14+import Data.Functor ((<$))
15+import Data.Char
16+import Data.Maybe (mapMaybe)
17+import Data.Version
18+import Data.Aeson ((.=))
19+import qualified Data.Aeson as A
20+import Data.Aeson.BetterErrors
21+import Text.ParserCombinators.ReadP (readP_to_S)
22+import Data.Text (Text)
23+import Data.ByteString.Lazy (ByteString)
24+import qualified Data.Text as T
25+
26+import Web.Bower.PackageMeta hiding (Version)
27+
28+import qualified Language.PureScript as P
29+
30+import Language.PureScript.Docs.RenderedCode as ReExports
31+ (RenderedCode, asRenderedCode,
32+ ContainingModule(..), asContainingModule,
33+ RenderedCodeElement(..), asRenderedCodeElement)
34+
35+--------------------
36+-- Types
37+
38+data Package a = Package
39+ { pkgMeta :: PackageMeta
40+ , pkgVersion :: Version
41+ , pkgModules :: [RenderedModule]
42+ , pkgBookmarks :: [Bookmark]
43+ , pkgResolvedDependencies :: [(PackageName, Version)]
44+ , pkgGithub :: (GithubUser, GithubRepo)
45+ , pkgUploader :: a
46+ }
47+ deriving (Show, Eq, Ord)
48+
49+data NotYetKnown = NotYetKnown
50+
51+type UploadedPackage = Package NotYetKnown
52+type VerifiedPackage = Package GithubUser
53+
54+verifyPackage :: GithubUser -> UploadedPackage -> VerifiedPackage
55+verifyPackage verifiedUser Package{..} =
56+ Package pkgMeta
57+ pkgVersion
58+ pkgModules
59+ pkgBookmarks
60+ pkgResolvedDependencies
61+ pkgGithub
62+ verifiedUser
63+
64+packageName :: Package a -> PackageName
65+packageName = bowerName . pkgMeta
66+
67+data RenderedModule = RenderedModule
68+ { rmName :: String
69+ , rmComments :: Maybe String
70+ , rmDeclarations :: [RenderedDeclaration]
71+ }
72+ deriving (Show, Eq, Ord)
73+
74+data RenderedDeclaration = RenderedDeclaration
75+ { rdTitle :: String
76+ , rdComments :: Maybe String
77+ , rdCode :: RenderedCode
78+ , rdSourceSpan :: Maybe P.SourceSpan
79+ , rdChildren :: [RenderedChildDeclaration]
80+ }
81+ deriving (Show, Eq, Ord)
82+
83+data RenderedChildDeclaration = RenderedChildDeclaration
84+ { rcdTitle :: String
85+ , rcdComments :: Maybe String
86+ , rcdCode :: RenderedCode
87+ , rcdSourceSpan :: Maybe P.SourceSpan
88+ , rcdType :: RenderedChildDeclarationType
89+ }
90+ deriving (Show, Eq, Ord)
91+
92+data RenderedChildDeclarationType
93+ = ChildInstance
94+ | ChildDataConstructor
95+ | ChildTypeClassMember
96+ deriving (Show, Eq, Ord, Bounded, Enum)
97+
98+childDeclTypeToString :: RenderedChildDeclarationType -> String
99+childDeclTypeToString = withHead toLower . drop 5 . show
100+ where
101+ withHead f (x:xs) = f x : xs
102+ withHead _ [] = []
103+
104+childDeclarationTypes :: [(String, RenderedChildDeclarationType)]
105+childDeclarationTypes =
106+ map (\t -> (childDeclTypeToString t, t)) [minBound .. maxBound]
107+
108+newtype GithubUser
109+ = GithubUser { runGithubUser :: String }
110+ deriving (Show, Eq, Ord)
111+
112+newtype GithubRepo
113+ = GithubRepo { runGithubRepo :: String }
114+ deriving (Show, Eq, Ord)
115+
116+data PackageError
117+ = ErrorInPackageMeta BowerError
118+ | InvalidVersion
119+ | InvalidDeclarationType
120+ | InvalidRenderedCode String
121+ deriving (Show, Eq, Ord)
122+
123+type Bookmark = InPackage (P.ModuleName, String)
124+
125+data InPackage a
126+ = Local a
127+ | FromDep PackageName a
128+ deriving (Show, Eq, Ord)
129+
130+instance Functor InPackage where
131+ fmap f (Local x) = Local (f x)
132+ fmap f (FromDep pkgName x) = FromDep pkgName (f x)
133+
134+takeLocal :: InPackage a -> Maybe a
135+takeLocal (Local a) = Just a
136+takeLocal _ = Nothing
137+
138+takeLocals :: [InPackage a] -> [a]
139+takeLocals = mapMaybe takeLocal
140+
141+ignorePackage :: InPackage a -> a
142+ignorePackage (Local x) = x
143+ignorePackage (FromDep _ x) = x
144+
145+----------------------
146+-- Parsing
147+
148+parseUploadedPackage :: ByteString -> Either (ParseError PackageError) UploadedPackage
149+parseUploadedPackage = parse asUploadedPackage
150+
151+parseVerifiedPackage :: ByteString -> Either (ParseError PackageError) VerifiedPackage
152+parseVerifiedPackage = parse asVerifiedPackage
153+
154+asPackage :: (forall e. Parse e a) -> Parse PackageError (Package a)
155+asPackage uploader =
156+ Package <$> key "packageMeta" asPackageMeta .! ErrorInPackageMeta
157+ <*> key "version" asVersion
158+ <*> key "modules" (eachInArray asRenderedModule)
159+ <*> key "bookmarks" asBookmarks .! ErrorInPackageMeta
160+ <*> key "resolvedDependencies" asResolvedDependencies
161+ <*> key "github" asGithub
162+ <*> key "uploader" uploader
163+
164+asUploadedPackage :: Parse PackageError UploadedPackage
165+asUploadedPackage = asPackage asNotYetKnown
166+
167+asNotYetKnown :: Parse e NotYetKnown
168+asNotYetKnown = NotYetKnown <$ asNull
169+
170+instance A.FromJSON NotYetKnown where
171+ parseJSON = toAesonParser' asNotYetKnown
172+
173+asVerifiedPackage :: Parse PackageError VerifiedPackage
174+asVerifiedPackage = asPackage asGithubUser
175+
176+asGithubUser :: Parse e GithubUser
177+asGithubUser = GithubUser <$> asString
178+
179+instance A.FromJSON GithubUser where
180+ parseJSON = toAesonParser' asGithubUser
181+
182+instance A.FromJSON a => A.FromJSON (Package a) where
183+ -- TODO: actual error display
184+ parseJSON = toAesonParser (T.pack . show)
185+ (asPackage fromAesonParser)
186+
187+asVersion :: Parse PackageError Version
188+asVersion = withString (maybe (Left InvalidVersion) Right . parseVersion')
189+
190+parseVersion' :: String -> Maybe Version
191+parseVersion' str =
192+ case filter (null . snd) $ readP_to_S parseVersion str of
193+ [(vers, "")] -> Just vers
194+ _ -> Nothing
195+
196+asRenderedModule :: Parse PackageError RenderedModule
197+asRenderedModule =
198+ RenderedModule <$> key "name" asString
199+ <*> key "comments" (perhaps asString)
200+ <*> key "declarations" (eachInArray asDeclaration)
201+
202+asDeclaration :: Parse PackageError RenderedDeclaration
203+asDeclaration =
204+ RenderedDeclaration <$> key "title" asString
205+ <*> key "comments" (perhaps asString)
206+ <*> key "code" asRenderedCode .! InvalidRenderedCode
207+ <*> key "sourceSpan" (perhaps asSourceSpan)
208+ <*> key "children" (eachInArray asRenderedChildDeclaration)
209+
210+asRenderedChildDeclaration :: Parse PackageError RenderedChildDeclaration
211+asRenderedChildDeclaration =
212+ RenderedChildDeclaration <$> key "title" asString
213+ <*> key "comments" (perhaps asString)
214+ <*> key "code" asRenderedCode .! InvalidRenderedCode
215+ <*> key "sourceSpan" (perhaps asSourceSpan)
216+ <*> key "type" asRenderedChildDeclarationType .!! InvalidDeclarationType
217+ where
218+ p .!! err = p .! const err
219+
220+asRenderedChildDeclarationType :: Parse PackageError RenderedChildDeclarationType
221+asRenderedChildDeclarationType =
222+ withString (maybe (Left InvalidDeclarationType) Right .
223+ flip lookup childDeclarationTypes)
224+
225+asSourcePos :: Parse e P.SourcePos
226+asSourcePos = P.SourcePos <$> nth 0 asIntegral
227+ <*> nth 1 asIntegral
228+
229+asBookmarks :: Parse BowerError [Bookmark]
230+asBookmarks = eachInArray asBookmark
231+
232+asBookmark :: Parse BowerError Bookmark
233+asBookmark =
234+ build <$> key "package" (perhaps (withString parsePackageName))
235+ <*> key "item" ((,) <$> nth 0 (P.moduleNameFromString <$> asString)
236+ <*> nth 1 asString)
237+ where
238+ build Nothing = Local
239+ build (Just pn) = FromDep pn
240+
241+asResolvedDependencies :: Parse PackageError [(PackageName, Version)]
242+asResolvedDependencies =
243+ eachInObjectWithKey (mapLeft ErrorInPackageMeta . parsePackageName . T.unpack) asVersion
244+ where
245+ mapLeft f (Left x) = Left (f x)
246+ mapLeft _ (Right x) = Right x
247+
248+asGithub :: Parse e (GithubUser, GithubRepo)
249+asGithub = (,) <$> nth 0 (GithubUser <$> asString)
250+ <*> nth 1 (GithubRepo <$> asString)
251+
252+asSourceSpan :: Parse e P.SourceSpan
253+asSourceSpan = P.SourceSpan <$> key "name" asString
254+ <*> key "start" asSourcePos
255+ <*> key "end" asSourcePos
256+
257+---------------------
258+-- ToJSON instances
259+
260+instance A.ToJSON a => A.ToJSON (Package a) where
261+ toJSON Package{..} =
262+ A.object $
263+ [ "packageMeta" .= pkgMeta
264+ , "version" .= showVersion pkgVersion
265+ , "modules" .= pkgModules
266+ , "bookmarks" .= map (fmap (first P.runModuleName)) pkgBookmarks
267+ , "resolvedDependencies" .= assocListToJSON (T.pack . runPackageName)
268+ (T.pack . showVersion)
269+ pkgResolvedDependencies
270+ , "github" .= pkgGithub
271+ , "uploader" .= pkgUploader
272+ ]
273+
274+instance A.ToJSON NotYetKnown where
275+ toJSON _ = A.Null
276+
277+instance A.ToJSON RenderedModule where
278+ toJSON RenderedModule{..} =
279+ A.object [ "name" .= rmName
280+ , "comments" .= rmComments
281+ , "declarations" .= rmDeclarations
282+ ]
283+
284+instance A.ToJSON RenderedDeclaration where
285+ toJSON RenderedDeclaration{..} =
286+ A.object [ "title" .= rdTitle
287+ , "comments" .= rdComments
288+ , "code" .= rdCode
289+ , "sourceSpan" .= rdSourceSpan
290+ , "children" .= rdChildren
291+ ]
292+
293+instance A.ToJSON RenderedChildDeclaration where
294+ toJSON RenderedChildDeclaration{..} =
295+ A.object [ "title" .= rcdTitle
296+ , "comments" .= rcdComments
297+ , "code" .= rcdCode
298+ , "sourceSpan" .= rcdSourceSpan
299+ , "type" .= rcdType
300+ ]
301+
302+instance A.ToJSON RenderedChildDeclarationType where
303+ toJSON = A.toJSON . childDeclTypeToString
304+
305+instance A.ToJSON GithubUser where
306+ toJSON = A.toJSON . runGithubUser
307+
308+instance A.ToJSON GithubRepo where
309+ toJSON = A.toJSON . runGithubRepo
310+
311+-- | Given a function for turning association list keys into JSON object keys,
312+-- and a function for turning association list values to JSON string values,
313+-- turns an association list into a JSON object.
314+--
315+-- For example:
316+-- @assocListToJSON T.pack T.pack [("a", "b")]@ will give @{"a": "b"}@.
317+assocListToJSON :: (a -> Text) -> (b -> Text) -> [(a, b)] -> A.Value
318+assocListToJSON f g xs = A.object (map (uncurry (.=) . (f *** g)) xs)
319+
320+instance A.ToJSON a => A.ToJSON (InPackage a) where
321+ toJSON x =
322+ case x of
323+ Local y -> withPackage (Nothing :: Maybe ()) y
324+ FromDep pn y -> withPackage (Just pn) y
325+ where
326+ withPackage :: (A.ToJSON p, A.ToJSON x) => p -> x -> A.Value
327+ withPackage p y =
328+ A.object [ "package" .= p
329+ , "item" .= y
330+ ]
src/Language/PureScript/Docs/Utils/MonoidExtras.hsnew file+9
@@ -0,0 +1,9 @@
1+module Language.PureScript.Docs.Utils.MonoidExtras where
2+
3+import Data.Monoid
4+
5+mintersperse :: (Monoid m) => m -> [m] -> m
6+mintersperse _ [] = mempty
7+mintersperse _ [x] = x
8+mintersperse sep (x:xs) = x <> sep <> mintersperse sep xs
9+