summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilFreeman <>2016-04-21 03:55:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2016-04-21 03:55:00 (GMT)
commit164b1a98130296e0cb0d4eb3b04066ccbfdb2394 (patch)
treeefe662c186085590e00c6cf07da34d2eba627251
parenteedee6382a33ad7ca6c1fe36c7c02798f20e2086 (diff)
version 0.8.5.00.8.5.0
-rw-r--r--CONTRIBUTING.md7
-rw-r--r--LICENSE1545
-rw-r--r--examples/docs/LICENSE1
-rw-r--r--examples/docs/bower.json2
-rw-r--r--examples/docs/src/TypeOpAliases.purs18
-rw-r--r--examples/failing/TypeOperatorAliasNoExport.purs6
-rw-r--r--examples/failing/TypedHole.purs9
-rw-r--r--examples/passing/2018.purs25
-rw-r--r--examples/passing/CaseInputWildcard.purs18
-rw-r--r--examples/passing/DctorOperatorAlias.purs5
-rw-r--r--examples/passing/IfWildcard.purs19
-rw-r--r--examples/passing/PartialFunction.purs1
-rw-r--r--examples/passing/TypeOperators.purs34
-rw-r--r--hierarchy/Main.hs3
-rw-r--r--psc-bundle/Main.hs3
-rw-r--r--psc-docs/Main.hs3
-rw-r--r--psc-ide-server/Main.hs14
-rw-r--r--psc/Main.hs3
-rw-r--r--psci/PSCi.hs15
-rw-r--r--psci/PSCi/Module.hs5
-rw-r--r--purescript.cabal14
-rw-r--r--src/Language/PureScript/AST/Declarations.hs37
-rw-r--r--src/Language/PureScript/AST/Exported.hs5
-rw-r--r--src/Language/PureScript/CoreFn/Desugar.hs12
-rw-r--r--src/Language/PureScript/Docs/AsMarkdown.hs2
-rw-r--r--src/Language/PureScript/Docs/Convert.hs4
-rw-r--r--src/Language/PureScript/Docs/Convert/ReExports.hs25
-rw-r--r--src/Language/PureScript/Docs/Convert/Single.hs19
-rw-r--r--src/Language/PureScript/Docs/ParseAndBookmark.hs4
-rw-r--r--src/Language/PureScript/Docs/Render.hs25
-rw-r--r--src/Language/PureScript/Docs/RenderedCode/Render.hs13
-rw-r--r--src/Language/PureScript/Docs/RenderedCode/Types.hs15
-rw-r--r--src/Language/PureScript/Docs/Types.hs17
-rw-r--r--src/Language/PureScript/Errors.hs63
-rw-r--r--src/Language/PureScript/Errors/JSON.hs (renamed from psc/JSON.hs)14
-rw-r--r--src/Language/PureScript/Externs.hs3
-rw-r--r--src/Language/PureScript/Ide.hs12
-rw-r--r--src/Language/PureScript/Ide/Command.hs6
-rw-r--r--src/Language/PureScript/Ide/Error.hs18
-rw-r--r--src/Language/PureScript/Ide/Externs.hs5
-rw-r--r--src/Language/PureScript/Ide/Imports.hs4
-rw-r--r--src/Language/PureScript/Ide/Rebuild.hs85
-rw-r--r--src/Language/PureScript/Ide/SourceFile.hs3
-rw-r--r--src/Language/PureScript/Ide/State.hs4
-rw-r--r--src/Language/PureScript/Ide/Types.hs7
-rw-r--r--src/Language/PureScript/Linter/Imports.hs24
-rw-r--r--src/Language/PureScript/Make.hs67
-rw-r--r--src/Language/PureScript/ModuleDependencies.hs62
-rw-r--r--src/Language/PureScript/Parser/Declarations.hs14
-rw-r--r--src/Language/PureScript/Parser/Lexer.hs34
-rw-r--r--src/Language/PureScript/Parser/Types.hs8
-rw-r--r--src/Language/PureScript/Pretty/Common.hs6
-rw-r--r--src/Language/PureScript/Pretty/Types.hs10
-rw-r--r--src/Language/PureScript/Pretty/Values.hs3
-rw-r--r--src/Language/PureScript/Publish.hs19
-rw-r--r--src/Language/PureScript/Publish/ErrorsWarnings.hs32
-rw-r--r--src/Language/PureScript/Sugar/Names.hs61
-rw-r--r--src/Language/PureScript/Sugar/Names/Env.hs25
-rw-r--r--src/Language/PureScript/Sugar/Names/Exports.hs60
-rw-r--r--src/Language/PureScript/Sugar/Names/Imports.hs61
-rw-r--r--src/Language/PureScript/Sugar/ObjectWildcards.hs31
-rw-r--r--src/Language/PureScript/Sugar/Operators.hs219
-rw-r--r--src/Language/PureScript/Sugar/Operators/Binders.hs44
-rw-r--r--src/Language/PureScript/Sugar/Operators/Common.hs31
-rw-r--r--src/Language/PureScript/Sugar/Operators/Expr.hs58
-rw-r--r--src/Language/PureScript/Sugar/Operators/Types.hs28
-rwxr-xr-x[-rw-r--r--]src/Language/PureScript/Sugar/TypeClasses/Deriving.hs0
-rw-r--r--src/Language/PureScript/TypeChecker.hs47
-rw-r--r--src/Language/PureScript/TypeChecker/Kinds.hs2
-rw-r--r--src/Language/PureScript/TypeChecker/Monad.hs1
-rw-r--r--src/Language/PureScript/TypeChecker/Types.hs21
-rw-r--r--src/Language/PureScript/Types.hs34
-rw-r--r--tests/Language/PureScript/Ide/Integration.hs14
-rw-r--r--tests/Language/PureScript/Ide/RebuildSpec.hs62
-rw-r--r--tests/Main.hs18
-rw-r--r--tests/TestDocs.hs23
-rw-r--r--tests/TestPsci.hs3
-rw-r--r--tests/support/pscide/src/RebuildSpecDep.purs3
-rw-r--r--tests/support/pscide/src/RebuildSpecSingleModule.fail3
-rw-r--r--tests/support/pscide/src/RebuildSpecSingleModule.purs4
-rw-r--r--tests/support/pscide/src/RebuildSpecWithDeps.purs5
-rw-r--r--tests/support/pscide/src/RebuildSpecWithForeign.js3
-rw-r--r--tests/support/pscide/src/RebuildSpecWithForeign.purs3
-rw-r--r--tests/support/pscide/src/RebuildSpecWithMissingForeign.fail3
84 files changed, 2836 insertions, 462 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index d47af73..08dfdd7 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -27,12 +27,7 @@ the licenses of all dependencies, including transitive ones, in the LICENSE
file. Therefore, whenever the dependencies change, the LICENSE file should be
updated.
-You can automate this (if you have bash):
-
-- get a copy of [cabal-dependency-licenses][]
-- run at the command line: `runhaskell license-generator/generate.hs > LICENSE`
-
-[cabal-dependency-licenses]: https://github.com/jaspervdj/cabal-dependency-licenses
+This can be automated; see the `license-generator/generate.hs` file.
## Writing Issues
diff --git a/LICENSE b/LICENSE
index 1c4fc06..be37ddb 100644
--- a/LICENSE
+++ b/LICENSE
@@ -23,63 +23,109 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
PureScript uses the following Haskell library packages. Their license files follow.
Glob
- HUnit
aeson
aeson-better-errors
ansi-terminal
ansi-wl-pprint
array
+ asn1-encoding
+ asn1-parse
+ asn1-types
+ async
attoparsec
+ auto-update
base
base-compat
+ base64-bytestring
binary
blaze-builder
bower-json
boxes
+ byteable
bytestring
+ bytestring-builder
+ case-insensitive
+ cereal
+ conduit
+ conduit-extra
+ connection
containers
+ cookie
+ cryptonite
+ data-default-class
deepseq
directory
dlist
+ edit-distance
+ exceptions
+ fast-logger
filepath
+ fsnotify
ghc-prim
hashable
haskeline
+ hinotify
+ hourglass
+ http-client
+ http-client-tls
+ http-types
integer-gmp
language-javascript
lifted-base
+ memory
+ mime-types
+ mmorph
monad-control
+ monad-logger
+ monad-loops
mtl
- nats
+ network
+ network-uri
old-locale
optparse-applicative
parallel
parsec
pattern-arrows
- pretty
+ pem
+ pipes
+ pipes-http
primitive
process
- rts
+ random
+ regex-base
+ regex-tdfa
+ resourcet
safe
scientific
semigroups
+ socks
sourcemap
+ spdx
split
stm
+ stm-chans
+ streaming-commons
syb
tagged
template-haskell
terminfo
text
time
+ tls
transformers
transformers-base
transformers-compat
unix
+ unix-compat
unordered-containers
utf8-string
vector
void
+ x509
+ x509-store
+ x509-system
+ x509-validation
+ zlib
Glob LICENSE file:
@@ -112,38 +158,6 @@ Glob LICENSE file:
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-HUnit LICENSE file:
-
- HUnit is Copyright (c) Dean Herington, 2002, all rights reserved,
- and is distributed as free software under the following license.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions, and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions, and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - The names of the copyright holders may not be used to endorse or
- promote products derived from this software without specific prior
- written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "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 HOLDERS 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.
-
aeson LICENSE file:
Copyright (c) 2011, MailRank, Inc.
@@ -339,6 +353,129 @@ array LICENSE file:
-----------------------------------------------------------------------------
+asn1-encoding LICENSE file:
+
+ Copyright (c) 2010-2013 Vincent Hanquez <vincent@snarc.org>
+
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. Neither the name of the author nor the names of his contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 AUTHORS 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.
+
+asn1-parse LICENSE file:
+
+ Copyright (c) 2010-2013 Vincent Hanquez <vincent@snarc.org>
+
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. Neither the name of the author nor the names of his contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 AUTHORS 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.
+
+asn1-types LICENSE file:
+
+ Copyright (c) 2010-2013 Vincent Hanquez <vincent@snarc.org>
+
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. Neither the name of the author nor the names of his contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 AUTHORS 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.
+
+async LICENSE file:
+
+ Copyright (c) 2012, Simon Marlow
+
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+ * Neither the name of Simon Marlow nor the names of other
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ 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.
+
attoparsec LICENSE file:
Copyright (c) Lennart Kolmodin
@@ -372,6 +509,29 @@ attoparsec LICENSE file:
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
+auto-update LICENSE file:
+
+ Copyright (c) 2014 Michael Snoyman
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
base LICENSE file:
This library (libraries/base) is derived from code from several
@@ -460,7 +620,7 @@ base LICENSE file:
base-compat LICENSE file:
- Copyright (c) 2012-2015 Simon Hengel <sol@typeful.net> and Ryan Scott <ryan.gl.scott@ku.edu>
+ Copyright (c) 2012-2016 Simon Hengel <sol@typeful.net> and Ryan Scott <ryan.gl.scott@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -480,6 +640,39 @@ base-compat LICENSE file:
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
+base64-bytestring LICENSE file:
+
+ Copyright (c) 2010 Bryan O'Sullivan <bos@serpentine.com>
+
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ 3. Neither the name of the author nor the names of his contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE 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 AUTHORS 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.
+
binary LICENSE file:
Copyright (c) Lennart Kolmodin
@@ -599,6 +792,36 @@ boxes LICENSE file:
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
+byteable LICENSE file:
+
+ Copyright (c) 2013 Vincent Hanquez <vincent@snarc.org>
+
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. Neither the name of the author nor the names of his contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 AUTHORS 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.
+
bytestring LICENSE file:
Copyright (c) Don Stewart 2005-2009
@@ -632,6 +855,182 @@ bytestring LICENSE file:
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
+bytestring-builder LICENSE file:
+
+ Copyright Jasper Van der Jeugt 2010, Simon Meier 2010-2013
+
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+ * Neither the name of Jasper Van der Jeugt nor the names of other
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ 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.
+
+case-insensitive LICENSE file:
+
+ Copyright (c) 2011-2013 Bas van Dijk
+
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+ * The name of Bas van Dijk and the names of contributors may NOT
+ be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ 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.
+
+cereal LICENSE file:
+
+ Copyright (c) Lennart Kolmodin, Galois, Inc.
+
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ 3. Neither the name of the author nor the names of his contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE 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 AUTHORS 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.
+
+conduit LICENSE file:
+
+ Copyright (c) 2012 Michael Snoyman, http://www.yesodweb.com/
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+conduit-extra LICENSE file:
+
+ Copyright (c) 2012 Michael Snoyman, http://www.yesodweb.com/
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+connection LICENSE file:
+
+ Copyright (c) 2012 Vincent Hanquez <vincent@snarc.org>
+
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. Neither the name of the author nor the names of his contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 AUTHORS 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.
+
containers LICENSE file:
The Glasgow Haskell Compiler License
@@ -666,6 +1065,94 @@ containers LICENSE file:
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
+cookie LICENSE file:
+
+ The following license covers this documentation, and the source code, except
+ where otherwise indicated.
+
+ Copyright 2010, Michael Snoyman. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "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 HOLDERS 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.
+
+cryptonite LICENSE file:
+
+ Copyright (c) 2006-2015 Vincent Hanquez <vincent@snarc.org>
+
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. Neither the name of the author nor the names of his contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 AUTHORS 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.
+
+data-default-class LICENSE file:
+
+ Copyright (c) 2013 Lukas Mai
+
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification,
+ are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ * Neither the name of the author nor the names of his contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY LUKAS MAI 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 REGENTS 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.
+
deepseq LICENSE file:
This library (deepseq) is derived from code from the GHC project which
@@ -808,6 +1295,97 @@ dlist LICENSE file:
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+edit-distance LICENSE file:
+
+ Copyright (c) 2008-2013 Maximilian Bolingbroke
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are permitted
+ provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this list of
+ conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list of
+ conditions and the following disclaimer in the documentation and/or other materials
+ provided with the distribution.
+ * Neither the name of Maximilian Bolingbroke nor the names of other contributors may be used to
+ endorse or promote products derived from this software without specific prior written permission.
+
+ 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.
+
+exceptions LICENSE file:
+
+ Copyright 2013-2015 Edward Kmett
+ Copyright 2012 Google Inc.
+
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ 3. Neither the name of the author nor the names of his contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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.
+
+fast-logger LICENSE file:
+
+ Copyright (c) 2009, IIJ Innovation Institute Inc.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ * Neither the 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.
+
+ 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.
+
filepath LICENSE file:
Copyright Neil Mitchell 2005-2015.
@@ -841,6 +1419,39 @@ filepath LICENSE file:
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+fsnotify LICENSE file:
+
+ Copyright (c) 2012, Mark Dittmer
+
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+ * Neither the name of Mark Dittmer nor the names of other
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ 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.
+
ghc-prim LICENSE file:
This library (libraries/ghc-prim) is derived from code from several
@@ -965,6 +1576,149 @@ haskeline LICENSE file:
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.
+hinotify LICENSE file:
+
+ Copyright (c) Lennart Kolmodin
+
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ 3. Neither the name of the author nor the names of his contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE 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 AUTHORS 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.
+
+hourglass LICENSE file:
+
+ Copyright (c) 2014 Vincent Hanquez <vincent@snarc.org>
+
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. Neither the name of the author nor the names of his contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 AUTHORS 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.
+
+http-client LICENSE file:
+
+ The MIT License (MIT)
+
+ Copyright (c) 2013 Michael Snoyman
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
+ this software and associated documentation files (the "Software"), to deal in
+ the Software without restriction, including without limitation the rights to
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+ the Software, and to permit persons to whom the Software is furnished to do so,
+ subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+http-client-tls LICENSE file:
+
+ The MIT License (MIT)
+
+ Copyright (c) 2013 Michael Snoyman
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
+ this software and associated documentation files (the "Software"), to deal in
+ the Software without restriction, including without limitation the rights to
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+ the Software, and to permit persons to whom the Software is furnished to do so,
+ subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+http-types LICENSE file:
+
+ Copyright (c) 2011, Aristid Breitkreuz
+ Copyright (c) 2011, Michael Snoyman
+
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+ * Neither the name of Aristid Breitkreuz nor the names of other
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ 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.
+
integer-gmp LICENSE file:
Copyright (c) 2014, Herbert Valerio Riedel
@@ -1063,6 +1817,88 @@ lifted-base LICENSE file:
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+memory LICENSE file:
+
+ Copyright (c) 2015 Vincent Hanquez <vincent@snarc.org>
+
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. Neither the name of the author nor the names of his contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 AUTHORS 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.
+
+mime-types LICENSE file:
+
+ Copyright (c) 2012 Michael Snoyman, http://www.yesodweb.com/
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+mmorph LICENSE file:
+
+ Copyright (c) 2013, Gabriel Gonzalez
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification,
+ are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this
+ list of conditions and the following disclaimer in the documentation and/or
+ other materials provided with the distribution.
+ * Neither the name of Gabriel Gonzalez nor the names of other contributors may
+ be used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+ 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 HOLDER 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.
+
monad-control LICENSE file:
Copyright © 2010, Bas van Dijk, Anders Kaseorg
@@ -1095,6 +1931,33 @@ monad-control LICENSE file:
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+monad-logger LICENSE file:
+
+ Copyright (c) 2012 Michael Snoyman, http://www.yesodweb.com/
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+monad-loops LICENSE file:
+
+ Page not found: Sorry, it's just not here.
+
mtl LICENSE file:
The Glasgow Haskell Compiler License
@@ -1129,38 +1992,69 @@ mtl LICENSE file:
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
-nats LICENSE file:
+network LICENSE file:
- Copyright 2011-2014 Edward Kmett
+ Copyright (c) 2002-2010, The University Court of the University of Glasgow.
+ Copyright (c) 2007-2010, Johan Tibell
- All rights reserved.
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ - Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ - Neither name of the University nor the names of its contributors may be
+ used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
+ GLASGOW AND THE 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
+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE 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.
+
+network-uri LICENSE file:
+
+ Copyright (c) 2002-2010, The University Court of the University of Glasgow.
+ Copyright (c) 2007-2010, Johan Tibell
Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
+ modification, are permitted provided that the following conditions are met:
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
+ - Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
+ - Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
- 3. Neither the name of the author nor the names of his contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
+ - Neither name of the University nor the names of its contributors may be
+ used to endorse or promote products derived from this software without
+ specific prior written permission.
- THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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.
+ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
+ GLASGOW AND THE 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
+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE 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.
old-locale LICENSE file:
@@ -1350,17 +2244,93 @@ pattern-arrows LICENSE file:
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-pretty LICENSE file:
+pem LICENSE file:
- This library (libraries/pretty) is derived from code from
- the GHC project which is largely (c) The University of
- Glasgow, and distributable under a BSD-style license (see below).
+ Copyright (c) 2010-2012 Vincent Hanquez <vincent@snarc.org>
- -----------------------------------------------------------------------------
+ All rights reserved.
- The Glasgow Haskell Compiler License
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. Neither the name of the author nor the names of his contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
- Copyright 2004, The University Court of the University of Glasgow.
+ THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 AUTHORS 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.
+
+pipes LICENSE file:
+
+ Copyright (c) 2012-2014 Gabriel Gonzalez
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification,
+ are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ * Neither the name of Gabriel Gonzalez nor the names of other contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ 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.
+
+pipes-http LICENSE file:
+
+ Copyright (c) 2014 Gabriel Gonzalez
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification,
+ are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ * Neither the name of Gabriel Gonzalez nor the names of other contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ 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.
+
+primitive LICENSE file:
+
+ Copyright (c) 2008-2009, Roman Leshchinskiy
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -1390,11 +2360,27 @@ pretty LICENSE file:
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
+
+process LICENSE file:
+
+ This library (libraries/process) is derived from code from two
+ sources:
+
+ * Code from the GHC project which is largely (c) The University of
+ Glasgow, and distributable under a BSD-style license (see below),
+
+ * Code from the Haskell 98 Report which is (c) Simon Peyton Jones
+ and freely redistributable (but see the full license for
+ restrictions).
+
+ The full text of these licenses is reproduced below. Both of the
+ licenses are BSD-style or compatible.
+
-----------------------------------------------------------------------------
-primitive LICENSE file:
+ The Glasgow Haskell Compiler License
- Copyright (c) 2008-2009, Roman Leshchinskiy
+ Copyright 2004, The University Court of the University of Glasgow.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -1424,10 +2410,26 @@ primitive LICENSE file:
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
+ -----------------------------------------------------------------------------
-process LICENSE file:
+ Code derived from the document "Report on the Programming Language
+ Haskell 98", is distributed under the following license:
- This library (libraries/process) is derived from code from two
+ Copyright (c) 2002 Simon Peyton Jones
+
+ The authors intend this Report to belong to the entire Haskell
+ community, and so we grant permission to copy and distribute it for
+ any purpose, provided that it is reproduced in its entirety,
+ including this Notice. Modified versions of this Report may also be
+ copied and distributed for any purpose, provided that the modified
+ version is clearly presented as such, and that it does not claim to
+ be a definition of the Haskell 98 Language.
+
+ -----------------------------------------------------------------------------
+
+random LICENSE file:
+
+ This library (libraries/base) is derived from code from two
sources:
* Code from the GHC project which is largely (c) The University of
@@ -1491,9 +2493,68 @@ process LICENSE file:
-----------------------------------------------------------------------------
-rts LICENSE file:
+regex-base LICENSE file:
+
+ This modile is under this "3 clause" BSD license:
+
+ Copyright (c) 2007, Christopher Kuklewicz
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+ * The names of the contributors may not be used to endorse or promote products derived from this software without specific prior written permission.
+
+ 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.
+
+regex-tdfa LICENSE file:
+
+ This modile is under this "3 clause" BSD license:
+
+ Copyright (c) 2007-2009, Christopher Kuklewicz
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+ * The names of the contributors may not be used to endorse or promote products derived from this software without specific prior written permission.
+
+ 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.
+
+resourcet LICENSE file:
+
+ Copyright (c)2011, Michael Snoyman
+
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+ * Neither the name of Michael Snoyman nor the names of other
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
- Package not found: No such package in package index
+ 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.
safe LICENSE file:
@@ -1590,6 +2651,36 @@ semigroups LICENSE file:
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
+socks LICENSE file:
+
+ Copyright (c) 2010-2011 Vincent Hanquez <vincent@snarc.org>
+
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. Neither the name of the author nor the names of his contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 AUTHORS 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.
+
sourcemap LICENSE file:
Copyright (c) 2012, Chris Done
@@ -1623,6 +2714,39 @@ sourcemap LICENSE file:
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+spdx LICENSE file:
+
+ Copyright (c) 2015, Oleg Grenrus
+
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+ * Neither the name of Oleg Grenrus nor the names of other
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ 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.
+
split LICENSE file:
Copyright (c) 2008 Brent Yorgey, Louis Wasserman
@@ -1687,6 +2811,68 @@ stm LICENSE file:
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
+stm-chans LICENSE file:
+
+ === stm-chans license ===
+
+ Copyright (c) 2011--2013, wren gayle romano.
+ ALL RIGHTS RESERVED.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+ * Neither the name of the copyright holders nor the names of
+ other contributors may be used to endorse or promote products
+ derived from this software without specific prior written
+ permission.
+
+ 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.
+
+
+streaming-commons LICENSE file:
+
+ The MIT License (MIT)
+
+ Copyright (c) 2014 FP Complete
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+
syb LICENSE file:
This library (libraries/syb) is derived from code from several
@@ -1910,6 +3096,36 @@ time LICENSE file:
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.
+tls LICENSE file:
+
+ Copyright (c) 2010-2015 Vincent Hanquez <vincent@snarc.org>
+
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. Neither the name of the author nor the names of his contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 AUTHORS 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.
+
transformers LICENSE file:
The Glasgow Haskell Compiler License
@@ -1976,7 +3192,7 @@ transformers-base LICENSE file:
transformers-compat LICENSE file:
- Copyright 2012 Edward Kmett
+ Copyright 2012-2015 Edward Kmett
All rights reserved.
@@ -2041,6 +3257,38 @@ unix LICENSE file:
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
+unix-compat LICENSE file:
+
+ Copyright (c) 2007-2008, Björn Bringert
+ Copyright (c) 2007-2009, Duncan Coutts
+ Copyright (c) 2010-2011, Jacob Stanley
+ Copyright (c) 2011, Bryan O'Sullivan
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ - Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ - Neither the names of the copyright owners nor the names of the
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ 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.
+
unordered-containers LICENSE file:
Copyright (c) 2010, Johan Tibell
@@ -2167,3 +3415,150 @@ void LICENSE file:
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
+x509 LICENSE file:
+
+ Copyright (c) 2010-2013 Vincent Hanquez <vincent@snarc.org>
+
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. Neither the name of the author nor the names of his contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 AUTHORS 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.
+
+x509-store LICENSE file:
+
+ Copyright (c) 2010-2013 Vincent Hanquez <vincent@snarc.org>
+
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. Neither the name of the author nor the names of his contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 AUTHORS 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.
+
+x509-system LICENSE file:
+
+ Copyright (c) 2010-2013 Vincent Hanquez <vincent@snarc.org>
+
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. Neither the name of the author nor the names of his contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 AUTHORS 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.
+
+x509-validation LICENSE file:
+
+ Copyright (c) 2010-2013 Vincent Hanquez <vincent@snarc.org>
+
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. Neither the name of the author nor the names of his contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 AUTHORS 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.
+
+zlib LICENSE file:
+
+ Copyright (c) 2006-2015, Duncan Coutts
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. This clause is intentionally left blank.
+
+ 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.
+
diff --git a/examples/docs/LICENSE b/examples/docs/LICENSE
deleted file mode 100644
index c993dba..0000000
--- a/examples/docs/LICENSE
+++ /dev/null
@@ -1 +0,0 @@
-This isn't a real license, it's just here for the sake of the tests.
diff --git a/examples/docs/bower.json b/examples/docs/bower.json
index fea039d..54f1c97 100644
--- a/examples/docs/bower.json
+++ b/examples/docs/bower.json
@@ -16,5 +16,5 @@
],
"dependencies": {
},
- "license": "replaceme"
+ "license": "MIT"
}
diff --git a/examples/docs/src/TypeOpAliases.purs b/examples/docs/src/TypeOpAliases.purs
new file mode 100644
index 0000000..be11148
--- /dev/null
+++ b/examples/docs/src/TypeOpAliases.purs
@@ -0,0 +1,18 @@
+module TypeOpAliases where
+
+type AltFn a b = a -> b
+
+infixr 6 type AltFn as ~>
+
+foreign import test1 :: forall a b. a ~> b
+foreign import test2 :: forall a b c. a ~> b ~> c
+foreign import test3 :: forall a b c d. a ~> (b ~> c) ~> d
+foreign import test4 :: forall a b c d. ((a ~> b) ~> c) ~> d
+
+data Tuple a b = Tuple a b
+
+infixl 6 Tuple as ×
+infixl 6 type Tuple as ×
+
+third ∷ ∀ a b c. a × b × c → c
+third (a × b × c) = c
diff --git a/examples/failing/TypeOperatorAliasNoExport.purs b/examples/failing/TypeOperatorAliasNoExport.purs
new file mode 100644
index 0000000..227479a
--- /dev/null
+++ b/examples/failing/TypeOperatorAliasNoExport.purs
@@ -0,0 +1,6 @@
+-- @shouldFailWith TransitiveExportError
+module Test (type (×)) where
+
+data Tuple a b = Tuple a b
+
+infixl 6 type Tuple as ×
diff --git a/examples/failing/TypedHole.purs b/examples/failing/TypedHole.purs
new file mode 100644
index 0000000..c371e67
--- /dev/null
+++ b/examples/failing/TypedHole.purs
@@ -0,0 +1,9 @@
+-- @shouldFailWith HoleInferredType
+module Main where
+
+import Prelude
+import Control.Monad.Eff (Eff)
+import Control.Monad.Eff.Console (CONSOLE, log)
+
+main :: forall e. Eff (console :: CONSOLE | e) Unit
+main = ?ummm
diff --git a/examples/passing/2018.purs b/examples/passing/2018.purs
new file mode 100644
index 0000000..2a0eef6
--- /dev/null
+++ b/examples/passing/2018.purs
@@ -0,0 +1,25 @@
+module B where
+
+ data Foo = X | Y
+
+module A where
+
+ import B as Main
+
+ -- Prior to the 2018 fix this would be detected as a cycle between A and Main.
+ foo ∷ Main.Foo → Main.Foo
+ foo x = x
+
+module Main where
+
+import Prelude
+import A (foo)
+import B (Foo(..))
+import Control.Monad.Eff (Eff)
+import Control.Monad.Eff.Console (CONSOLE, log)
+
+main :: forall e. Eff (console :: CONSOLE | e) Unit
+main = do
+ let tmp = foo X
+ log "Done"
+
diff --git a/examples/passing/CaseInputWildcard.purs b/examples/passing/CaseInputWildcard.purs
new file mode 100644
index 0000000..6448939
--- /dev/null
+++ b/examples/passing/CaseInputWildcard.purs
@@ -0,0 +1,18 @@
+module Main where
+
+import Prelude
+import Control.Monad.Eff (Eff)
+import Control.Monad.Eff.Console (log, CONSOLE)
+
+data Foo = X | Y
+
+what ∷ Foo → Int → Boolean → Foo
+what x = case _, x, _ of
+ 0, X, true → X
+ 0, Y, true → X
+ _, _, _ → Y
+
+main :: forall e. Eff (console :: CONSOLE | e) Unit
+main = do
+ let tmp = what Y 0 true
+ log "Done"
diff --git a/examples/passing/DctorOperatorAlias.purs b/examples/passing/DctorOperatorAlias.purs
index 31b0027..863133d 100644
--- a/examples/passing/DctorOperatorAlias.purs
+++ b/examples/passing/DctorOperatorAlias.purs
@@ -11,9 +11,14 @@ module Main where
import Control.Monad.Eff.Console (CONSOLE, log)
import Test.Assert (ASSERT, assert')
import Data.List (List(..), (:))
+ import Data.List as L
+ -- unqualified
infixl 6 Cons as !
+ -- qualified
+ infixl 6 L.Cons as !!
+
get1 ∷ ∀ a. a → List a → a
get1 y xs = case xs of
_ : x : _ → x
diff --git a/examples/passing/IfWildcard.purs b/examples/passing/IfWildcard.purs
new file mode 100644
index 0000000..dd7d154
--- /dev/null
+++ b/examples/passing/IfWildcard.purs
@@ -0,0 +1,19 @@
+module Main where
+
+import Prelude
+import Control.Monad.Eff (Eff)
+import Control.Monad.Eff.Console (log, CONSOLE)
+
+data Foo = X | Y
+
+cond ∷ ∀ a. Boolean → a → a → a
+cond = if _ then _ else _
+
+what ∷ Boolean → Foo
+what = if _ then X else Y
+
+main :: forall e. Eff (console :: CONSOLE | e) Unit
+main = do
+ let tmp1 = what true
+ tmp2 = cond true 0 1
+ log "Done"
diff --git a/examples/passing/PartialFunction.purs b/examples/passing/PartialFunction.purs
index f0c4fd3..ab95b36 100644
--- a/examples/passing/PartialFunction.purs
+++ b/examples/passing/PartialFunction.purs
@@ -3,7 +3,6 @@ module Main where
import Prelude
import Test.Assert
-fn :: Number -> Number
fn 0.0 = 0.0
fn 1.0 = 2.0
diff --git a/examples/passing/TypeOperators.purs b/examples/passing/TypeOperators.purs
new file mode 100644
index 0000000..72bd70b
--- /dev/null
+++ b/examples/passing/TypeOperators.purs
@@ -0,0 +1,34 @@
+module A
+ ( Tuple(..)
+ , type (/\)
+ , (/\)
+ , Natural
+ , type (~>)
+ ) where
+
+ data Tuple a b = Tuple a b
+
+ infixl 6 Tuple as /\
+ infixl 6 type Tuple as /\
+
+ type Natural f g = ∀ a. f a → g a
+
+ infixr 0 type Natural as ~>
+
+ tup ∷ ∀ a b. a → b → b /\ a
+ tup a b = b /\ a
+
+ tupX ∷ ∀ a b c. a /\ b /\ c → c
+ tupX (a /\ b /\ c) = c
+
+module Main where
+
+ import A (type (~>), type (/\), (/\))
+
+ natty ∷ ∀ f. f ~> f
+ natty x = x
+
+ swap ∷ ∀ a b. a /\ b → b /\ a
+ swap (a /\ b) = b /\ a
+
+ main = Control.Monad.Eff.Console.log "Done"
diff --git a/hierarchy/Main.hs b/hierarchy/Main.hs
index dcba309..adc3de0 100644
--- a/hierarchy/Main.hs
+++ b/hierarchy/Main.hs
@@ -30,6 +30,7 @@ import System.FilePath ((</>))
import System.FilePath.Glob (glob)
import System.Exit (exitFailure, exitSuccess)
import System.IO (hPutStr, stderr)
+import System.IO.UTF8 (readUTF8File)
import qualified Language.PureScript as P
import qualified Paths_purescript as Paths
@@ -56,7 +57,7 @@ runModuleName (P.ModuleName pns) = intercalate "_" (P.runProperName `map` pns)
readInput :: [FilePath] -> IO (Either P.MultipleErrors [P.Module])
readInput paths = do
- content <- mapM (\path -> (path, ) <$> readFile path) paths
+ content <- mapM (\path -> (path, ) <$> readUTF8File path) paths
return $ map snd <$> P.parseModulesFromFiles id content
compile :: HierarchyOptions -> IO ()
diff --git a/psc-bundle/Main.hs b/psc-bundle/Main.hs
index a5eee56..a1051ca 100644
--- a/psc-bundle/Main.hs
+++ b/psc-bundle/Main.hs
@@ -20,6 +20,7 @@ import System.FilePath (takeFileName, takeDirectory)
import System.FilePath.Glob (glob)
import System.Exit (exitFailure)
import System.IO (stderr, stdout, hPutStrLn, hSetEncoding, utf8)
+import System.IO.UTF8 (readUTF8File)
import System.Directory (createDirectoryIfMissing)
import Language.PureScript.Bundle
@@ -56,7 +57,7 @@ app Options{..} = do
hPutStrLn stderr "psc-bundle: No input files."
exitFailure
input <- for inputFiles $ \filename -> do
- js <- liftIO (readFile filename)
+ js <- liftIO (readUTF8File filename)
mid <- guessModuleIdentifier filename
length js `seq` return (mid, js) -- evaluate readFile till EOF before returning, not to exhaust file handles
diff --git a/psc-docs/Main.hs b/psc-docs/Main.hs
index 9d4ff6d..d7528e3 100644
--- a/psc-docs/Main.hs
+++ b/psc-docs/Main.hs
@@ -20,6 +20,7 @@ import qualified Language.PureScript as P
import qualified Paths_purescript as Paths
import System.Exit (exitFailure)
import System.IO (hPutStrLn, hPrint, hSetEncoding, stderr, stdout, utf8)
+import System.IO.UTF8 (readUTF8File)
import System.Directory (createDirectoryIfMissing)
import System.FilePath (takeDirectory)
import System.FilePath.Glob (glob)
@@ -139,7 +140,7 @@ dumpTags input renderTags = do
ldump = mapM_ putStrLn
parseFile :: FilePath -> IO (FilePath, String)
-parseFile input = (,) input <$> readFile input
+parseFile input = (,) input <$> readUTF8File input
inputFile :: Parser FilePath
inputFile = strArgument $
diff --git a/psc-ide-server/Main.hs b/psc-ide-server/Main.hs
index 896b135..c19c7ca 100644
--- a/psc-ide-server/Main.hs
+++ b/psc-ide-server/Main.hs
@@ -82,7 +82,17 @@ main = do
maybe (pure ()) setCurrentDirectory dir
serverState <- newTVarIO emptyPscIdeState
cwd <- getCurrentDirectory
- _ <- forkFinally (watcher serverState (cwd </> outputPath)) print
+ let fullOutputPath = cwd </> outputPath
+
+ doesDirectoryExist fullOutputPath
+ >>= flip unless
+ (do putStrLn ("Your output directory didn't exist. I'll create it at: " <> fullOutputPath)
+ createDirectory fullOutputPath
+ putStrLn "This usually means you didn't compile your project yet."
+ putStrLn "psc-ide needs you to compile your project (for example by running pulp build)"
+ )
+
+ _ <- forkFinally (watcher serverState fullOutputPath) print
let conf =
Configuration
{
@@ -125,7 +135,7 @@ startServer port env = withSocketsDo $ do
case decodeT cmd of
Just cmd' -> do
result <- runExceptT (handleCommand cmd')
- $(logDebug) ("Answer was: " <> T.pack (show result))
+ -- $(logDebug) ("Answer was: " <> T.pack (show result))
liftIO (hFlush stdout)
case result of
-- What function can I use to clean this up?
diff --git a/psc/Main.hs b/psc/Main.hs
index 72e364b..91a6f45 100644
--- a/psc/Main.hs
+++ b/psc/Main.hs
@@ -28,8 +28,7 @@ import qualified Language.PureScript as P
import qualified Paths_purescript as Paths
import Language.PureScript.Make
-
-import JSON
+import Language.PureScript.Errors.JSON
data PSCMakeOptions = PSCMakeOptions
{ pscmInput :: [FilePath]
diff --git a/psci/PSCi.hs b/psci/PSCi.hs
index 7561494..fc9f695 100644
--- a/psci/PSCi.hs
+++ b/psci/PSCi.hs
@@ -33,6 +33,7 @@ import System.FilePath ((</>))
import System.FilePath.Glob (glob)
import System.Process (readProcessWithExitCode)
import System.IO.Error (tryIOError)
+import System.IO.UTF8 (readUTF8File)
import qualified Language.PureScript as P
import qualified Language.PureScript.Names as N
@@ -75,7 +76,7 @@ loop PSCiOptions{..} = do
historyFilename <- getHistoryFilename
let settings = defaultSettings { historyFile = Just historyFilename }
foreignsOrError <- runMake $ do
- foreignFilesContent <- forM foreignFiles (\inFile -> (inFile,) <$> makeIO (const (P.ErrorMessage [] $ P.CannotReadFile inFile)) (readFile inFile))
+ foreignFilesContent <- forM foreignFiles (\inFile -> (inFile,) <$> makeIO (const (P.ErrorMessage [] $ P.CannotReadFile inFile)) (readUTF8File inFile))
P.parseForeignModulesFromFiles foreignFilesContent
case foreignsOrError of
Left errs -> putStrLn (P.prettyPrintMultipleErrors False errs) >> exitFailure
@@ -167,7 +168,7 @@ handleCommand (LoadFile filePath) = PSCI $ whenFileExists filePath $ \absPath ->
Right mods -> lift $ modify (updateModules (map (absPath,) mods))
handleCommand (LoadForeign filePath) = PSCI $ whenFileExists filePath $ \absPath -> do
foreignsOrError <- lift . lift . runMake $ do
- foreignFile <- makeIO (const (P.ErrorMessage [] $ P.CannotReadFile absPath)) (readFile absPath)
+ foreignFile <- makeIO (const (P.ErrorMessage [] $ P.CannotReadFile absPath)) (readUTF8File absPath)
P.parseForeignModulesFromFiles [(absPath, foreignFile)]
case foreignsOrError of
Left err -> outputStrLn $ P.prettyPrintMultipleErrors False err
@@ -242,9 +243,8 @@ handleShowImportedModules = do
where
showModules = return . unlines . sort . map showModule
showModule (mn, declType, asQ) =
- "import " ++ case asQ of
- Just mn' -> "qualified " ++ N.runModuleName mn ++ " as " ++ N.runModuleName mn'
- Nothing -> N.runModuleName mn ++ " " ++ showDeclType declType
+ "import " ++ N.runModuleName mn ++ showDeclType declType ++
+ foldMap (\mn' -> " as " ++ N.runModuleName mn') asQ
showDeclType P.Implicit = ""
showDeclType (P.Explicit refs) = refsList refs
@@ -253,8 +253,9 @@ handleShowImportedModules = do
showRef :: P.DeclarationRef -> String
showRef (P.TypeRef pn dctors) = N.runProperName pn ++ "(" ++ maybe ".." (commaList . map N.runProperName) dctors ++ ")"
+ showRef (P.TypeOpRef ident) = "type (" ++ N.runIdent ident ++ ")"
showRef (P.ValueRef ident) = N.runIdent ident
- showRef (P.TypeClassRef pn) = N.runProperName pn
+ showRef (P.TypeClassRef pn) = "class " ++ N.runProperName pn
showRef (P.ProperRef pn) = pn
showRef (P.TypeInstanceRef ident) = N.runIdent ident
showRef (P.ModuleRef name) = "module " ++ N.runModuleName name
@@ -359,7 +360,7 @@ loadUserConfig = onFirstFileMatching readCommands pathGetters
exists <- doesFileExist configFile
if exists
then do
- ls <- lines <$> readFile configFile
+ ls <- lines <$> readUTF8File configFile
case traverse parseCommand ls of
Left err -> print err >> exitFailure
Right cs -> return $ Just cs
diff --git a/psci/PSCi/Module.hs b/psci/PSCi/Module.hs
index ead2c00..bda5116 100644
--- a/psci/PSCi/Module.hs
+++ b/psci/PSCi/Module.hs
@@ -6,6 +6,7 @@ import Prelude.Compat
import qualified Language.PureScript as P
import PSCi.Types
import System.FilePath (pathSeparator)
+import System.IO.UTF8 (readUTF8File)
import Control.Monad
-- | The name of the PSCI support module
@@ -45,7 +46,7 @@ supportModule =
--
loadModule :: FilePath -> IO (Either String [P.Module])
loadModule filename = do
- content <- readFile filename
+ content <- readUTF8File filename
return $ either (Left . P.prettyPrintMultipleErrors False) (Right . map snd) $ P.parseModulesFromFiles id [(filename, content)]
-- |
@@ -54,7 +55,7 @@ loadModule filename = do
loadAllModules :: [FilePath] -> IO (Either P.MultipleErrors [(FilePath, P.Module)])
loadAllModules files = do
filesAndContent <- forM files $ \filename -> do
- content <- readFile filename
+ content <- readUTF8File filename
return (filename, content)
return $ P.parseModulesFromFiles id filesAndContent
diff --git a/purescript.cabal b/purescript.cabal
index 7244621..cf82b2e 100644
--- a/purescript.cabal
+++ b/purescript.cabal
@@ -1,5 +1,5 @@
name: purescript
-version: 0.8.4.0
+version: 0.8.5.0
cabal-version: >=1.8
build-type: Simple
license: MIT
@@ -23,7 +23,6 @@ extra-source-files: examples/passing/*.purs
, examples/failing/*.purs
, examples/docs/bower_components/purescript-prelude/src/*.purs
, examples/docs/bower.json
- , examples/docs/LICENSE
, examples/docs/src/*.purs
, tests/support/setup.js
, tests/support/package.json
@@ -37,6 +36,8 @@ extra-source-files: examples/passing/*.purs
, tests/support/flattened/*.js
, tests/support/psci/*.purs
, tests/support/pscide/src/*.purs
+ , tests/support/pscide/src/*.js
+ , tests/support/pscide/src/*.fail
, stack.yaml
, stack-lts-5.yaml
, stack-nightly.yaml
@@ -90,7 +91,8 @@ library
monad-logger >= 0.3 && < 0.4,
pipes >= 4.0.0 && < 4.2.0 ,
pipes-http -any,
- http-types -any
+ http-types -any,
+ spdx == 0.2.*
exposed-modules: Language.PureScript
Language.PureScript.AST
@@ -127,6 +129,7 @@ library
Language.PureScript.Comments
Language.PureScript.Environment
Language.PureScript.Errors
+ Language.PureScript.Errors.JSON
Language.PureScript.Kinds
Language.PureScript.Linter
Language.PureScript.Linter.Exhaustive
@@ -163,6 +166,7 @@ library
Language.PureScript.Sugar.Operators.Common
Language.PureScript.Sugar.Operators.Expr
Language.PureScript.Sugar.Operators.Binders
+ Language.PureScript.Sugar.Operators.Types
Language.PureScript.Sugar.TypeClasses
Language.PureScript.Sugar.TypeClasses.Deriving
Language.PureScript.Sugar.TypeDeclarations
@@ -214,6 +218,7 @@ library
Language.PureScript.Ide.Reexports
Language.PureScript.Ide.Imports
Language.PureScript.Ide.Util
+ Language.PureScript.Ide.Rebuild
Control.Monad.Logger
Control.Monad.Supply
@@ -237,7 +242,7 @@ executable psc
main-is: Main.hs
buildable: True
hs-source-dirs: psc
- other-modules: JSON, Paths_purescript
+ other-modules: Paths_purescript
ghc-options: -Wall -O2 -fno-warn-unused-do-bind -threaded -rtsopts "-with-rtsopts=-N"
executable psci
@@ -369,6 +374,7 @@ test-suite tests
Language.PureScript.Ide.Imports.IntegrationSpec
Language.PureScript.Ide.Integration
Language.PureScript.Ide.MatcherSpec
+ Language.PureScript.Ide.RebuildSpec
Language.PureScript.Ide.ReexportsSpec
Language.PureScript.IdeSpec
PSCi.Completion
diff --git a/src/Language/PureScript/AST/Declarations.hs b/src/Language/PureScript/AST/Declarations.hs
index f4e999c..32e217e 100644
--- a/src/Language/PureScript/AST/Declarations.hs
+++ b/src/Language/PureScript/AST/Declarations.hs
@@ -62,6 +62,10 @@ data DeclarationRef
--
= TypeRef (ProperName 'TypeName) (Maybe [ProperName 'ConstructorName])
-- |
+ -- A type operator
+ --
+ | TypeOpRef Ident
+ -- |
-- A value
--
| ValueRef Ident
@@ -89,6 +93,7 @@ data DeclarationRef
instance Eq DeclarationRef where
(TypeRef name dctors) == (TypeRef name' dctors') = name == name' && dctors == dctors'
+ (TypeOpRef name) == (TypeOpRef name') = name == name'
(ValueRef name) == (ValueRef name') = name == name'
(TypeClassRef name) == (TypeClassRef name') = name == name'
(TypeInstanceRef name) == (TypeInstanceRef name') = name == name'
@@ -190,7 +195,7 @@ data Declaration
-- |
-- A fixity declaration (fixity data, operator name, value the operator is an alias for)
--
- | FixityDeclaration Fixity String (Maybe (Either (Qualified Ident) (Qualified (ProperName 'ConstructorName))))
+ | FixityDeclaration Fixity String (Maybe (Qualified FixityAlias))
-- |
-- A module import (module name, qualified/unqualified/hiding, optional "qualified as" name)
-- TODO: also a boolean specifying whether the old `qualified` syntax was used, so a warning can be raised in desugaring (remove for 0.9)
@@ -211,6 +216,31 @@ data Declaration
| PositionedDeclaration SourceSpan [Comment] Declaration
deriving (Show, Read)
+data FixityAlias
+ = AliasValue Ident
+ | AliasConstructor (ProperName 'ConstructorName)
+ | AliasType (ProperName 'TypeName)
+ deriving (Eq, Ord, Show, Read)
+
+foldFixityAlias
+ :: (Ident -> a)
+ -> (ProperName 'ConstructorName -> a)
+ -> (ProperName 'TypeName -> a)
+ -> FixityAlias
+ -> a
+foldFixityAlias f _ _ (AliasValue name) = f name
+foldFixityAlias _ g _ (AliasConstructor name) = g name
+foldFixityAlias _ _ h (AliasType name) = h name
+
+getValueAlias :: FixityAlias -> Maybe (Either Ident (ProperName 'ConstructorName))
+getValueAlias (AliasValue name) = Just $ Left name
+getValueAlias (AliasConstructor name) = Just $ Right name
+getValueAlias _ = Nothing
+
+getTypeAlias :: FixityAlias -> Maybe (ProperName 'TypeName)
+getTypeAlias (AliasType name) = Just name
+getTypeAlias _ = Nothing
+
-- | The members of a type class instance declaration
data TypeInstanceBody
-- | This is a derived instance
@@ -410,6 +440,10 @@ data Expr
--
| AnonymousArgument
-- |
+ -- A typed hole that will be turned into a hint/error duing typechecking
+ --
+ | Hole String
+ -- |
-- A value with source position information
--
| PositionedValue SourceSpan [Comment] Expr
@@ -453,3 +487,4 @@ data DoNotationElement
$(deriveJSON (defaultOptions { sumEncoding = ObjectWithSingleField }) ''DeclarationRef)
$(deriveJSON (defaultOptions { sumEncoding = ObjectWithSingleField }) ''ImportDeclarationType)
+$(deriveJSON (defaultOptions { sumEncoding = ObjectWithSingleField }) ''FixityAlias)
diff --git a/src/Language/PureScript/AST/Exported.hs b/src/Language/PureScript/AST/Exported.hs
index ec04824..dce1de9 100644
--- a/src/Language/PureScript/AST/Exported.hs
+++ b/src/Language/PureScript/AST/Exported.hs
@@ -127,7 +127,6 @@ isExported (Just exps) decl = any (matches decl) exps
matches (TypeDeclaration ident _) (ValueRef ident') = ident == ident'
matches (ValueDeclaration ident _ _ _) (ValueRef ident') = ident == ident'
matches (ExternDeclaration ident _) (ValueRef ident') = ident == ident'
- matches (FixityDeclaration _ name _) (ValueRef ident') = name == runIdent ident'
matches (DataDeclaration _ ident _ _) (TypeRef ident' _) = ident == ident'
matches (ExternDataDeclaration ident _) (TypeRef ident' _) = ident == ident'
matches (TypeSynonymDeclaration ident _ _) (TypeRef ident' _) = ident == ident'
@@ -136,6 +135,10 @@ isExported (Just exps) decl = any (matches decl) exps
matches (DataDeclaration _ ident _ _) (ProperRef ident') = runProperName ident == ident'
matches (TypeClassDeclaration ident _ _ _) (ProperRef ident') = runProperName ident == ident'
+ matches (FixityDeclaration _ name (Just (Qualified _ (AliasValue _)))) (ValueRef ident') = name == runIdent ident'
+ matches (FixityDeclaration _ name (Just (Qualified _ (AliasConstructor _)))) (ValueRef ident') = name == runIdent ident'
+ matches (FixityDeclaration _ name (Just (Qualified _ (AliasType _)))) (TypeOpRef ident') = name == runIdent ident'
+
matches (PositionedDeclaration _ _ d) r = d `matches` r
matches d (PositionedDeclarationRef _ _ r) = d `matches` r
matches _ _ = False
diff --git a/src/Language/PureScript/CoreFn/Desugar.hs b/src/Language/PureScript/CoreFn/Desugar.hs
index 0c86329..fc782e6 100644
--- a/src/Language/PureScript/CoreFn/Desugar.hs
+++ b/src/Language/PureScript/CoreFn/Desugar.hs
@@ -72,10 +72,12 @@ moduleToCoreFn env (A.Module _ coms mn decls (Just exps)) =
declToCoreFn ss _ (A.DataBindingGroupDeclaration ds) = concatMap (declToCoreFn ss []) ds
declToCoreFn ss com (A.ValueDeclaration name _ _ (Right e)) =
[NonRec (ssA ss) name (exprToCoreFn ss com Nothing e)]
- declToCoreFn ss com (A.FixityDeclaration _ name (Just alias)) =
- let meta = either getValueMeta (Just . getConstructorMeta) alias
- alias' = either id (fmap properToIdent) alias
- in [NonRec (ssA ss) (Op name) (Var (ss, com, Nothing, meta) alias')]
+ declToCoreFn ss com (A.FixityDeclaration _ name (Just (Qualified mn' (A.AliasValue name')))) =
+ let meta = getValueMeta (Qualified mn' name')
+ in [NonRec (ssA ss) (Op name) (Var (ss, com, Nothing, meta) (Qualified mn' name'))]
+ declToCoreFn ss com (A.FixityDeclaration _ name (Just (Qualified mn' (A.AliasConstructor name')))) =
+ let meta = Just $ getConstructorMeta (Qualified mn' name')
+ in [NonRec (ssA ss) (Op name) (Var (ss, com, Nothing, meta) (Qualified mn' (properToIdent name')))]
declToCoreFn ss _ (A.BindingGroupDeclaration ds) =
[Rec $ map (\(name, _, e) -> ((ssA ss, name), exprToCoreFn ss [] Nothing e)) ds]
declToCoreFn ss com (A.TypeClassDeclaration name _ supers members) =
@@ -208,7 +210,7 @@ findQualModules decls =
where
fqDecls :: A.Declaration -> [(Ann, ModuleName)]
fqDecls (A.TypeInstanceDeclaration _ _ q _ _) = getQual q
- fqDecls (A.FixityDeclaration _ _ (Just eq)) = either getQual getQual eq
+ fqDecls (A.FixityDeclaration _ _ (Just q)) = getQual q
fqDecls _ = []
fqValues :: A.Expr -> [(Ann, ModuleName)]
diff --git a/src/Language/PureScript/Docs/AsMarkdown.hs b/src/Language/PureScript/Docs/AsMarkdown.hs
index 9843931..8cd8c0b 100644
--- a/src/Language/PureScript/Docs/AsMarkdown.hs
+++ b/src/Language/PureScript/Docs/AsMarkdown.hs
@@ -80,7 +80,7 @@ codeToString :: RenderedCode -> String
codeToString = outputWith elemAsMarkdown
where
elemAsMarkdown (Syntax x) = x
- elemAsMarkdown (Ident x) = x
+ elemAsMarkdown (Ident x _) = x
elemAsMarkdown (Ctor x _) = x
elemAsMarkdown (Kind x) = x
elemAsMarkdown (Keyword x) = x
diff --git a/src/Language/PureScript/Docs/Convert.hs b/src/Language/PureScript/Docs/Convert.hs
index 2cb83cb..0358a70 100644
--- a/src/Language/PureScript/Docs/Convert.hs
+++ b/src/Language/PureScript/Docs/Convert.hs
@@ -26,9 +26,9 @@ import Text.Parsec (eof)
import qualified Language.PureScript as P
import qualified Language.PureScript.Constants as C
-import Language.PureScript.Docs.Types
-import Language.PureScript.Docs.Convert.Single (convertSingleModule, collectBookmarks)
import Language.PureScript.Docs.Convert.ReExports (updateReExports)
+import Language.PureScript.Docs.Convert.Single (convertSingleModule, collectBookmarks)
+import Language.PureScript.Docs.Types
-- |
-- Like convertModules, except that it takes a list of modules, together with
diff --git a/src/Language/PureScript/Docs/Convert/ReExports.hs b/src/Language/PureScript/Docs/Convert/ReExports.hs
index 0c67f88..a6b54f1 100644
--- a/src/Language/PureScript/Docs/Convert/ReExports.hs
+++ b/src/Language/PureScript/Docs/Convert/ReExports.hs
@@ -111,13 +111,14 @@ collectDeclarations imports exports = do
valsAndMembers <- collect lookupValueDeclaration impVals expVals
typeClasses <- collect lookupTypeClassDeclaration impTCs expTCs
types <- collect lookupTypeDeclaration impTypes expTypes
+ typeOps <- collect lookupTypeOpDeclaration impTypeOps expTypeOps
(vals, classes) <- handleTypeClassMembers valsAndMembers typeClasses
let filteredTypes = filterDataConstructors expCtors types
let filteredClasses = filterTypeClassMembers (map fst expVals) classes
- pure (Map.toList (Map.unionsWith (<>) [filteredTypes, filteredClasses, vals]))
+ pure (Map.toList (Map.unionsWith (<>) [filteredTypes, typeOps, filteredClasses, vals]))
where
collect lookup' imps exps = do
@@ -130,6 +131,9 @@ collectDeclarations imports exports = do
expTypes = map (first fst) (P.exportedTypes exports)
impTypes = concat (Map.elems (P.importedTypes imports))
+ expTypeOps = P.exportedTypeOps exports
+ impTypeOps = concat (Map.elems (P.importedTypeOps imports))
+
expCtors = concatMap (snd . fst) (P.exportedTypes exports)
expTCs = P.exportedTypeClasses exports
@@ -180,7 +184,7 @@ lookupValueDeclaration importedFrom ident = do
let
rs =
filter (\d -> declTitle d == P.showIdent ident
- && (isValue d || isAlias d)) decls
+ && (isValue d || isValueAlias d)) decls
errOther other =
internalErrorInModule
("lookupValueDeclaration: unexpected result:\n" ++
@@ -243,6 +247,23 @@ lookupTypeDeclaration importedFrom ty = do
internalErrorInModule
("lookupTypeDeclaration: unexpected result: " ++ show other)
+lookupTypeOpDeclaration ::
+ (MonadState (Map P.ModuleName Module) m,
+ MonadReader P.ModuleName m) =>
+ P.ModuleName ->
+ P.Ident ->
+ m (P.ModuleName, [Declaration])
+lookupTypeOpDeclaration importedFrom tyOp = do
+ decls <- lookupModuleDeclarations "lookupTypeOpDeclaration" importedFrom
+ let
+ ds = filter (\d -> declTitle d == ("type " ++ P.showIdent tyOp) && isTypeAlias d) decls
+ case ds of
+ [d] ->
+ pure (importedFrom, [d])
+ other ->
+ internalErrorInModule
+ ("lookupTypeOpDeclaration: unexpected result: " ++ show other)
+
lookupTypeClassDeclaration ::
(MonadState (Map P.ModuleName Module) m,
MonadReader P.ModuleName m) =>
diff --git a/src/Language/PureScript/Docs/Convert/Single.hs b/src/Language/PureScript/Docs/Convert/Single.hs
index fd9845c..7e60bfd 100644
--- a/src/Language/PureScript/Docs/Convert/Single.hs
+++ b/src/Language/PureScript/Docs/Convert/Single.hs
@@ -108,16 +108,17 @@ addDefaultFixity decl@Declaration{..}
defaultFixity = P.Fixity P.Infixl (-1)
getDeclarationTitle :: P.Declaration -> Maybe String
-getDeclarationTitle (P.ValueDeclaration name _ _ _) = Just (P.showIdent name)
-getDeclarationTitle (P.ExternDeclaration name _) = Just (P.showIdent name)
-getDeclarationTitle (P.DataDeclaration _ name _ _) = Just (P.runProperName name)
-getDeclarationTitle (P.ExternDataDeclaration name _) = Just (P.runProperName name)
-getDeclarationTitle (P.TypeSynonymDeclaration name _ _) = Just (P.runProperName name)
-getDeclarationTitle (P.TypeClassDeclaration name _ _ _) = Just (P.runProperName name)
+getDeclarationTitle (P.ValueDeclaration name _ _ _) = Just (P.showIdent name)
+getDeclarationTitle (P.ExternDeclaration name _) = Just (P.showIdent name)
+getDeclarationTitle (P.DataDeclaration _ name _ _) = Just (P.runProperName name)
+getDeclarationTitle (P.ExternDataDeclaration name _) = Just (P.runProperName name)
+getDeclarationTitle (P.TypeSynonymDeclaration name _ _) = Just (P.runProperName name)
+getDeclarationTitle (P.TypeClassDeclaration name _ _ _) = Just (P.runProperName name)
getDeclarationTitle (P.TypeInstanceDeclaration name _ _ _ _) = Just (P.showIdent name)
-getDeclarationTitle (P.FixityDeclaration _ name _) = Just ("(" ++ name ++ ")")
-getDeclarationTitle (P.PositionedDeclaration _ _ d) = getDeclarationTitle d
-getDeclarationTitle _ = Nothing
+getDeclarationTitle (P.FixityDeclaration _ name (Just (P.Qualified _ P.AliasType{}))) = Just ("type (" ++ name ++ ")")
+getDeclarationTitle (P.FixityDeclaration _ name _) = Just ("(" ++ name ++ ")")
+getDeclarationTitle (P.PositionedDeclaration _ _ d) = getDeclarationTitle d
+getDeclarationTitle _ = Nothing
-- | Create a basic Declaration value.
mkDeclaration :: String -> DeclarationInfo -> Declaration
diff --git a/src/Language/PureScript/Docs/ParseAndBookmark.hs b/src/Language/PureScript/Docs/ParseAndBookmark.hs
index cfb32d5..bea862d 100644
--- a/src/Language/PureScript/Docs/ParseAndBookmark.hs
+++ b/src/Language/PureScript/Docs/ParseAndBookmark.hs
@@ -16,6 +16,8 @@ import Control.Monad.IO.Class (MonadIO(..))
import Web.Bower.PackageMeta (PackageName)
+import System.IO.UTF8 (readUTF8File)
+
import qualified Language.PureScript as P
import Language.PureScript.Docs.Types
import Language.PureScript.Docs.Convert (collectBookmarks)
@@ -80,7 +82,7 @@ fileInfoToString (Local fn) = fn
fileInfoToString (FromDep _ fn) = fn
parseFile :: FilePath -> IO (FilePath, String)
-parseFile input' = (,) input' <$> readFile input'
+parseFile input' = (,) input' <$> readUTF8File input'
parseAs :: (MonadIO m) => (FilePath -> a) -> FilePath -> m (a, String)
parseAs g = fmap (first g) . liftIO . parseFile
diff --git a/src/Language/PureScript/Docs/Render.hs b/src/Language/PureScript/Docs/Render.hs
index ca53c91..9ac9a4e 100644
--- a/src/Language/PureScript/Docs/Render.hs
+++ b/src/Language/PureScript/Docs/Render.hs
@@ -58,23 +58,28 @@ renderDeclarationWithOptions opts Declaration{..} =
syntax "("
<> mintersperse (syntax "," <> sp) (map renderConstraint implies)
<> syntax ")" <> sp <> syntax "<="
- AliasDeclaration for (P.Fixity associativity precedence) ->
+ AliasDeclaration for@(P.Qualified _ alias) (P.Fixity associativity precedence) ->
[ keywordFixity associativity
, syntax $ show precedence
- , ident $
- either
- (P.showQualified P.runIdent . dequalifyCurrentModule)
- (P.showQualified P.runProperName . dequalifyCurrentModule)
- for
+ , ident $ renderAlias for
, keyword "as"
- , ident . tail . init $ declTitle
+ , ident $ adjustAliasName alias declTitle
]
where
renderType' = renderTypeWithOptions opts
- dequalifyCurrentModule (P.Qualified mn a)
- | mn == currentModule opts = P.Qualified Nothing a
- | otherwise = P.Qualified mn a
+ renderAlias (P.Qualified mn alias)
+ | mn == currentModule opts =
+ P.foldFixityAlias P.runIdent P.runProperName (("type " ++) . P.runProperName) alias
+ | otherwise =
+ P.foldFixityAlias
+ (P.showQualified P.runIdent . P.Qualified mn)
+ (P.showQualified P.runProperName . P.Qualified mn)
+ (("type " ++) . P.showQualified P.runProperName . P.Qualified mn)
+ alias
+
+ adjustAliasName (P.AliasType{}) title = drop 6 (init title)
+ adjustAliasName _ title = tail (init title)
renderChildDeclaration :: ChildDeclaration -> RenderedCode
renderChildDeclaration = renderChildDeclarationWithOptions defaultRenderTypeOptions
diff --git a/src/Language/PureScript/Docs/RenderedCode/Render.hs b/src/Language/PureScript/Docs/RenderedCode/Render.hs
index 6f9bbd0..ec23588 100644
--- a/src/Language/PureScript/Docs/RenderedCode/Render.hs
+++ b/src/Language/PureScript/Docs/RenderedCode/Render.hs
@@ -48,6 +48,10 @@ typeLiterals = mkPattern match
Just (syntax "()")
match row@RCons{} =
Just (syntax "(" <> renderRow row <> syntax ")")
+ match (BinaryNoParensType op l r) =
+ Just $ renderTypeAtom l <> sp <> renderTypeAtom op <> sp <> renderTypeAtom r
+ match (TypeOp (Qualified mn op)) =
+ Just (ident' (runIdent op) (maybeToContainingModule mn))
match _ =
Nothing
@@ -115,6 +119,12 @@ constrained = mkPattern match
match (ConstrainedType deps ty) = Just (deps, ty)
match _ = Nothing
+explicitParens :: Pattern () Type ((), Type)
+explicitParens = mkPattern match
+ where
+ match (ParensInType ty) = Just ((), ty)
+ match _ = Nothing
+
matchTypeAtom :: Pattern () Type RenderedCode
matchTypeAtom = typeLiterals <+> fmap parens matchType
where
@@ -130,6 +140,7 @@ matchType = buildPrettyPrinter operators matchTypeAtom
, [ Wrap constrained $ \deps ty -> renderConstraints deps ty ]
, [ Wrap forall_ $ \idents ty -> mconcat [syntax "forall", sp, mintersperse sp (map ident idents), syntax ".", sp, ty] ]
, [ Wrap kinded $ \k ty -> mintersperse sp [ty, syntax "::", renderKind k] ]
+ , [ Wrap explicitParens $ \_ ty -> ty ]
]
forall_ :: Pattern () Type ([String], Type)
@@ -156,7 +167,7 @@ convert _ other = other
convertForAlls :: Type -> Type
convertForAlls (ForAll i ty _) = go [i] ty
where
- go idents (ForAll ident' ty' _) = go (ident' : idents) ty'
+ go idents (ForAll i' ty' _) = go (i' : idents) ty'
go idents other = PrettyPrintForAll idents other
convertForAlls other = other
diff --git a/src/Language/PureScript/Docs/RenderedCode/Types.hs b/src/Language/PureScript/Docs/RenderedCode/Types.hs
index 307663a..8c5289d 100644
--- a/src/Language/PureScript/Docs/RenderedCode/Types.hs
+++ b/src/Language/PureScript/Docs/RenderedCode/Types.hs
@@ -18,6 +18,7 @@ module Language.PureScript.Docs.RenderedCode.Types
, sp
, syntax
, ident
+ , ident'
, ctor
, kind
, keyword
@@ -46,7 +47,7 @@ import qualified Language.PureScript as P
--
data RenderedCodeElement
= Syntax String
- | Ident String
+ | Ident String ContainingModule
| Ctor String ContainingModule
| Kind String
| Keyword String
@@ -56,8 +57,8 @@ data RenderedCodeElement
instance A.ToJSON RenderedCodeElement where
toJSON (Syntax str) =
A.toJSON ["syntax", str]
- toJSON (Ident str) =
- A.toJSON ["ident", str]
+ toJSON (Ident str mn) =
+ A.toJSON ["ident", A.toJSON str, A.toJSON mn]
toJSON (Ctor str mn) =
A.toJSON ["ctor", A.toJSON str, A.toJSON mn ]
toJSON (Kind str) =
@@ -70,7 +71,7 @@ instance A.ToJSON RenderedCodeElement where
asRenderedCodeElement :: Parse String RenderedCodeElement
asRenderedCodeElement =
a Syntax "syntax" <|>
- a Ident "ident" <|>
+ asIdent <|>
asCtor <|>
a Kind "kind" <|>
a Keyword "keyword" <|>
@@ -80,6 +81,7 @@ asRenderedCodeElement =
p <|> q = catchError p (const q)
a ctor' ctorStr = ctor' <$> (nth 0 (withString (eq ctorStr)) *> nth 1 asString)
+ asIdent = nth 0 (withString (eq "ident")) *> (Ident <$> nth 1 asString <*> nth 2 asContainingModule)
asCtor = nth 0 (withString (eq "ctor")) *> (Ctor <$> nth 1 asString <*> nth 2 asContainingModule)
asSpace = nth 0 (withString (eq "space")) *> pure Space
@@ -159,7 +161,10 @@ syntax :: String -> RenderedCode
syntax x = RC [Syntax x]
ident :: String -> RenderedCode
-ident x = RC [Ident x]
+ident x = RC [Ident x ThisModule]
+
+ident' :: String -> ContainingModule -> RenderedCode
+ident' x m = RC [Ident x m]
ctor :: String -> ContainingModule -> RenderedCode
ctor x m = RC [Ctor x m]
diff --git a/src/Language/PureScript/Docs/Types.hs b/src/Language/PureScript/Docs/Types.hs
index 28bbad4..ea09893 100644
--- a/src/Language/PureScript/Docs/Types.hs
+++ b/src/Language/PureScript/Docs/Types.hs
@@ -133,7 +133,7 @@ data DeclarationInfo
-- An operator alias declaration, with the member the alias is for and the
-- operator's fixity.
--
- | AliasDeclaration (Either (P.Qualified P.Ident) (P.Qualified (P.ProperName 'P.ConstructorName))) P.Fixity
+ | AliasDeclaration (P.Qualified P.FixityAlias) P.Fixity
deriving (Show, Eq, Ord)
declInfoToString :: DeclarationInfo -> String
@@ -164,10 +164,17 @@ isType Declaration{..} =
ExternDataDeclaration{} -> True
_ -> False
-isAlias :: Declaration -> Bool
-isAlias Declaration{..} =
+isValueAlias :: Declaration -> Bool
+isValueAlias Declaration{..} =
case declInfo of
- AliasDeclaration{} -> True
+ (AliasDeclaration (P.Qualified _ P.AliasConstructor{}) _) -> True
+ (AliasDeclaration (P.Qualified _ P.AliasValue{}) _) -> True
+ _ -> False
+
+isTypeAlias :: Declaration -> Bool
+isTypeAlias Declaration{..} =
+ case declInfo of
+ (AliasDeclaration (P.Qualified _ P.AliasType{}) _) -> True
_ -> False
-- | Discard any children which do not satisfy the given predicate.
@@ -411,7 +418,7 @@ asDeclarationInfo = do
other ->
throwCustomError (InvalidDeclarationType other)
-asAliasFor :: Parse e (Either (P.Qualified P.Ident) (P.Qualified (P.ProperName 'P.ConstructorName)))
+asAliasFor :: Parse e (P.Qualified P.FixityAlias)
asAliasFor = fromAesonParser
asTypeArguments :: Parse PackageError [(String, Maybe P.Kind)]
diff --git a/src/Language/PureScript/Errors.hs b/src/Language/PureScript/Errors.hs
index 3b97919..29508b4 100644
--- a/src/Language/PureScript/Errors.hs
+++ b/src/Language/PureScript/Errors.hs
@@ -10,7 +10,7 @@ import Prelude.Compat
import Data.Ord (comparing)
import Data.Char (isSpace)
import Data.Either (lefts, rights)
-import Data.List (intercalate, transpose, nub, nubBy, sortBy)
+import Data.List (intercalate, transpose, nub, nubBy, sortBy, partition)
import Data.Foldable (fold)
import Data.Maybe (maybeToList)
@@ -46,6 +46,7 @@ data SimpleErrorMessage
| UnnecessaryFFIModule ModuleName FilePath
| MissingFFIImplementations ModuleName [Ident]
| UnusedFFIImplementations ModuleName [Ident]
+ | InvalidFFIIdentifier ModuleName String
| CannotGetFileInfo FilePath
| CannotReadFile FilePath
| CannotWriteFile FilePath
@@ -59,12 +60,15 @@ data SimpleErrorMessage
| OverlappingNamesInLet
| UnknownModule ModuleName
| UnknownType (Qualified (ProperName 'TypeName))
+ | UnknownTypeOp (Qualified Ident)
| UnknownTypeClass (Qualified (ProperName 'ClassName))
| UnknownValue (Qualified Ident)
| UnknownDataConstructor (Qualified (ProperName 'ConstructorName)) (Maybe (Qualified (ProperName 'ConstructorName)))
| UnknownTypeConstructor (Qualified (ProperName 'TypeName))
| UnknownImportType ModuleName (ProperName 'TypeName)
| UnknownExportType (ProperName 'TypeName)
+ | UnknownImportTypeOp ModuleName Ident
+ | UnknownExportTypeOp Ident
| UnknownImportTypeClass ModuleName (ProperName 'ClassName)
| UnknownExportTypeClass (ProperName 'ClassName)
| UnknownImportValue ModuleName Ident
@@ -83,6 +87,7 @@ data SimpleErrorMessage
| DuplicateModuleName ModuleName
| DuplicateClassExport (ProperName 'ClassName)
| DuplicateValueExport Ident
+ | DuplicateTypeOpExport Ident
| DuplicateTypeArgument String
| InvalidDoBind
| InvalidDoLet
@@ -123,6 +128,7 @@ data SimpleErrorMessage
| ShadowedTypeVar String
| UnusedTypeVar String
| WildcardInferredType Type
+ | HoleInferredType String Type
| MissingTypeDeclaration Ident Type
| NotExhaustivePattern [[Binder]] Bool
| OverlappingPattern [[Binder]] Bool
@@ -139,7 +145,6 @@ data SimpleErrorMessage
| DeprecatedQualifiedSyntax ModuleName ModuleName
| DeprecatedClassImport ModuleName (ProperName 'ClassName)
| DeprecatedClassExport (ProperName 'ClassName)
- | RedundantUnqualifiedImport ModuleName ImportDeclarationType
| DuplicateSelectiveImport ModuleName
| DuplicateImport ModuleName ImportDeclarationType (Maybe ModuleName)
| DuplicateImportRef String
@@ -230,6 +235,7 @@ errorCode em = case unwrapErrorMessage em of
UnnecessaryFFIModule{} -> "UnnecessaryFFIModule"
MissingFFIImplementations{} -> "MissingFFIImplementations"
UnusedFFIImplementations{} -> "UnusedFFIImplementations"
+ InvalidFFIIdentifier{} -> "InvalidFFIIdentifier"
CannotGetFileInfo{} -> "CannotGetFileInfo"
CannotReadFile{} -> "CannotReadFile"
CannotWriteFile{} -> "CannotWriteFile"
@@ -243,12 +249,15 @@ errorCode em = case unwrapErrorMessage em of
OverlappingNamesInLet -> "OverlappingNamesInLet"
UnknownModule{} -> "UnknownModule"
UnknownType{} -> "UnknownType"
+ UnknownTypeOp{} -> "UnknownTypeOp"
UnknownTypeClass{} -> "UnknownTypeClass"
UnknownValue{} -> "UnknownValue"
UnknownDataConstructor{} -> "UnknownDataConstructor"
UnknownTypeConstructor{} -> "UnknownTypeConstructor"
UnknownImportType{} -> "UnknownImportType"
+ UnknownImportTypeOp{} -> "UnknownImportTypeOp"
UnknownExportType{} -> "UnknownExportType"
+ UnknownExportTypeOp{} -> "UnknownExportTypeOp"
UnknownImportTypeClass{} -> "UnknownImportTypeClass"
UnknownExportTypeClass{} -> "UnknownExportTypeClass"
UnknownImportValue{} -> "UnknownImportValue"
@@ -267,6 +276,7 @@ errorCode em = case unwrapErrorMessage em of
DuplicateModuleName{} -> "DuplicateModuleName"
DuplicateClassExport{} -> "DuplicateClassExport"
DuplicateValueExport{} -> "DuplicateValueExport"
+ DuplicateTypeOpExport{} -> "DuplicateTypeOpExport"
DuplicateTypeArgument{} -> "DuplicateTypeArgument"
InvalidDoBind -> "InvalidDoBind"
InvalidDoLet -> "InvalidDoLet"
@@ -307,6 +317,7 @@ errorCode em = case unwrapErrorMessage em of
ShadowedTypeVar{} -> "ShadowedTypeVar"
UnusedTypeVar{} -> "UnusedTypeVar"
WildcardInferredType{} -> "WildcardInferredType"
+ HoleInferredType{} -> "HoleInferredType"
MissingTypeDeclaration{} -> "MissingTypeDeclaration"
NotExhaustivePattern{} -> "NotExhaustivePattern"
OverlappingPattern{} -> "OverlappingPattern"
@@ -323,7 +334,6 @@ errorCode em = case unwrapErrorMessage em of
DeprecatedQualifiedSyntax{} -> "DeprecatedQualifiedSyntax"
DeprecatedClassImport{} -> "DeprecatedClassImport"
DeprecatedClassExport{} -> "DeprecatedClassExport"
- RedundantUnqualifiedImport{} -> "RedundantUnqualifiedImport"
DuplicateSelectiveImport{} -> "DuplicateSelectiveImport"
DuplicateImport{} -> "DuplicateImport"
DuplicateImportRef{} -> "DuplicateImportRef"
@@ -427,6 +437,7 @@ onTypesInErrorMessageM f (ErrorMessage hints simple) = ErrorMessage <$> traverse
gSimple (ExpectedType ty k) = ExpectedType <$> f ty <*> pure k
gSimple (OrphanInstance nm cl ts) = OrphanInstance nm cl <$> traverse f ts
gSimple (WildcardInferredType ty) = WildcardInferredType <$> f ty
+ gSimple (HoleInferredType name ty) = HoleInferredType name <$> f ty
gSimple (MissingTypeDeclaration nm ty) = MissingTypeDeclaration nm <$> f ty
gSimple (CannotGeneralizeRecursiveFunction nm ty) = CannotGeneralizeRecursiveFunction nm <$> f ty
@@ -452,7 +463,6 @@ errorSuggestion err = case err of
UnusedImport{} -> emptySuggestion
RedundantEmptyHidingImport{} -> emptySuggestion
DuplicateImport{} -> emptySuggestion
- RedundantUnqualifiedImport{} -> emptySuggestion
DeprecatedQualifiedSyntax name qualName -> suggest $
"import " ++ runModuleName name ++ " as " ++ runModuleName qualName
UnusedExplicitImport mn _ qual refs -> suggest $ importSuggestion mn refs qual
@@ -555,6 +565,13 @@ prettyPrintSingleError full level showWiki e = flip evalState defaultUnknownMap
paras [ line $ "The following definitions in the foreign module for module " ++ runModuleName mn ++ " are unused: "
, indent . paras $ map (line . runIdent) idents
]
+ renderSimpleErrorMessage (InvalidFFIIdentifier mn ident) =
+ paras [ line $ "In the FFI module for " ++ runModuleName mn ++ ":"
+ , indent . paras $
+ [ line $ "The identifier `" ++ ident ++ "` is not valid in PureScript."
+ , line "Note that exported identifiers in FFI modules must be valid PureScript identifiers."
+ ]
+ ]
renderSimpleErrorMessage (MultipleFFIModules mn paths) =
paras [ line $ "Multiple foreign module implementations have been provided for module " ++ runModuleName mn ++ ": "
, indent . paras $ map line paths
@@ -589,6 +606,8 @@ prettyPrintSingleError full level showWiki e = flip evalState defaultUnknownMap
line $ "Unknown module " ++ runModuleName mn
renderSimpleErrorMessage (UnknownType name) =
line $ "Unknown type " ++ showQualified runProperName name
+ renderSimpleErrorMessage (UnknownTypeOp name) =
+ line $ "Unknown type operator " ++ showQualified showIdent name
renderSimpleErrorMessage (UnknownTypeClass name) =
line $ "Unknown type class " ++ showQualified runProperName name
renderSimpleErrorMessage (UnknownValue name) =
@@ -603,6 +622,12 @@ prettyPrintSingleError full level showWiki e = flip evalState defaultUnknownMap
]
renderSimpleErrorMessage (UnknownExportType name) =
line $ "Cannot export unknown type " ++ runProperName name
+ renderSimpleErrorMessage (UnknownImportTypeOp mn name) =
+ paras [ line $ "Cannot import type operator " ++ showIdent name ++ " from module " ++ runModuleName mn
+ , line "It either does not exist or the module does not export it."
+ ]
+ renderSimpleErrorMessage (UnknownExportTypeOp name) =
+ line $ "Cannot export unknown type operator " ++ showIdent name
renderSimpleErrorMessage (UnknownImportTypeClass mn name) =
paras [ line $ "Cannot import type class " ++ runProperName name ++ " from module " ++ runModuleName mn
, line "It either does not exist or the module does not export it."
@@ -652,6 +677,8 @@ prettyPrintSingleError full level showWiki e = flip evalState defaultUnknownMap
line $ "Duplicate export declaration for type class " ++ runProperName nm
renderSimpleErrorMessage (DuplicateValueExport nm) =
line $ "Duplicate export declaration for value " ++ showIdent nm
+ renderSimpleErrorMessage (DuplicateTypeOpExport nm) =
+ line $ "Duplicate export declaration for type operator " ++ showIdent nm
renderSimpleErrorMessage (CycleInDeclaration nm) =
line $ "The value of " ++ showIdent nm ++ " is undefined here, so this reference is not allowed."
renderSimpleErrorMessage (CycleInModules mns) =
@@ -848,6 +875,10 @@ prettyPrintSingleError full level showWiki e = flip evalState defaultUnknownMap
paras [ line "Wildcard type definition has the inferred type "
, indent $ typeAsBox ty
]
+ renderSimpleErrorMessage (HoleInferredType name ty) =
+ paras [ line $ "Hole '" ++ name ++ "' has the inferred type "
+ , indent $ typeAsBox ty
+ ]
renderSimpleErrorMessage (MissingTypeDeclaration ident ty) =
paras [ line $ "No type declaration was provided for the top-level declaration of " ++ showIdent ident ++ "."
, line "It is good practice to provide type declarations as a form of documentation."
@@ -944,9 +975,6 @@ prettyPrintSingleError full level showWiki e = flip evalState defaultUnknownMap
, line "The deprecated syntax will be removed in PureScript 0.9."
]
- renderSimpleErrorMessage (RedundantUnqualifiedImport name imp) =
- line $ "Import of " ++ prettyPrintImport name imp Nothing ++ " is redundant due to a whole-module import"
-
renderSimpleErrorMessage (DuplicateSelectiveImport name) =
line $ "There is an existing import of " ++ runModuleName name ++ ", consider merging the import lists"
@@ -993,8 +1021,8 @@ prettyPrintSingleError full level showWiki e = flip evalState defaultUnknownMap
renderSimpleErrorMessage (InvalidOperatorInBinder op fn) =
paras [ line $ "Operator " ++ showIdent op ++ " cannot be used in a pattern as it is an alias for function " ++ showIdent fn ++ "."
- , line "Only aliases for data constructors may be used in patterns."
- ]
+ , line "Only aliases for data constructors may be used in patterns."
+ ]
renderSimpleErrorMessage DeprecatedRequirePath =
line "The require-path option is deprecated and will be removed in PureScript 0.9."
@@ -1202,6 +1230,7 @@ prettyPrintRef :: DeclarationRef -> String
prettyPrintRef (TypeRef pn Nothing) = runProperName pn ++ "(..)"
prettyPrintRef (TypeRef pn (Just [])) = runProperName pn
prettyPrintRef (TypeRef pn (Just dctors)) = runProperName pn ++ "(" ++ intercalate ", " (map runProperName dctors) ++ ")"
+prettyPrintRef (TypeOpRef ident) = "type " ++ showIdent ident
prettyPrintRef (ValueRef ident) = showIdent ident
prettyPrintRef (TypeClassRef pn) = "class " ++ runProperName pn
prettyPrintRef (ProperRef name) = name
@@ -1341,6 +1370,22 @@ withPosition :: SourceSpan -> ErrorMessage -> ErrorMessage
withPosition pos (ErrorMessage hints se) = ErrorMessage (PositionedError pos : hints) se
-- |
+-- Runs a computation listening for warnings and then escalating any warnings
+-- that match the predicate to error status.
+--
+escalateWarningWhen
+ :: (MonadWriter MultipleErrors m, MonadError MultipleErrors m)
+ => (ErrorMessage -> Bool)
+ -> m a
+ -> m a
+escalateWarningWhen isError ma = do
+ (a, w) <- censor (const mempty) $ listen ma
+ let (errors, warnings) = partition isError (runMultipleErrors w)
+ tell $ MultipleErrors warnings
+ unless (null errors) $ throwError $ MultipleErrors errors
+ return a
+
+-- |
-- Collect errors in in parallel
--
parU :: (MonadError MultipleErrors m) => [a] -> (a -> m b) -> m [b]
diff --git a/psc/JSON.hs b/src/Language/PureScript/Errors/JSON.hs
index c6fb051..a36f8e2 100644
--- a/psc/JSON.hs
+++ b/src/Language/PureScript/Errors/JSON.hs
@@ -1,6 +1,6 @@
-----------------------------------------------------------------------------
--
--- Module : Main
+-- Module : Language.PureScript.Errors.JSON
-- Copyright : (c) 2013-15 Phil Freeman, (c) 2014-15 Gary Burgess
-- License : MIT (http://opensource.org/licenses/MIT)
--
@@ -14,7 +14,7 @@
{-# LANGUAGE TemplateHaskell #-}
-module JSON where
+module Language.PureScript.Errors.JSON where
import Prelude ()
import Prelude.Compat
@@ -28,9 +28,9 @@ data ErrorPosition = ErrorPosition
, startColumn :: Int
, endLine :: Int
, endColumn :: Int
- }
+ } deriving (Show, Eq, Ord)
-data ErrorSuggestion = ErrorSuggestion { replacement :: String }
+data ErrorSuggestion = ErrorSuggestion { replacement :: String } deriving (Show, Eq)
data JSONError = JSONError
{ position :: Maybe ErrorPosition
@@ -40,12 +40,12 @@ data JSONError = JSONError
, filename :: Maybe String
, moduleName :: Maybe String
, suggestion :: Maybe ErrorSuggestion
- }
+ } deriving (Show, Eq)
data JSONResult = JSONResult
{ warnings :: [JSONError]
, errors :: [JSONError]
- }
+ } deriving (Show, Eq)
$(A.deriveJSON A.defaultOptions ''ErrorPosition)
$(A.deriveJSON A.defaultOptions ''JSONError)
@@ -64,7 +64,7 @@ toJSONError verbose level e =
(P.wikiUri e)
(P.spanName <$> sspan)
(P.runModuleName <$> P.errorModule e)
- (toSuggestion <$> (P.errorSuggestion $ P.unwrapErrorMessage e))
+ (toSuggestion <$> P.errorSuggestion (P.unwrapErrorMessage e))
where
sspan :: Maybe P.SourceSpan
sspan = P.errorSpan e
diff --git a/src/Language/PureScript/Externs.hs b/src/Language/PureScript/Externs.hs
index b334a8b..f9617d5 100644
--- a/src/Language/PureScript/Externs.hs
+++ b/src/Language/PureScript/Externs.hs
@@ -73,7 +73,7 @@ data ExternsFixity = ExternsFixity
-- | The operator symbol
, efOperator :: String
-- | The value the operator is an alias for
- , efAlias :: Maybe (Either (Qualified Ident) (Qualified (ProperName 'ConstructorName)))
+ , efAlias :: Maybe (Qualified FixityAlias)
} deriving (Show, Read)
-- | A type or value declaration appearing in an externs file
@@ -159,6 +159,7 @@ moduleToExternsFile (Module _ _ mn ds (Just exps)) env = ExternsFile{..}
exportsOp :: DeclarationRef -> Bool
exportsOp (PositionedDeclarationRef _ _ r) = exportsOp r
exportsOp (ValueRef ident') = ident' == Op op
+ exportsOp (TypeOpRef ident') = ident' == Op op
exportsOp _ = False
fixityDecl (PositionedDeclaration _ _ d) = fixityDecl d
fixityDecl _ = Nothing
diff --git a/src/Language/PureScript/Ide.hs b/src/Language/PureScript/Ide.hs
index 21840a2..dd51325 100644
--- a/src/Language/PureScript/Ide.hs
+++ b/src/Language/PureScript/Ide.hs
@@ -29,6 +29,7 @@ module Language.PureScript.Ide
import Prelude ()
import Prelude.Compat
+import Control.Monad (unless)
import Control.Monad.Error.Class
import Control.Monad.IO.Class
import "monad-logger" Control.Monad.Logger
@@ -45,18 +46,18 @@ import Language.PureScript.Ide.Completion
import Language.PureScript.Ide.Error
import Language.PureScript.Ide.Externs
import Language.PureScript.Ide.Filter
-import Language.PureScript.Ide.Imports hiding (Import)
+import Language.PureScript.Ide.Imports hiding (Import)
import Language.PureScript.Ide.Matcher
import Language.PureScript.Ide.Pursuit
+import Language.PureScript.Ide.Rebuild
import Language.PureScript.Ide.Reexports
import Language.PureScript.Ide.SourceFile
import Language.PureScript.Ide.State
import Language.PureScript.Ide.Types
import Language.PureScript.Ide.Util
import System.Directory
-import System.FilePath
import System.Exit
-
+import System.FilePath
handleCommand :: (PscIde m, MonadLogger m, MonadError PscIdeError m) =>
Command -> m Success
@@ -89,6 +90,8 @@ handleCommand (Import fp outfp filters (AddImportForIdentifier ident)) = do
case rs of
Right rs' -> answerRequest outfp rs'
Left question -> pure $ CompletionResult (mapMaybe completionFromMatch question)
+handleCommand (Rebuild file) =
+ rebuildFile file
handleCommand Cwd =
TextResult . T.pack <$> liftIO getCurrentDirectory
handleCommand Quit = liftIO exitSuccess
@@ -213,6 +216,8 @@ loadAllModules = do
outputPath <- confOutputPath . envConfiguration <$> ask
cwd <- liftIO getCurrentDirectory
let outputDirectory = cwd </> outputPath
+ liftIO (doesDirectoryExist outputDirectory)
+ >>= flip unless (throwError (GeneralError "Couldn't locate your output directory"))
liftIO (getDirectoryContents outputDirectory)
>>= liftIO . traverse (getExternsPath outputDirectory)
>>= traverse_ loadExtern . catMaybes
@@ -238,4 +243,3 @@ filePathFromModule moduleName = do
if ex
then pure path
else throwError (ModuleFileNotFound moduleName)
-
diff --git a/src/Language/PureScript/Ide/Command.hs b/src/Language/PureScript/Ide/Command.hs
index dbec3f1..3fd90ca 100644
--- a/src/Language/PureScript/Ide/Command.hs
+++ b/src/Language/PureScript/Ide/Command.hs
@@ -63,6 +63,7 @@ data Command
-- Import InputFile OutputFile
| Import FilePath (Maybe FilePath) [Filter] ImportCommand
| List { listType :: ListType }
+ | Rebuild FilePath -- ^ Rebuild the specified file using the loaded externs
| Cwd
| Quit
@@ -149,5 +150,8 @@ instance FromJSON Command where
filters <- params .:? "filters"
importCommand <- params .: "importCommand"
pure $ Import fp out (fromMaybe [] filters) importCommand
+ "rebuild" -> do
+ params <- o .: "params"
+ filePath <- params .: "file"
+ return $ Rebuild filePath
_ -> mzero
-
diff --git a/src/Language/PureScript/Ide/Error.hs b/src/Language/PureScript/Ide/Error.hs
index 37cccb3..eba509f 100644
--- a/src/Language/PureScript/Ide/Error.hs
+++ b/src/Language/PureScript/Ide/Error.hs
@@ -20,6 +20,7 @@ module Language.PureScript.Ide.Error
import Data.Aeson
import Data.Monoid
import Data.Text (Text, pack)
+import Language.PureScript.Errors.JSON
import Language.PureScript.Ide.Types (ModuleIdent)
import qualified Text.Parsec.Error as P
@@ -31,9 +32,13 @@ data PscIdeError
| ModuleNotFound ModuleIdent
| ModuleFileNotFound ModuleIdent
| ParseError P.ParseError ErrorMsg
- deriving (Show, Eq)
+ | RebuildError [JSONError]
instance ToJSON PscIdeError where
+ toJSON (RebuildError errs) = object
+ [ "resultType" .= ("error" :: Text)
+ , "result" .= errs
+ ]
toJSON err = object
[ "resultType" .= ("error" :: Text)
, "result" .= textError err
@@ -44,8 +49,9 @@ textError (GeneralError msg) = pack msg
textError (NotFound ident) = "Symbol '" <> ident <> "' not found."
textError (ModuleNotFound ident) = "Module '" <> ident <> "' not found."
textError (ModuleFileNotFound ident) = "Extern file for module " <> ident <>" could not be found"
-textError (ParseError parseError msg) = pack $ msg <> ": " <> show (escape parseError)
- where
- -- escape newlines and other special chars so we can send the error over the socket as a single line
- escape :: P.ParseError -> String
- escape = show
+textError (ParseError parseError msg) = let escape = show
+ -- escape newlines and other special
+ -- chars so we can send the error
+ -- over the socket as a single line
+ in pack $ msg <> ": " <> show (escape parseError)
+textError (RebuildError err) = pack (show err)
diff --git a/src/Language/PureScript/Ide/Externs.hs b/src/Language/PureScript/Ide/Externs.hs
index de64116..a082722 100644
--- a/src/Language/PureScript/Ide/Externs.hs
+++ b/src/Language/PureScript/Ide/Externs.hs
@@ -33,12 +33,13 @@ import Prelude.Compat
import Control.Monad.Error.Class
import Control.Monad.IO.Class
+import Data.Aeson (decodeStrict)
import Data.List (nub)
import Data.Maybe (mapMaybe)
import Data.Monoid
import Data.Text (Text)
import qualified Data.Text as T
-import qualified Data.Text.IO as T
+import qualified Data.ByteString as BS
import Language.PureScript.Ide.Error (PscIdeError (..))
import Language.PureScript.Ide.Types
import Language.PureScript.Ide.Util
@@ -49,7 +50,7 @@ import qualified Language.PureScript.Externs as PE
readExternFile :: (MonadIO m, MonadError PscIdeError m) =>
FilePath -> m PE.ExternsFile
readExternFile fp = do
- parseResult <- liftIO (decodeT <$> T.readFile fp)
+ parseResult <- liftIO (decodeStrict <$> BS.readFile fp)
case parseResult of
Nothing -> throwError . GeneralError $ "Parsing the extern at: " ++ fp ++ " failed"
Just externs -> pure externs
diff --git a/src/Language/PureScript/Ide/Imports.hs b/src/Language/PureScript/Ide/Imports.hs
index 8fe4dcf..c02fb99 100644
--- a/src/Language/PureScript/Ide/Imports.hs
+++ b/src/Language/PureScript/Ide/Imports.hs
@@ -76,8 +76,8 @@ compImport (Import n i q) (Import n' i' q')
| compImportType i i' /= EQ = compImportType i i'
-- This means that for a stable sort, the first implicit import will stay
-- the first implicit import
- | P.isImplicit i && isNothing q = LT
- | P.isImplicit i && isNothing q' = GT
+ | not (P.isExplicit i) && isNothing q = LT
+ | not (P.isExplicit i) && isNothing q' = GT
| otherwise = compare n n'
-- | Reads a file and returns the (lines before the imports, the imports, the
diff --git a/src/Language/PureScript/Ide/Rebuild.hs b/src/Language/PureScript/Ide/Rebuild.hs
new file mode 100644
index 0000000..4d56855
--- /dev/null
+++ b/src/Language/PureScript/Ide/Rebuild.hs
@@ -0,0 +1,85 @@
+{-# LANGUAGE ConstraintKinds #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE PackageImports #-}
+{-# LANGUAGE RecordWildCards #-}
+{-# LANGUAGE TupleSections #-}
+
+module Language.PureScript.Ide.Rebuild where
+
+import Language.PureScript.Ide.Error
+import Language.PureScript.Ide.State
+import Language.PureScript.Ide.Types
+
+import Control.Monad.Error.Class
+import Control.Monad.IO.Class
+import "monad-logger" Control.Monad.Logger
+import Control.Monad.Reader.Class
+import Control.Monad.Trans.Except
+import qualified Data.Map.Lazy as M
+import Data.Maybe (fromJust, mapMaybe)
+import qualified Data.Set as S
+import qualified Language.PureScript as P
+import Language.PureScript.Errors.JSON
+import qualified Language.PureScript.Externs as P
+import System.FilePath (replaceExtension)
+import System.Directory (doesFileExist)
+import System.IO.UTF8 (readUTF8File)
+
+rebuildFile
+ :: (PscIde m, MonadLogger m, MonadError PscIdeError m)
+ => FilePath
+ -> m Success
+rebuildFile path = do
+
+ input <- liftIO $ readUTF8File path
+
+ m <- case map snd <$> P.parseModulesFromFiles id [(path, input)] of
+ Left parseError ->
+ throwError . RebuildError . toJSONErrors False P.Error $ parseError
+ Right [m] -> pure m
+ Right _ -> throwError . GeneralError $ "Please define exactly one module."
+
+ externs <- sortExterns m . M.delete (P.getModuleName m) =<< getExternFiles
+
+ outputDirectory <- confOutputPath . envConfiguration <$> ask
+
+ let foreignModule = replaceExtension path "js"
+ foreignExists <- liftIO (doesFileExist foreignModule)
+
+ let ma = P.buildMakeActions outputDirectory
+ (M.singleton (P.getModuleName m) (Left P.RebuildAlways))
+ (if foreignExists
+ then M.singleton (P.getModuleName m) foreignModule
+ else M.empty)
+ False
+ (result, warnings) <- liftIO
+ . P.runMake P.defaultOptions
+ . P.rebuildModule (ma { P.progress = const (pure ()) }) externs
+ $ P.addDefaultImport (P.ModuleName [P.ProperName "Prim"]) m
+ case result of
+ Left errors -> throwError . RebuildError $ toJSONErrors False P.Error errors
+ Right _ -> pure . RebuildSuccess $ toJSONErrors False P.Warning warnings
+
+sortExterns
+ :: (PscIde m, MonadError PscIdeError m)
+ => P.Module
+ -> M.Map P.ModuleName P.ExternsFile
+ -> m [P.ExternsFile]
+sortExterns m ex = do
+ sorted' <- runExceptT . P.sortModules . (:) m . map mkShallowModule . M.elems $ ex
+ case sorted' of
+ Left _ -> throwError (GeneralError "There was a cycle in the dependencies")
+ Right (sorted, graph) -> do
+ let deps = fromJust (lookup (P.getModuleName m) graph)
+ pure $ mapMaybe getExtern (deps `inOrderOf` map P.getModuleName sorted)
+ where
+ mkShallowModule P.ExternsFile{..} =
+ P.Module undefined [] efModuleName (map mkImport efImports) Nothing
+ mkImport (P.ExternsImport mn it iq) =
+ P.ImportDeclaration mn it iq False
+ getExtern mn = M.lookup mn ex
+ -- Sort a list so its elements appear in the same order as in another list.
+ inOrderOf :: (Ord a) => [a] -> [a] -> [a]
+ inOrderOf xs ys = let s = S.fromList xs in filter (`S.member` s) ys
diff --git a/src/Language/PureScript/Ide/SourceFile.hs b/src/Language/PureScript/Ide/SourceFile.hs
index 24ce7de..d687285 100644
--- a/src/Language/PureScript/Ide/SourceFile.hs
+++ b/src/Language/PureScript/Ide/SourceFile.hs
@@ -35,6 +35,7 @@ import Language.PureScript.Ide.Types
import qualified Language.PureScript.Names as N
import qualified Language.PureScript.Parser as P
import System.Directory
+import System.IO.UTF8 (readUTF8File)
parseModuleFromFile :: (MonadIO m, MonadError PscIdeError m) =>
FilePath -> m D.Module
@@ -42,7 +43,7 @@ parseModuleFromFile fp = do
exists <- liftIO (doesFileExist fp)
if exists
then do
- content <- liftIO (readFile fp)
+ content <- liftIO (readUTF8File fp)
let m = do tokens <- P.lex fp content
P.runTokenParser "" P.parseModule tokens
either (throwError . (`ParseError` "File could not be parsed.")) pure m
diff --git a/src/Language/PureScript/Ide/State.hs b/src/Language/PureScript/Ide/State.hs
index b649fe8..12516b1 100644
--- a/src/Language/PureScript/Ide/State.hs
+++ b/src/Language/PureScript/Ide/State.hs
@@ -51,6 +51,10 @@ getExternFiles = do
stateVar <- envStateVar <$> ask
liftIO (externsFiles <$> readTVarIO stateVar)
+getExternFile :: (PscIde m) =>
+ ModuleName -> m (Maybe ExternsFile)
+getExternFile mn = M.lookup mn <$> getExternFiles
+
getAllDecls :: (PscIde m) => m [ExternDecl]
getAllDecls = concat <$> getPscIdeState
diff --git a/src/Language/PureScript/Ide/Types.hs b/src/Language/PureScript/Ide/Types.hs
index d1349e1..1f6d02b 100644
--- a/src/Language/PureScript/Ide/Types.hs
+++ b/src/Language/PureScript/Ide/Types.hs
@@ -33,6 +33,7 @@ import Data.Maybe (maybeToList)
import Data.Text (Text (), pack, unpack)
import qualified Language.PureScript.AST.Declarations as D
import Language.PureScript.Externs
+import qualified Language.PureScript.Errors.JSON as P
import qualified Language.PureScript.Names as N
import qualified Language.PureScript as P
@@ -59,9 +60,9 @@ data ExternDecl
[DeclIdent] -- The exported identifiers
-- | A data/newtype declaration
| DataConstructor
- DeclIdent -- ^ The type name
+ DeclIdent -- The type name
(P.ProperName 'P.TypeName)
- P.Type -- ^ The "type"
+ P.Type -- The "type"
-- | An exported module
| TypeClassDeclaration (P.ProperName 'P.ClassName)
| Export ModuleIdent -- The exported Modules name
@@ -144,6 +145,7 @@ data Success =
| PursuitResult [PursuitResponse]
| ImportList [ModuleImport]
| ModuleList [ModuleIdent]
+ | RebuildSuccess [P.JSONError]
deriving(Show, Eq)
encodeSuccess :: (ToJSON a) => a -> Value
@@ -157,6 +159,7 @@ instance ToJSON Success where
toJSON (PursuitResult resp) = encodeSuccess resp
toJSON (ImportList decls) = encodeSuccess decls
toJSON (ModuleList modules) = encodeSuccess modules
+ toJSON (RebuildSuccess modules) = encodeSuccess modules
newtype PursuitQuery = PursuitQuery Text
deriving (Show, Eq)
diff --git a/src/Language/PureScript/Linter/Imports.hs b/src/Language/PureScript/Linter/Imports.hs
index 446ede2..f80a264 100644
--- a/src/Language/PureScript/Linter/Imports.hs
+++ b/src/Language/PureScript/Linter/Imports.hs
@@ -35,6 +35,7 @@ import qualified Language.PureScript.Constants as C
data Name
= IdentName (Qualified Ident)
| TyName (Qualified (ProperName 'TypeName))
+ | TyOpName (Qualified Ident)
| DctorName (Qualified (ProperName 'ConstructorName))
| TyClassName (Qualified (ProperName 'ClassName))
deriving (Eq, Show)
@@ -43,6 +44,10 @@ getIdentName :: Maybe ModuleName -> Name -> Maybe Ident
getIdentName q (IdentName (Qualified q' name)) | q == q' = Just name
getIdentName _ _ = Nothing
+getTypeOpName :: Maybe ModuleName -> Name -> Maybe Ident
+getTypeOpName q (TyOpName (Qualified q' name)) | q == q' = Just name
+getTypeOpName _ _ = Nothing
+
getTypeName :: Maybe ModuleName -> Name -> Maybe (ProperName 'TypeName)
getTypeName q (TyName (Qualified q' name)) | q == q' = Just name
getTypeName _ _ = Nothing
@@ -162,10 +167,15 @@ lintImports (Module _ _ mn mdecls mexports) env usedImps = do
-> [(ModuleName, Name)]
extractByQual k m toName = mapMaybe go (M.toList m)
where
- go (q@(Qualified mnq _), is) | isUnqualified q || isQualifiedWith k q =
- case importName (head is) of
- Qualified (Just mn') name -> Just (mn', toName $ Qualified mnq name)
- _ -> internalError "unqualified name in extractByQual"
+ go (q@(Qualified mnq _), is)
+ | isUnqualified q =
+ case find (isQualifiedWith k) (map importName is) of
+ Just (Qualified _ name) -> Just (k, toName $ Qualified mnq name)
+ _ -> Nothing
+ | isQualifiedWith k q =
+ case importName (head is) of
+ Qualified (Just mn') name -> Just (mn', toName $ Qualified mnq name)
+ _ -> internalError "unqualified name in extractByQual"
go _ = Nothing
lintImportDecl
@@ -185,7 +195,7 @@ lintImportDecl env mni qualifierName names declType allowImplicit =
Just q ->
let usedModuleNames = mapMaybe extractQualName names
in unless (q `elem` usedModuleNames) unused
- Hiding _ -> checkImplicit HidingImport
+ Hiding _ -> unless allowImplicit (checkImplicit HidingImport)
Explicit [] -> unused
Explicit declrefs -> checkExplicit declrefs
@@ -260,6 +270,7 @@ findUsedRefs env mni qualifierName names =
let
classRefs = TypeClassRef <$> mapMaybe (getClassName qualifierName) names
valueRefs = ValueRef <$> mapMaybe (getIdentName qualifierName) names
+ typeOpRefs = TypeOpRef <$> mapMaybe (getTypeOpName qualifierName) names
types = mapMaybe (getTypeName qualifierName) names
dctors = mapMaybe (matchDctor qualifierName) names
typesWithDctors = reconstructTypeRefs dctors
@@ -267,7 +278,7 @@ findUsedRefs env mni qualifierName names =
typesRefs
= map (flip TypeRef (Just [])) typesWithoutDctors
++ map (\(ty, ds) -> TypeRef ty (Just ds)) (M.toList typesWithDctors)
- in classRefs ++ typesRefs ++ valueRefs
+ in classRefs ++ typeOpRefs ++ typesRefs ++ valueRefs
where
@@ -304,6 +315,7 @@ matchName _ _ _ = Nothing
extractQualName :: Name -> Maybe ModuleName
extractQualName (IdentName (Qualified q _)) = q
extractQualName (TyName (Qualified q _)) = q
+extractQualName (TyOpName (Qualified q _)) = q
extractQualName (TyClassName (Qualified q _)) = q
extractQualName (DctorName (Qualified q _)) = q
diff --git a/src/Language/PureScript/Make.hs b/src/Language/PureScript/Make.hs
index 024bd67..b0c1ccd 100644
--- a/src/Language/PureScript/Make.hs
+++ b/src/Language/PureScript/Make.hs
@@ -14,6 +14,7 @@ module Language.PureScript.Make
, ProgressMessage(..), renderProgressMessage
, MakeActions(..)
, Externs()
+ , rebuildModule
, make
-- * Implementation of Make API using files on disk
@@ -42,6 +43,7 @@ import Control.Concurrent.Lifted as C
import Data.List (foldl', sort)
import Data.Maybe (fromMaybe, catMaybes, isJust)
+import Data.Either (partitionEithers)
import Data.Time.Clock
import Data.String (fromString)
import Data.Foldable (for_)
@@ -146,6 +148,28 @@ data RebuildPolicy
-- | Always rebuild this module
| RebuildAlways deriving (Show, Read, Eq, Ord)
+-- | Rebuild a single module
+rebuildModule :: forall m. (Monad m, MonadBaseControl IO m, MonadReader Options m, MonadError MultipleErrors m, MonadWriter MultipleErrors m)
+ => MakeActions m
+ -> [ExternsFile]
+ -> Module
+ -> m ExternsFile
+rebuildModule MakeActions{..} externs m@(Module _ _ moduleName _ _) = do
+ progress $ CompilingModule moduleName
+ let env = foldl' (flip applyExternsFileToEnvironment) initEnvironment externs
+ lint m
+ ((checked@(Module ss coms _ elaborated exps), env'), nextVar) <- runSupplyT 0 $ do
+ [desugared] <- desugar externs [m]
+ runCheck' env $ typeCheckModule desugared
+ checkExhaustiveModule env' checked
+ regrouped <- createBindingGroups moduleName . collapseBindingGroups $ elaborated
+ let mod' = Module ss coms moduleName regrouped exps
+ corefn = CF.moduleToCoreFn env' mod'
+ [renamed] = renameInModules [corefn]
+ exts = moduleToExternsFile mod' env'
+ evalSupplyT nextVar . codegen renamed env' . BU8.toString . B.toStrict . encode $ exts
+ return exts
+
-- |
-- Compiles in "make" mode, compiling each module separately to a js files and an externs file
--
@@ -156,7 +180,7 @@ make :: forall m. (Monad m, MonadBaseControl IO m, MonadReader Options m, MonadE
=> MakeActions m
-> [Module]
-> m Environment
-make MakeActions{..} ms = do
+make ma@MakeActions{..} ms = do
requirePath <- asks optionsRequirePath
when (isJust requirePath) $ tell $ errorMessage DeprecatedRequirePath
@@ -220,21 +244,7 @@ make MakeActions{..} ms = do
_ -> True
let rebuild = do
- (exts, warnings) <- listen $ do
- progress $ CompilingModule moduleName
- let env = foldl' (flip applyExternsFileToEnvironment) initEnvironment externs
- lint m
- ((checked@(Module ss coms _ elaborated exps), env'), nextVar) <- runSupplyT 0 $ do
- [desugared] <- desugar externs [m]
- runCheck' env $ typeCheckModule desugared
- checkExhaustiveModule env' checked
- regrouped <- createBindingGroups moduleName . collapseBindingGroups $ elaborated
- let mod' = Module ss coms moduleName regrouped exps
- corefn = CF.moduleToCoreFn env' mod'
- [renamed] = renameInModules [corefn]
- exts = moduleToExternsFile mod' env'
- evalSupplyT nextVar . codegen renamed env' . BU8.toString . B.toStrict . encode $ exts
- return exts
+ (exts, warnings) <- listen $ rebuildModule ma externs m
markComplete (Just (warnings, exts)) Nothing
if shouldRebuild
@@ -417,11 +427,10 @@ checkForeignDecls m path = do
js <- either (errorParsingModule . Bundle.UnableToParseModule) pure $ JS.parse jsStr path
foreignIdentsStrs <- either errorParsingModule pure $ getExps js
- let foreignIdents =
- either
- (internalError . ("checkForeignDecls: unexpected idents: " ++) . show)
- S.fromList
- (traverse parseIdent foreignIdentsStrs)
+ foreignIdents <- either
+ errorInvalidForeignIdentifiers
+ (pure . S.fromList)
+ (parseIdents foreignIdentsStrs)
let importedIdents = S.fromList $ map fst (CF.moduleForeign m)
let unusedFFI = foreignIdents S.\\ importedIdents
@@ -443,10 +452,24 @@ checkForeignDecls m path = do
getExps :: JS.JSAST -> Either Bundle.ErrorMessage [String]
getExps = Bundle.getExportedIdentifiers (runModuleName mname)
+ errorInvalidForeignIdentifiers :: [String] -> SupplyT Make a
+ errorInvalidForeignIdentifiers =
+ throwError . mconcat . map (errorMessage . InvalidFFIIdentifier mname)
+
+ parseIdents :: [String] -> Either [String] [Ident]
+ parseIdents strs =
+ case partitionEithers (map parseIdent strs) of
+ ([], idents) ->
+ Right idents
+ (errs, _) ->
+ Left errs
+
-- TODO: Handling for parenthesised operators should be removed after 0.9.
+ -- We ignore the error message here, just being told it's an invalid
+ -- identifier should be enough.
parseIdent :: String -> Either String Ident
parseIdent str = try str <|> try ("(" ++ str ++ ")")
where
- try s = either (Left . show) Right $ do
+ try s = either (const (Left str)) Right $ do
ts <- PSParser.lex "" s
PSParser.runTokenParser "" (PSParser.parseIdent <* Parsec.eof) ts
diff --git a/src/Language/PureScript/ModuleDependencies.hs b/src/Language/PureScript/ModuleDependencies.hs
index 93b85e8..39296fe 100644
--- a/src/Language/PureScript/ModuleDependencies.hs
+++ b/src/Language/PureScript/ModuleDependencies.hs
@@ -1,19 +1,8 @@
------------------------------------------------------------------------------
---
--- Module : Language.PureScript.ModuleDependencies
--- Copyright : (c) 2013-15 Phil Freeman, (c) 2014-15 Gary Burgess
--- License : MIT (http://opensource.org/licenses/MIT)
---
--- Maintainer : Phil Freeman <paf31@cantab.net>
--- Stability : experimental
--- Portability :
---
--- | Provides the ability to sort modules based on module dependencies
---
------------------------------------------------------------------------------
-
{-# LANGUAGE FlexibleContexts #-}
+-- |
+-- Provides the ability to sort modules based on module dependencies
+--
module Language.PureScript.ModuleDependencies (
sortModules,
ModuleGraph
@@ -40,7 +29,7 @@ type ModuleGraph = [(ModuleName, [ModuleName])]
--
sortModules :: (MonadError MultipleErrors m) => [Module] -> m ([Module], ModuleGraph)
sortModules ms = do
- let verts = map (\m@(Module _ _ _ ds _) -> (m, getModuleName m, nub (concatMap usedModules ds))) ms
+ let verts = map goModule ms
ms' <- mapM toModule $ stronglyConnComp verts
let (graph, fromVertex, toVertex) = graphFromEdges verts
moduleGraph = do (_, mn, _) <- verts
@@ -49,30 +38,53 @@ sortModules ms = do
toKey i = case fromVertex i of (_, key, _) -> key
return (mn, filter (/= mn) (map toKey deps))
return (ms', moduleGraph)
+ where
+ goModule :: Module -> (Module, ModuleName, [ModuleName])
+ goModule m@(Module _ _ _ ds _) =
+ let ams = concatMap extractQualAs ds
+ in (m, getModuleName m, nub (concatMap (usedModules ams) ds))
+
+ -- Extract module names that have been brought into scope by an `as` import.
+ extractQualAs :: Declaration -> [ModuleName]
+ extractQualAs (PositionedDeclaration _ _ d) = extractQualAs d
+ extractQualAs (ImportDeclaration _ _ (Just am) _) = [am]
+ extractQualAs _ = []
-- |
--- Calculate a list of used modules based on explicit imports and qualified names
+-- Calculate a list of used modules based on explicit imports and qualified
+-- names. `ams` is a list of `ModuleNames` that refer to names brought into
+-- scope by importing with `as` - this ensures that when building the list we
+-- don't inadvertantly assume a dependency on an actual module, if there is a
+-- module that has the same name as the qualified import.
--
-usedModules :: Declaration -> [ModuleName]
-usedModules d =
+usedModules :: [ModuleName] -> Declaration -> [ModuleName]
+usedModules ams d =
let (f, _, _, _, _) = everythingOnValues (++) forDecls forValues (const []) (const []) (const [])
(g, _, _, _, _) = accumTypes (everythingOnTypes (++) forTypes)
in nub (f d ++ g d)
where
+
forDecls :: Declaration -> [ModuleName]
- forDecls (ImportDeclaration mn _ _ _) = [mn]
- forDecls (FixityDeclaration _ _ (Just (Left (Qualified (Just mn) _)))) = [mn]
- forDecls (FixityDeclaration _ _ (Just (Right (Qualified (Just mn) _)))) = [mn]
- forDecls (TypeInstanceDeclaration _ _ (Qualified (Just mn) _) _ _) = [mn]
+ forDecls (ImportDeclaration mn _ _ _) =
+ -- Regardless of whether an imported module is qualified we still need to
+ -- take into account its import to build an accurate list of dependencies.
+ [mn]
+ forDecls (FixityDeclaration _ _ (Just (Qualified (Just mn) _)))
+ | mn `notElem` ams = [mn]
+ forDecls (TypeInstanceDeclaration _ _ (Qualified (Just mn) _) _ _)
+ | mn `notElem` ams = [mn]
forDecls _ = []
forValues :: Expr -> [ModuleName]
- forValues (Var (Qualified (Just mn) _)) = [mn]
- forValues (Constructor (Qualified (Just mn) _)) = [mn]
+ forValues (Var (Qualified (Just mn) _))
+ | mn `notElem` ams = [mn]
+ forValues (Constructor (Qualified (Just mn) _))
+ | mn `notElem` ams = [mn]
forValues _ = []
forTypes :: Type -> [ModuleName]
- forTypes (TypeConstructor (Qualified (Just mn) _)) = [mn]
+ forTypes (TypeConstructor (Qualified (Just mn) _))
+ | mn `notElem` ams = [mn]
forTypes _ = []
-- |
diff --git a/src/Language/PureScript/Parser/Declarations.hs b/src/Language/PureScript/Parser/Declarations.hs
index 42d2253..d2d4feb 100644
--- a/src/Language/PureScript/Parser/Declarations.hs
+++ b/src/Language/PureScript/Parser/Declarations.hs
@@ -122,12 +122,13 @@ parseFixityDeclaration :: TokenParser Declaration
parseFixityDeclaration = do
fixity <- parseFixity
indented
- alias <- P.optionMaybe $ aliased <* reserved "as"
+ alias <- P.optionMaybe $ parseQualified aliased <* reserved "as"
name <- symbol
return $ FixityDeclaration fixity name alias
where
- aliased = (Left <$> parseQualified (Ident <$> identifier))
- <|> (Right <$> parseQualified (ProperName <$> uname))
+ aliased = (AliasValue . Ident <$> identifier)
+ <|> (AliasConstructor <$> properName)
+ <|> reserved "type" *> (AliasType <$> properName)
parseImportDeclaration :: TokenParser Declaration
parseImportDeclaration = do
@@ -164,6 +165,7 @@ parseDeclarationRef =
<|> parseProperRef
<|> (TypeClassRef <$> (reserved "class" *> properName))
<|> (ModuleRef <$> (indented *> reserved "module" *> moduleName))
+ <|> (TypeOpRef <$> (indented *> reserved "type" *> parens (Op <$> symbol)))
where
parseProperRef = do
name <- properName
@@ -390,6 +392,7 @@ parseValueAtom = P.choice
, parseLet
, P.try $ Parens <$> parens parseValue
, parseOperatorSection
+ , parseHole
]
-- |
@@ -405,6 +408,9 @@ parseOperatorSection = parens $ left <|> right
right = OperatorSection <$> parseInfixExpr <* indented <*> (Right <$> indexersAndAccessors)
left = flip OperatorSection <$> (Left <$> indexersAndAccessors) <* indented <*> parseInfixExpr
+parseHole :: TokenParser Expr
+parseHole = Hole <$> holeLit
+
parsePropertyUpdate :: TokenParser (String, Expr)
parsePropertyUpdate = do
name <- lname <|> stringLiteral
@@ -483,7 +489,7 @@ parseConstructorBinder :: TokenParser Binder
parseConstructorBinder = ConstructorBinder <$> C.parseQualified C.properName <*> many (C.indented *> parseBinderNoParens)
parseObjectBinder:: TokenParser Binder
-parseObjectBinder= LiteralBinder <$> parseObjectLiteral (C.indented *> parseIdentifierAndBinder)
+parseObjectBinder = LiteralBinder <$> parseObjectLiteral (C.indented *> parseIdentifierAndBinder)
parseArrayBinder :: TokenParser Binder
parseArrayBinder = LiteralBinder <$> parseArrayLiteral (C.indented *> parseBinder)
diff --git a/src/Language/PureScript/Parser/Lexer.hs b/src/Language/PureScript/Parser/Lexer.hs
index 4cabc01..e7f14b3 100644
--- a/src/Language/PureScript/Parser/Lexer.hs
+++ b/src/Language/PureScript/Parser/Lexer.hs
@@ -48,6 +48,7 @@ module Language.PureScript.Parser.Lexer
, semi
, at
, underscore
+ , holeLit
, semiSep
, semiSep1
, commaSep
@@ -68,12 +69,13 @@ module Language.PureScript.Parser.Lexer
, reservedPsNames
, reservedTypeNames
, isSymbolChar
+ , isUnquotedKey
)
where
import Prelude hiding (lex)
-import Data.Char (isSpace, isAscii, isSymbol)
+import Data.Char (isSpace, isAscii, isSymbol, isAlphaNum)
import Control.Monad (void, guard)
import Data.Functor.Identity
@@ -115,6 +117,7 @@ data Token
| CharLiteral Char
| StringLiteral String
| Number (Either Integer Double)
+ | HoleLit String
deriving (Show, Read, Eq, Ord)
prettyPrintToken :: Token -> String
@@ -146,6 +149,7 @@ prettyPrintToken (Symbol s) = s
prettyPrintToken (CharLiteral c) = show c
prettyPrintToken (StringLiteral s) = show s
prettyPrintToken (Number n) = either show show n
+prettyPrintToken (HoleLit name) = "?" ++ name
data PositionedToken = PositionedToken
{ ptSourcePos :: P.SourcePos
@@ -209,6 +213,7 @@ parseToken = P.choice
, P.try $ P.char ';' *> P.notFollowedBy symbolChar *> pure Semi
, P.try $ P.char '@' *> P.notFollowedBy symbolChar *> pure At
, P.try $ P.char '_' *> P.notFollowedBy identLetter *> pure Underscore
+ , HoleLit <$> P.try (P.char '?' *> P.many1 identLetter)
, LName <$> parseLName
, do uName <- parseUName
(guard (validModuleName uName) >> Qualifier uName <$ P.char '.') <|> pure (UName uName)
@@ -376,6 +381,12 @@ at = match At
underscore :: TokenParser ()
underscore = match Underscore
+holeLit :: TokenParser String
+holeLit = token go P.<?> "hole literal"
+ where
+ go (HoleLit n) = Just n
+ go _ = Nothing
+
-- |
-- Parse zero or more values separated by semicolons
--
@@ -524,3 +535,24 @@ reservedTypeNames = [ "forall", "where" ]
--
isSymbolChar :: Char -> Bool
isSymbolChar c = (c `elem` ":!#$%&*+./<=>?@\\^|-~") || (not (isAscii c) && isSymbol c)
+
+
+-- |
+-- The characters allowed in the head of an unquoted record key
+--
+isUnquotedKeyHeadChar :: Char -> Bool
+isUnquotedKeyHeadChar c = (c == '_') || isAlphaNum c
+
+-- |
+-- The characters allowed in the tail of an unquoted record key
+--
+isUnquotedKeyTailChar :: Char -> Bool
+isUnquotedKeyTailChar c = (c `elem` "_'") || isAlphaNum c
+
+-- |
+-- Strings allowed to be left unquoted in a record key
+--
+isUnquotedKey :: String -> Bool
+isUnquotedKey [] = False
+isUnquotedKey (hd : tl) = isUnquotedKeyHeadChar hd &&
+ all isUnquotedKeyTailChar tl
diff --git a/src/Language/PureScript/Parser/Types.hs b/src/Language/PureScript/Parser/Types.hs
index ca14aa5..7d89055 100644
--- a/src/Language/PureScript/Parser/Types.hs
+++ b/src/Language/PureScript/Parser/Types.hs
@@ -8,6 +8,7 @@ module Language.PureScript.Parser.Types (
import Control.Applicative
import Control.Monad (when, unless)
+import Language.PureScript.Names
import Language.PureScript.Types
import Language.PureScript.Parser.Common
import Language.PureScript.Parser.Kinds
@@ -53,7 +54,7 @@ parseTypeAtom = indented *> P.choice
, parseTypeConstructor
-- This try is needed due to some unfortunate ambiguities between rows and kinded types
, P.try (parens parseRow)
- , parens parsePolyType
+ , ParensInType <$> parens parsePolyType
]
parseConstrainedType :: TokenParser Type
@@ -74,7 +75,10 @@ parseConstrainedType = do
parseAnyType :: TokenParser Type
parseAnyType = P.buildExpressionParser operators (buildPostfixParser postfixTable parseTypeAtom) P.<?> "type"
where
- operators = [ [ P.Infix (return TypeApp) P.AssocLeft ]
+ operators = [ [ P.Infix (P.try (parseQualified (Op <$> symbol)) >>= \ident ->
+ return (BinaryNoParensType (TypeOp ident))) P.AssocRight
+ ]
+ , [ P.Infix (return TypeApp) P.AssocLeft ]
, [ P.Infix (rarrow >> return function) P.AssocRight ]
]
postfixTable = [ \t -> KindedType t <$> (indented *> doubleColon *> parseKind)
diff --git a/src/Language/PureScript/Pretty/Common.hs b/src/Language/PureScript/Pretty/Common.hs
index c2ff4d4..a6f0f4d 100644
--- a/src/Language/PureScript/Pretty/Common.hs
+++ b/src/Language/PureScript/Pretty/Common.hs
@@ -23,7 +23,7 @@ import Prelude.Compat
import Control.Monad.State (StateT, modify, get)
import Data.List (elemIndices, intersperse)
-import Language.PureScript.Parser.Lexer (reservedPsNames, isSymbolChar)
+import Language.PureScript.Parser.Lexer (reservedPsNames, isUnquotedKey)
import Language.PureScript.AST (SourcePos(..), SourceSpan(..))
import Text.PrettyPrint.Boxes
@@ -155,8 +155,8 @@ prettyPrintMany f xs = do
--
prettyPrintObjectKey :: String -> String
prettyPrintObjectKey s | s `elem` reservedPsNames = show s
- | any isSymbolChar s = show s
- | otherwise = s
+ | isUnquotedKey s = s
+ | otherwise = show s
-- | Place a box before another, vertically when the first box takes up multiple lines.
before :: Box -> Box -> Box
diff --git a/src/Language/PureScript/Pretty/Types.hs b/src/Language/PureScript/Pretty/Types.hs
index 1d14bdb..093723f 100644
--- a/src/Language/PureScript/Pretty/Types.hs
+++ b/src/Language/PureScript/Pretty/Types.hs
@@ -36,6 +36,9 @@ typeLiterals = mkPattern match
match (Skolem name s _ _) = Just $ text $ name ++ show s
match REmpty = Just $ text "()"
match row@RCons{} = Just $ prettyPrintRowWith '(' ')' row
+ match (BinaryNoParensType op l r) =
+ Just $ typeAsBox l <> text " " <> typeAsBox op <> text " " <> typeAsBox r
+ match (TypeOp op) = Just $ text $ showQualified runIdent op
match _ = Nothing
constraintsAsBox :: [Constraint] -> Box -> Box
@@ -108,6 +111,12 @@ constrained = mkPattern match
match (ConstrainedType deps ty) = Just (deps, ty)
match _ = Nothing
+explicitParens :: Pattern () Type ((), Type)
+explicitParens = mkPattern match
+ where
+ match (ParensInType ty) = Just ((), ty)
+ match _ = Nothing
+
matchTypeAtom :: Pattern () Type Box
matchTypeAtom = typeLiterals <+> fmap ((`before` (text ")")) . (text "(" <>)) matchType
@@ -121,6 +130,7 @@ matchType = buildPrettyPrinter operators matchTypeAtom
, [ Wrap constrained $ \deps ty -> constraintsAsBox deps ty ]
, [ Wrap forall_ $ \idents ty -> keepSingleLinesOr (moveRight 2) (text ("forall " ++ unwords idents ++ ".")) ty ]
, [ Wrap kinded $ \k ty -> keepSingleLinesOr (moveRight 2) ty (text (":: " ++ prettyPrintKind k)) ]
+ , [ Wrap explicitParens $ \_ ty -> ty ]
]
-- If both boxes span a single line, keep them on the same line, or else
diff --git a/src/Language/PureScript/Pretty/Values.hs b/src/Language/PureScript/Pretty/Values.hs
index e5a04e8..edeadfc 100644
--- a/src/Language/PureScript/Pretty/Values.hs
+++ b/src/Language/PureScript/Pretty/Values.hs
@@ -41,7 +41,7 @@ prettyPrintValue d (IfThenElse cond th el) =
// moveRight 2 (vcat left [ text "then " <> prettyPrintValueAtom (d - 1) th
, text "else " <> prettyPrintValueAtom (d - 1) el
])
-prettyPrintValue d (Accessor prop val) = prettyPrintValueAtom (d - 1) val <> text ("." ++ show prop)
+prettyPrintValue d (Accessor prop val) = prettyPrintValueAtom (d - 1) val <> text ("." ++ prettyPrintObjectKey prop)
prettyPrintValue d (ObjectUpdate o ps) = prettyPrintValueAtom (d - 1) o <> text " " <> list '{' '}' (\(key, val) -> text (key ++ " = ") <> prettyPrintValue (d - 1) val) ps
prettyPrintValue d (App val arg) = prettyPrintValueAtom (d - 1) val `beforeWithSpace` prettyPrintValueAtom (d - 1) arg
prettyPrintValue d (Abs (Left arg) val) = text ('\\' : showIdent arg ++ " -> ") // moveRight 2 (prettyPrintValue (d - 1) val)
@@ -64,6 +64,7 @@ prettyPrintValue _ (TypeClassDictionaryAccessor className ident) =
prettyPrintValue d (TypedValue _ val _) = prettyPrintValue d val
prettyPrintValue d (PositionedValue _ _ val) = prettyPrintValue d val
prettyPrintValue d (Literal l) = prettyPrintLiteralValue d l
+prettyPrintValue _ (Hole name) = text "?" <> text name
prettyPrintValue d expr@AnonymousArgument{} = prettyPrintValueAtom d expr
prettyPrintValue d expr@Constructor{} = prettyPrintValueAtom d expr
prettyPrintValue d expr@Var{} = prettyPrintValueAtom d expr
diff --git a/src/Language/PureScript/Publish.hs b/src/Language/PureScript/Publish.hs
index 90a90f6..9b3f8db 100644
--- a/src/Language/PureScript/Publish.hs
+++ b/src/Language/PureScript/Publish.hs
@@ -39,6 +39,7 @@ import Data.Aeson.BetterErrors
import qualified Data.Text as T
import qualified Data.Text.Lazy as TL
import qualified Data.Text.Lazy.Encoding as TL
+import qualified Data.SPDX as SPDX
import Control.Category ((>>>))
import Control.Arrow ((***))
@@ -128,7 +129,7 @@ catchLeft :: Applicative f => Either a b -> (a -> f b) -> f b
catchLeft a f = either f pure a
unlessM :: Monad m => m Bool -> m () -> m ()
-unlessM cond act = cond >>= flip unless act
+unlessM cond act = cond >>= flip unless act
preparePackage' :: PublishOptions -> PrepareM D.UploadedPackage
preparePackage' opts = do
@@ -137,14 +138,12 @@ preparePackage' opts = do
pkgMeta <- liftIO (Bower.decodeFile "bower.json")
>>= flip catchLeft (userError . CouldntDecodeBowerJSON)
- unlessM (liftIO (doesFileExist "LICENSE")) (userError LicenseNotFound)
+ checkLicense pkgMeta
(pkgVersionTag, pkgVersion) <- publishGetVersion opts
pkgGithub <- getBowerRepositoryInfo pkgMeta
(pkgBookmarks, pkgModules) <- getModulesAndBookmarks
- unless (bowerLicenseExists pkgMeta) (userError NoLicenseSpecified)
-
let declaredDeps = map fst (bowerDependencies pkgMeta ++
bowerDevDependencies pkgMeta)
pkgResolvedDependencies <- getResolvedDependencies declaredDeps
@@ -215,8 +214,16 @@ getBowerRepositoryInfo = either (userError . BadRepositoryField) return . tryExt
(Left (BadRepositoryType repositoryType))
maybe (Left NotOnGithub) Right (extractGithub repositoryUrl)
-bowerLicenseExists :: PackageMeta -> Bool
-bowerLicenseExists = any (not . null) . bowerLicense
+checkLicense :: PackageMeta -> PrepareM ()
+checkLicense pkgMeta =
+ unless (any isValidSPDX (bowerLicense pkgMeta))
+ (userError NoLicenseSpecified)
+
+-- |
+-- Check if a string is a valid SPDX license expression.
+--
+isValidSPDX :: String -> Bool
+isValidSPDX = (== 1) . length . SPDX.parseExpression
extractGithub :: String -> Maybe (D.GithubUser, D.GithubRepo)
extractGithub = stripGitHubPrefixes
diff --git a/src/Language/PureScript/Publish/ErrorsWarnings.hs b/src/Language/PureScript/Publish/ErrorsWarnings.hs
index b669477..b928f38 100644
--- a/src/Language/PureScript/Publish/ErrorsWarnings.hs
+++ b/src/Language/PureScript/Publish/ErrorsWarnings.hs
@@ -182,11 +182,33 @@ displayUserError e = case e of
BadRepositoryField err ->
displayRepositoryError err
NoLicenseSpecified ->
- para (concat
- ["No license specified in bower.json. Please add one. ",
- "Distributing code without a license means that nobody ",
- "will be able to (legally) use it."
- ])
+ vcat $
+ [ para (concat
+ [ "No license is specified in bower.json. Please add one, using the "
+ , "SPDX license expression format. For example, any of the "
+ , "following would be acceptable:"
+ ])
+ , spacer
+ ] ++
+ map (indented . para)
+ [ "* \"MIT\""
+ , "* \"BSD-2-Clause\""
+ , "* \"GPL-2.0+\""
+ , "* \"(GPL-3.0 OR MIT)\""
+ ]
+ ++
+ [ spacer
+ , para (concat
+ [ "Note that distributing code without a license means that nobody "
+ , "will (legally) be able to use it."
+ ])
+ , spacer
+ , para (concat
+ [ "It is also recommended to add a LICENSE file to the repository, "
+ , "including your name and the current year, although this is not "
+ , "necessary."
+ ])
+ ]
MissingDependencies pkgs ->
let singular = NonEmpty.length pkgs == 1
pl a b = if singular then b else a
diff --git a/src/Language/PureScript/Sugar/Names.hs b/src/Language/PureScript/Sugar/Names.hs
index 410f905..b7997ec 100644
--- a/src/Language/PureScript/Sugar/Names.hs
+++ b/src/Language/PureScript/Sugar/Names.hs
@@ -85,6 +85,12 @@ desugarImportsWithEnv externs modules = do
forTyCon _ = Nothing
toExportedType (PositionedDeclarationRef _ _ r) = toExportedType r
toExportedType _ = Nothing
+ exportedTypeOps :: [(Ident, ModuleName)]
+ exportedTypeOps = mapMaybe toExportedTypeOp efExports
+ where
+ toExportedTypeOp (TypeOpRef ident) = Just (ident, efModuleName)
+ toExportedTypeOp (PositionedDeclarationRef _ _ r) = toExportedTypeOp r
+ toExportedTypeOp _ = Nothing
exportedTypeClasses :: [(ProperName 'ClassName, ModuleName)]
exportedTypeClasses = mapMaybe toExportedTypeClass efExports
where
@@ -126,6 +132,7 @@ elaborateExports :: Exports -> Module -> Module
elaborateExports exps (Module ss coms mn decls refs) =
Module ss coms mn decls $
Just $ map (\(ctor, dctors) -> TypeRef ctor (Just dctors)) (my exportedTypes) ++
+ map TypeOpRef (my exportedTypeOps) ++
map TypeClassRef (my exportedTypeClasses) ++
map ValueRef (my exportedValues) ++
maybe [] (filter isModuleRef) refs
@@ -171,7 +178,15 @@ renameInModule env imports (Module ss coms mn decls exps) =
updateDecl (pos, bound) (ExternDeclaration name ty) =
(,) (pos, name : bound) <$> (ExternDeclaration name <$> updateTypesEverywhere pos ty)
updateDecl (pos, bound) (FixityDeclaration fx name alias) =
- (,) (pos, bound) <$> (FixityDeclaration fx name <$> traverse (eitherM (`updateValueName` pos) (`updateDataConstructorName` pos)) alias)
+ (,) (pos, bound) <$> (FixityDeclaration fx name <$> traverse updateAlias alias)
+ where
+ updateAlias :: Qualified FixityAlias -> m (Qualified FixityAlias)
+ updateAlias (Qualified mn' (AliasValue ident)) =
+ fmap AliasValue <$> updateValueName (Qualified mn' ident) pos
+ updateAlias (Qualified mn' (AliasConstructor ctor)) =
+ fmap AliasConstructor <$> updateDataConstructorName (Qualified mn' ctor) pos
+ updateAlias (Qualified mn' (AliasType ty)) =
+ fmap AliasType <$> updateTypeName (Qualified mn' ty) pos
updateDecl s d = return (s, d)
updateValue
@@ -231,6 +246,7 @@ renameInModule env imports (Module ss coms mn decls exps) =
updateTypesEverywhere pos = everywhereOnTypesM updateType
where
updateType :: Type -> m Type
+ updateType (TypeOp name) = TypeOp <$> updateTypeOpName name pos
updateType (TypeConstructor name) = TypeConstructor <$> updateTypeName name pos
updateType (ConstrainedType cs t) = ConstrainedType <$> updateConstraints pos cs <*> pure t
updateType t = return t
@@ -242,22 +258,57 @@ renameInModule env imports (Module ss coms mn decls exps) =
:: Qualified (ProperName 'TypeName)
-> Maybe SourceSpan
-> m (Qualified (ProperName 'TypeName))
- updateTypeName = update UnknownType (importedTypes imports) (resolveType . exportedTypes) TyName (("type " ++) . runProperName)
+ updateTypeName =
+ update UnknownType
+ (importedTypes imports)
+ (resolveType . exportedTypes)
+ TyName
+ (("type " ++) . runProperName)
+
+ updateTypeOpName
+ :: Qualified Ident
+ -> Maybe SourceSpan
+ -> m (Qualified Ident)
+ updateTypeOpName =
+ update
+ UnknownTypeOp
+ (importedTypeOps imports)
+ (resolve . exportedTypeOps)
+ TyOpName
+ (("type operator" ++) . runIdent)
updateDataConstructorName
:: Qualified (ProperName 'ConstructorName)
-> Maybe SourceSpan
-> m (Qualified (ProperName 'ConstructorName))
- updateDataConstructorName = update (flip UnknownDataConstructor Nothing) (importedDataConstructors imports) (resolveDctor . exportedTypes) DctorName (("data constructor " ++) . runProperName)
+ updateDataConstructorName =
+ update
+ (flip UnknownDataConstructor Nothing)
+ (importedDataConstructors imports)
+ (resolveDctor . exportedTypes)
+ DctorName
+ (("data constructor " ++) . runProperName)
updateClassName
:: Qualified (ProperName 'ClassName)
-> Maybe SourceSpan
-> m (Qualified (ProperName 'ClassName))
- updateClassName = update UnknownTypeClass (importedTypeClasses imports) (resolve . exportedTypeClasses) TyClassName (("class " ++) . runProperName)
+ updateClassName =
+ update
+ UnknownTypeClass
+ (importedTypeClasses imports)
+ (resolve . exportedTypeClasses)
+ TyClassName
+ (("class " ++) . runProperName)
updateValueName :: Qualified Ident -> Maybe SourceSpan -> m (Qualified Ident)
- updateValueName = update UnknownValue (importedValues imports) (resolve . exportedValues) IdentName (("value " ++) . runIdent)
+ updateValueName =
+ update
+ UnknownValue
+ (importedValues imports)
+ (resolve . exportedValues)
+ IdentName
+ (("value " ++) . runIdent)
-- Used when performing an update to qualify values and classes with their
-- module of original definition.
diff --git a/src/Language/PureScript/Sugar/Names/Env.hs b/src/Language/PureScript/Sugar/Names/Env.hs
index 5af2c76..4c31ceb 100644
--- a/src/Language/PureScript/Sugar/Names/Env.hs
+++ b/src/Language/PureScript/Sugar/Names/Env.hs
@@ -14,6 +14,7 @@ module Language.PureScript.Sugar.Names.Env
, envModuleImports
, envModuleExports
, exportType
+ , exportTypeOp
, exportTypeClass
, exportValue
, getExports
@@ -70,6 +71,10 @@ data Imports = Imports
--
importedTypes :: M.Map (Qualified (ProperName 'TypeName)) [ImportRecord (ProperName 'TypeName)]
-- |
+ -- Local names for type operators within a module mapped to to their qualified names
+ --
+ , importedTypeOps :: M.Map (Qualified Ident) [ImportRecord Ident]
+ -- |
-- Local names for data constructors within a module mapped to to their qualified names
--
, importedDataConstructors :: M.Map (Qualified (ProperName 'ConstructorName)) [ImportRecord (ProperName 'ConstructorName)]
@@ -96,7 +101,7 @@ data Imports = Imports
-- An empty 'Imports' value.
--
nullImports :: Imports
-nullImports = Imports M.empty M.empty M.empty M.empty S.empty S.empty
+nullImports = Imports M.empty M.empty M.empty M.empty M.empty S.empty S.empty
-- |
-- The exported declarations from a module.
@@ -109,6 +114,11 @@ data Exports = Exports
--
exportedTypes :: [((ProperName 'TypeName, [ProperName 'ConstructorName]), ModuleName)]
-- |
+ -- The type operators exported from each module along with the module they
+ -- originally came from.
+ --
+ , exportedTypeOps :: [(Ident, ModuleName)]
+ -- |
-- The classes exported from each module along with the module they originally
-- came from.
--
@@ -124,7 +134,7 @@ data Exports = Exports
-- An empty 'Exports' value.
--
nullExports :: Exports
-nullExports = Exports [] [] []
+nullExports = Exports [] [] [] []
-- |
-- The imports and exports for a collection of modules. The 'SourceSpan' is used
@@ -155,7 +165,7 @@ envModuleExports (_, _, exps) = exps
-- The exported types from the @Prim@ module
--
primExports :: Exports
-primExports = Exports (mkTypeEntry `map` M.keys primTypes) (mkClassEntry `map` M.keys primClasses) []
+primExports = Exports (mkTypeEntry `map` M.keys primTypes) [] (mkClassEntry `map` M.keys primClasses) []
where
mkTypeEntry (Qualified mn name) = ((name, []), fromJust mn)
mkClassEntry (Qualified mn name) = (name, fromJust mn)
@@ -184,6 +194,15 @@ exportType exps name dctors mn = do
return $ exps { exportedTypes = nub $ ((name, dctors), mn) : exTypes' }
-- |
+-- Safely adds a type operator to some exports, returning an error if a
+-- conflict occurs.
+--
+exportTypeOp :: (MonadError MultipleErrors m) => Exports -> Ident -> ModuleName -> m Exports
+exportTypeOp exps name mn = do
+ typeOps <- addExport DuplicateTypeOpExport name mn (exportedTypeOps exps)
+ return $ exps { exportedTypeOps = typeOps }
+
+-- |
-- Safely adds a class to some exports, returning an error if a conflict occurs.
--
exportTypeClass :: (MonadError MultipleErrors m) => Exports -> ProperName 'ClassName -> ModuleName -> m Exports
diff --git a/src/Language/PureScript/Sugar/Names/Exports.hs b/src/Language/PureScript/Sugar/Names/Exports.hs
index 242b5a0..8c47c9f 100644
--- a/src/Language/PureScript/Sugar/Names/Exports.hs
+++ b/src/Language/PureScript/Sugar/Names/Exports.hs
@@ -47,6 +47,7 @@ findExportable (Module _ _ mn ds _) =
updateExports exps (TypeSynonymDeclaration tn _ _) = exportType exps tn [] mn
updateExports exps (ExternDataDeclaration tn _) = exportType exps tn [] mn
updateExports exps (ValueDeclaration name _ _ _) = exportValue exps name mn
+ updateExports exps (FixityDeclaration _ name (Just (Qualified _ (AliasType _)))) = exportTypeOp exps (Op name) mn
updateExports exps (FixityDeclaration _ name (Just _)) = exportValue exps (Op name) mn
updateExports exps (ExternDeclaration name _) = exportValue exps name mn
updateExports exps (PositionedDeclaration pos _ d) = rethrowWithPosition pos $ updateExports exps d
@@ -70,6 +71,7 @@ resolveExports env mn imps exps refs =
warnDupeRefs :: [DeclarationRef] -> m ()
warnDupeRefs = traverse_ $ \case
TypeRef name _ -> warnDupe $ "type " ++ runProperName name
+ TypeOpRef name -> warnDupe $ "type operator " ++ runIdent name
ValueRef name -> warnDupe $ "value " ++ runIdent name
TypeClassRef name -> warnDupe $ "class " ++ runProperName name
ModuleRef name -> warnDupe $ "module " ++ runModuleName name
@@ -89,22 +91,28 @@ resolveExports env mn imps exps refs =
rethrowWithPosition pos $ elaborateModuleExports result r
elaborateModuleExports result (ModuleRef name) | name == mn = do
let types' = exportedTypes result ++ exportedTypes exps
+ let typeOps' = exportedTypeOps result ++ exportedTypeOps exps
let classes' = exportedTypeClasses result ++ exportedTypeClasses exps
let values' = exportedValues result ++ exportedValues exps
- return result { exportedTypes = types'
- , exportedTypeClasses = classes'
- , exportedValues = values' }
+ return result
+ { exportedTypes = types'
+ , exportedTypeOps = typeOps'
+ , exportedTypeClasses = classes'
+ , exportedValues = values'
+ }
elaborateModuleExports result (ModuleRef name) = do
let isPseudo = isPseudoModule name
when (not isPseudo && not (isImportedModule name)) $
throwError . errorMessage . UnknownExportModule $ name
reTypes <- extract isPseudo name (("type " ++) . runProperName) (importedTypes imps)
+ reTypeOps <- extract isPseudo name (("type operator " ++) . runIdent) (importedTypeOps imps)
reDctors <- extract isPseudo name (("data constructor " ++) . runProperName) (importedDataConstructors imps)
reClasses <- extract isPseudo name (("class " ++) . runProperName) (importedTypeClasses imps)
reValues <- extract isPseudo name (("value " ++) . runIdent) (importedValues imps)
result' <- foldM (\exps' ((tctor, dctors), mn') -> exportType exps' tctor dctors mn') result (resolveTypeExports reTypes reDctors)
- result'' <- foldM (uncurry . exportTypeClass) result' (map resolveClass reClasses)
- foldM (uncurry . exportValue) result'' (map resolveValue reValues)
+ result'' <- foldM (uncurry . exportTypeOp) result' (map resolveTypeOp reTypeOps)
+ result''' <- foldM (uncurry . exportTypeClass) result'' (map resolveClass reClasses)
+ foldM (uncurry . exportValue) result''' (map resolveValue reValues)
elaborateModuleExports result _ = return result
-- Extracts a list of values for a module based on a lookup table. If the
@@ -119,9 +127,10 @@ resolveExports env mn imps exps refs =
extract useQual name render = fmap (map (importName . head . snd)) . go . M.toList
where
go = filterM $ \(name', options) -> do
- let isMatch = if useQual then eqQual name name' else any (eqQual name . importName) options
+ let isMatch = if useQual then isQualifiedWith name name' else any (checkUnqual name') options
when (isMatch && length options > 1) $ void $ checkImportConflicts mn render options
return isMatch
+ checkUnqual name' ir = isUnqualified name' && isQualifiedWith name (importName ir)
-- Check whether a module name refers to a "pseudo module" that came into
-- existence in an import scope due to importing one or more modules as
@@ -134,21 +143,16 @@ resolveExports env mn imps exps refs =
-- value being re-exported belongs to a qualified module, and we test the
-- values if that fails to see whether the value has been imported at all.
testQuals :: (forall a b. M.Map (Qualified a) b -> [Qualified a]) -> ModuleName -> Bool
- testQuals f mn' = any (eqQual mn') (f (importedTypes imps))
- || any (eqQual mn') (f (importedDataConstructors imps))
- || any (eqQual mn') (f (importedTypeClasses imps))
- || any (eqQual mn') (f (importedValues imps))
+ testQuals f mn' = any (isQualifiedWith mn') (f (importedTypes imps))
+ || any (isQualifiedWith mn') (f (importedDataConstructors imps))
+ || any (isQualifiedWith mn') (f (importedTypeClasses imps))
+ || any (isQualifiedWith mn') (f (importedValues imps))
-- Check whether a module name refers to a module that has been imported
-- without qualification into an import scope.
isImportedModule :: ModuleName -> Bool
isImportedModule = flip elem (importedModules imps)
- -- Check whether a module name matches that of a qualified value.
- eqQual :: ModuleName -> Qualified a -> Bool
- eqQual mn'' (Qualified (Just mn''') _) = mn'' == mn'''
- eqQual _ _ = False
-
-- Constructs a list of types with their data constructors and the original
-- module they were defined in from a list of type and data constructor names.
resolveTypeExports
@@ -167,6 +171,11 @@ resolveExports env mn imps exps refs =
return ((name, relevantDctors `intersect` dctors'), mnOrig)
go (Qualified Nothing _) = internalError "Unqualified value in resolveTypeExports"
+ -- Looks up an imported type operator and re-qualifies it with the original
+ -- module it came from.
+ resolveTypeOp :: Qualified Ident -> (Ident, ModuleName)
+ resolveTypeOp ident = splitQual $ fromMaybe (internalError "Missing value in resolveValue") $
+ resolve exportedTypeOps ident
-- Looks up an imported class and re-qualifies it with the original module it
-- came from.
@@ -206,9 +215,15 @@ filterModule
-> m Exports
filterModule mn exps refs = do
types <- foldM (filterTypes $ exportedTypes exps) [] refs
+ typeOps <- foldM (filterTypeOps $ exportedTypeOps exps) [] refs
values <- foldM (filterValues $ exportedValues exps) [] refs
classes <- foldM (filterClasses $ exportedTypeClasses exps) [] refs
- return exps { exportedTypes = types , exportedTypeClasses = classes , exportedValues = values }
+ return $ exps
+ { exportedTypes = types
+ , exportedTypeOps = typeOps
+ , exportedTypeClasses = classes
+ , exportedValues = values
+ }
where
@@ -245,6 +260,19 @@ filterModule mn exps refs = do
unless (name `elem` exps') $
throwError . errorMessage $ UnknownExportDataConstructor tcon name
+ -- Takes a list of all the exportable type operators, the accumulated list of
+ -- filtered exports, and a `DeclarationRef` for an explicit export. When the
+ -- ref refers to a value in the list of exportable values, the value is
+ -- included in the result.
+ filterTypeOps :: [(Ident, ModuleName)] -> [(Ident, ModuleName)] -> DeclarationRef -> m [(Ident, ModuleName)]
+ filterTypeOps exps' result (PositionedDeclarationRef pos _ r) =
+ rethrowWithPosition pos $ filterTypeOps exps' result r
+ filterTypeOps exps' result (TypeOpRef name) =
+ if (name, mn) `elem` exps'
+ then return $ (name, mn) : result
+ else throwError . errorMessage . UnknownExportTypeOp $ name
+ filterTypeOps _ result _ = return result
+
-- Takes a list of all the exportable classes, the accumulated list of
-- filtered exports, and a `DeclarationRef` for an explicit export. When the
-- ref refers to a class in the list of exportable classes, the class is
diff --git a/src/Language/PureScript/Sugar/Names/Imports.hs b/src/Language/PureScript/Sugar/Names/Imports.hs
index c035178..783a13d 100644
--- a/src/Language/PureScript/Sugar/Names/Imports.hs
+++ b/src/Language/PureScript/Sugar/Names/Imports.hs
@@ -12,9 +12,10 @@ module Language.PureScript.Sugar.Names.Imports
import Prelude ()
import Prelude.Compat
-import Data.List (find, delete, (\\))
-import Data.Maybe (fromMaybe, isJust, isNothing, fromJust)
import Data.Foldable (traverse_, for_)
+import Data.Function (on)
+import Data.List (find, sortBy, groupBy, (\\))
+import Data.Maybe (fromMaybe, isNothing, fromJust)
import Data.Traversable (for)
import Control.Arrow (first)
@@ -68,29 +69,23 @@ resolveImports env (Module ss coms currentModule decls exps) =
for_ (M.toList imports) $ \(mn, imps) -> do
- -- Better ordering for the warnings: the list is in last-import-first
- -- order, but we want the first appearence of an import to be the primary,
- -- and warnings to appear for later imports
- let imps' = reverse imps
-
- warned <- foldM (checkDuplicateImports mn) [] (selfCartesianSubset imps')
-
- let unqual = filter (\(_, _, q) -> isJust q) (imps' \\ warned)
-
- warned' <- (warned ++) <$>
- if (length unqual < 2)
- then return []
- else case find (\(_, typ, _) -> isImplicit typ) unqual of
- Just i ->
- for (delete i unqual) $ \i'@(pos, typ, _) -> do
- warn pos $ RedundantUnqualifiedImport mn typ
- return i'
- Nothing ->
- for (tail unqual) $ \i@(pos, _, _) -> do
- warn pos $ DuplicateSelectiveImport mn
- return i
-
- for_ (imps' \\ warned') $ \(pos, typ, _) ->
+ warned <- foldM (checkDuplicateImports mn) [] (selfCartesianSubset imps)
+
+ let unwarned = imps \\ warned
+ duplicates
+ = join
+ . map tail
+ . filter ((> 1) . length)
+ . groupBy ((==) `on` defQual)
+ . sortBy (compare `on` defQual)
+ $ unwarned
+
+ warned' <-
+ for duplicates $ \i@(pos, _, _) -> do
+ warn pos $ DuplicateSelectiveImport mn
+ return i
+
+ for_ (imps \\ (warned ++ warned')) $ \(pos, typ, _) ->
let (dupeRefs, dupeDctors) = findDuplicateRefs $ case typ of
Explicit refs -> refs
Hiding refs -> refs
@@ -102,9 +97,13 @@ resolveImports env (Module ss coms currentModule decls exps) =
let imports' = M.map (map (\(ss', dt, mmn) -> (ss', Just dt, mmn))) imports
scope = M.insert currentModule [(Nothing, Nothing, Nothing)] imports'
resolved <- foldM (resolveModuleImport env) nullImports (M.toList scope)
+
return (Module ss coms currentModule decls' exps, resolved)
where
+ defQual :: ImportDef -> Maybe ModuleName
+ defQual (_, _, q) = q
+
selfCartesianSubset :: [a] -> [(a, a)]
selfCartesianSubset (x : xs) = [(x, y) | y <- xs] ++ selfCartesianSubset xs
selfCartesianSubset [] = []
@@ -120,6 +119,7 @@ resolveImports env (Module ss coms currentModule decls exps) =
warnDupeRefs :: Maybe SourceSpan -> [DeclarationRef] -> m ()
warnDupeRefs pos = traverse_ $ \case
TypeRef name _ -> warnDupe pos $ "type " ++ runProperName name
+ TypeOpRef name -> warnDupe pos $ "type operator " ++ runIdent name
ValueRef name -> warnDupe pos $ "value " ++ runIdent name
TypeClassRef name -> warnDupe pos $ "class " ++ runProperName name
ModuleRef name -> warnDupe pos $ "module " ++ runModuleName name
@@ -205,6 +205,7 @@ resolveImport importModule exps imps impQual = resolveByType
imps' <- checkRefs True refs >> importAll (importNonHidden refs)
let isEmptyImport
= M.null (importedTypes imps')
+ && M.null (importedTypeOps imps')
&& M.null (importedDataConstructors imps')
&& M.null (importedTypeClasses imps')
&& M.null (importedValues imps')
@@ -223,6 +224,8 @@ resolveImport importModule exps imps impQual = resolveByType
checkImportExists UnknownImportType ((fst . fst) `map` exportedTypes exps) name
let allDctors = fst `map` allExportedDataConstructors name
maybe (return ()) (traverse_ $ checkDctorExists name allDctors) dctors
+ check (TypeOpRef name) =
+ checkImportExists UnknownImportTypeOp (fst `map` exportedTypeOps exps) name
check (TypeClassRef name) =
checkImportExists UnknownImportTypeClass (fst `map` exportedTypeClasses exps) name
check (ModuleRef name) | isHiding =
@@ -269,8 +272,9 @@ resolveImport importModule exps imps impQual = resolveByType
importAll :: (Imports -> DeclarationRef -> m Imports) -> m Imports
importAll importer = do
imp' <- foldM (\m ((name, dctors), _) -> importer m (TypeRef name (Just dctors))) imps (exportedTypes exps)
- imp'' <- foldM (\m (name, _) -> importer m (ValueRef name)) imp' (exportedValues exps)
- foldM (\m (name, _) -> importer m (TypeClassRef name)) imp'' (exportedTypeClasses exps)
+ imp'' <- foldM (\m (name, _) -> importer m (TypeOpRef name)) imp' (exportedTypeOps exps)
+ imp''' <- foldM (\m (name, _) -> importer m (ValueRef name)) imp'' (exportedValues exps)
+ foldM (\m (name, _) -> importer m (TypeClassRef name)) imp''' (exportedTypeClasses exps)
importRef :: ImportProvenance -> Imports -> DeclarationRef -> m Imports
importRef prov imp (PositionedDeclarationRef pos _ r) =
@@ -288,6 +292,9 @@ resolveImport importModule exps imps impQual = resolveByType
when (null dctorNames && isNothing dctors) . tell . errorMessage $ MisleadingEmptyTypeImport importModule name
let dctors' = foldl (\m d -> updateImports m exportedDctors d prov) (importedDataConstructors imp) (fromMaybe dctorNames dctors)
return $ imp { importedTypes = types', importedDataConstructors = dctors' }
+ importRef prov imp (TypeOpRef name) = do
+ let ops' = updateImports (importedTypeOps imp) (exportedTypeOps exps) name prov
+ return $ imp { importedTypeOps = ops' }
importRef prov imp (TypeClassRef name) = do
let typeClasses' = updateImports (importedTypeClasses imp) (exportedTypeClasses exps) name prov
return $ imp { importedTypeClasses = typeClasses' }
diff --git a/src/Language/PureScript/Sugar/ObjectWildcards.hs b/src/Language/PureScript/Sugar/ObjectWildcards.hs
index 61a4d05..a6677a8 100644
--- a/src/Language/PureScript/Sugar/ObjectWildcards.hs
+++ b/src/Language/PureScript/Sugar/ObjectWildcards.hs
@@ -9,6 +9,7 @@ module Language.PureScript.Sugar.ObjectWildcards (
import Prelude ()
import Prelude.Compat
+import Control.Monad (forM)
import Control.Monad.Error.Class (MonadError(..))
import Control.Monad.Supply.Class
@@ -45,11 +46,21 @@ desugarObjectConstructors (Module ss coms mn ds exts) = Module ss coms mn <$> ma
desugarExpr (Literal (ObjectLiteral ps)) = wrapLambda (Literal . ObjectLiteral) ps
desugarExpr (ObjectUpdate u ps) | isAnonymousArgument u = do
obj <- freshIdent'
- Abs (Left obj) <$> wrapLambda (ObjectUpdate (Var (Qualified Nothing obj))) ps
+ Abs (Left obj) <$> wrapLambda (ObjectUpdate (argToExpr obj)) ps
desugarExpr (ObjectUpdate obj ps) = wrapLambda (ObjectUpdate obj) ps
desugarExpr (Accessor prop u) | isAnonymousArgument u = do
arg <- freshIdent'
- return $ Abs (Left arg) (Accessor prop (Var (Qualified Nothing arg)))
+ return $ Abs (Left arg) (Accessor prop (argToExpr arg))
+ desugarExpr (Case args cas) | any isAnonymousArgument args = do
+ argIdents <- forM args freshIfAnon
+ let args' = zipWith (\p -> maybe p argToExpr) args argIdents
+ return $ foldr (Abs . Left) (Case args' cas) (catMaybes argIdents)
+ desugarExpr (IfThenElse u t f) | any isAnonymousArgument [u, t, f] = do
+ u' <- freshIfAnon u
+ t' <- freshIfAnon t
+ f' <- freshIfAnon f
+ let if_ = IfThenElse (maybe u argToExpr u') (maybe t argToExpr t') (maybe f argToExpr f')
+ return $ foldr (Abs . Left) if_ (catMaybes [u', t', f'])
desugarExpr e = return e
wrapLambda :: ([(String, Expr)] -> Expr) -> [(String, Expr)] -> m Expr
@@ -71,8 +82,14 @@ desugarObjectConstructors (Module ss coms mn ds exts) = Module ss coms mn <$> ma
isAnonymousArgument _ = False
mkProp :: (String, Expr) -> m (Maybe Ident, (String, Expr))
- mkProp (name, e)
- | isAnonymousArgument e = do
- arg <- freshIdent'
- return (Just arg, (name, Var (Qualified Nothing arg)))
- | otherwise = return (Nothing, (name, e))
+ mkProp (name, e) = do
+ arg <- freshIfAnon e
+ return (arg, (name, maybe e argToExpr arg))
+
+ freshIfAnon :: Expr -> m (Maybe Ident)
+ freshIfAnon u
+ | isAnonymousArgument u = Just <$> freshIdent'
+ | otherwise = return Nothing
+
+ argToExpr :: Ident -> Expr
+ argToExpr = Var . Qualified Nothing
diff --git a/src/Language/PureScript/Sugar/Operators.hs b/src/Language/PureScript/Sugar/Operators.hs
index 01f8522..a86eb0f 100644
--- a/src/Language/PureScript/Sugar/Operators.hs
+++ b/src/Language/PureScript/Sugar/Operators.hs
@@ -1,4 +1,3 @@
-{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE RecordWildCards #-}
@@ -11,11 +10,11 @@
-- The value parser ignores fixity data when parsing binary operator applications, so
-- it is necessary to reorder them here.
--
-module Language.PureScript.Sugar.Operators (
- rebracket,
- removeSignedLiterals,
- desugarOperatorSections
-) where
+module Language.PureScript.Sugar.Operators
+ ( rebracket
+ , removeSignedLiterals
+ , desugarOperatorSections
+ ) where
import Prelude ()
import Prelude.Compat
@@ -27,58 +26,91 @@ import Language.PureScript.Externs
import Language.PureScript.Names
import Language.PureScript.Sugar.Operators.Binders
import Language.PureScript.Sugar.Operators.Expr
-import Language.PureScript.Traversals (defS)
+import Language.PureScript.Sugar.Operators.Types
+import Language.PureScript.Traversals (defS, sndM)
+import Language.PureScript.Types
+import Control.Monad ((<=<))
import Control.Monad.Error.Class (MonadError(..))
import Control.Monad.Supply.Class
import Data.Function (on)
-import Data.List (groupBy, sortBy)
+import Data.Functor.Identity
+import Data.List (partition, groupBy, sortBy)
import Data.Maybe (mapMaybe)
import qualified Data.Map as M
import qualified Language.PureScript.Constants as C
--- TODO: in 0.9 operators names can have their own type rather than being in a sum with `Ident`, and `AliasName` no longer needs to be optional
+-- TODO: in 0.9 operators names can have their own type rather than being in a sum with `Ident`, and `FixityAlias` no longer needs to be optional
-- |
-- An operator associated with its declaration position, fixity, and the name
-- of the function or data constructor it is an alias for.
--
-type FixityRecord = (Qualified Ident, SourceSpan, Fixity, Maybe AliasName)
-
--- |
--- An operator can be an alias for a function or a data constructor.
---
-type AliasName = Either (Qualified Ident) (Qualified (ProperName 'ConstructorName))
+type FixityRecord = (Qualified Ident, SourceSpan, Fixity, Maybe (Qualified FixityAlias))
-- |
-- Remove explicit parentheses and reorder binary operator applications
--
rebracket
:: forall m
- . (MonadError MultipleErrors m)
+ . MonadError MultipleErrors m
=> [ExternsFile]
-> [Module]
-> m [Module]
rebracket externs ms = do
- let fixities = concatMap externsFixities externs ++ concatMap collectFixities ms
- ensureNoDuplicates $ map (\(i, pos, _, _) -> (i, pos)) fixities
- let opTable = customOperatorTable $ map (\(i, _, f, _) -> (i, f)) fixities
- ms' <- traverse (rebracketModule opTable) ms
- let aliased = M.fromList (mapMaybe makeLookupEntry fixities)
- mapM (renameAliasedOperators aliased) ms'
+ let (typeFixities, valueFixities) = partition isTypeFixity $
+ concatMap externsFixities externs ++ concatMap collectFixities ms
+
+ ensureNoDuplicates' $ valueFixities
+ ensureNoDuplicates' $ typeFixities
+
+ let valueOpTable = customOperatorTable' valueFixities
+ typeOpTable = customOperatorTable' typeFixities
+ ms' <- traverse (rebracketModule valueOpTable typeOpTable) ms
+
+ let valueAliased = M.fromList (mapMaybe makeLookupEntry valueFixities)
+ typeAliased = M.fromList (mapMaybe makeLookupEntry typeFixities)
+ mapM (renameAliasedOperators valueAliased typeAliased) ms'
where
- makeLookupEntry :: FixityRecord -> Maybe (Qualified Ident, AliasName)
+ isTypeFixity :: FixityRecord -> Bool
+ -- Nothing case for FixityAlias can only ever be a value fixity, as it's not
+ -- possible to define types with operator names aside through aliasing.
+ -- TODO: This comment is redundant after 0.9.
+ isTypeFixity (_, _, _, Just (Qualified _ (AliasType _))) = True
+ isTypeFixity _ = False
+
+ ensureNoDuplicates' :: [FixityRecord] -> m ()
+ ensureNoDuplicates' =
+ ensureNoDuplicates . map (\(i, pos, _, _) -> (i, pos))
+
+ customOperatorTable' :: [FixityRecord] -> [[(Qualified Ident, Associativity)]]
+ customOperatorTable' =
+ customOperatorTable . map (\(i, _, f, _) -> (i, f))
+
+ makeLookupEntry :: FixityRecord -> Maybe (Qualified Ident, Qualified FixityAlias)
makeLookupEntry (qname, _, _, alias) = (qname, ) <$> alias
- renameAliasedOperators :: M.Map (Qualified Ident) AliasName -> Module -> m Module
- renameAliasedOperators aliased (Module ss coms mn ds exts) =
+ renameAliasedOperators
+ :: M.Map (Qualified Ident) (Qualified FixityAlias)
+ -> M.Map (Qualified Ident) (Qualified FixityAlias)
+ -> Module
+ -> m Module
+ renameAliasedOperators valueAliased typeAliased (Module ss coms mn ds exts) =
Module ss coms mn <$> mapM f' ds <*> pure exts
where
- (f', _, _, _, _) = everywhereWithContextOnValuesM Nothing goDecl goExpr goBinder defS defS
+ (goDecl', goExpr') = updateTypes goType
+ (f', _, _, _, _) =
+ everywhereWithContextOnValuesM
+ Nothing
+ (\pos -> uncurry goDecl <=< goDecl' pos)
+ (\pos -> uncurry goExpr <=< goExpr' pos)
+ goBinder
+ defS
+ defS
goDecl :: Maybe SourceSpan -> Declaration -> m (Maybe SourceSpan, Declaration)
goDecl _ d@(PositionedDeclaration pos _ _) = return (Just pos, d)
@@ -86,27 +118,39 @@ rebracket externs ms = do
goExpr :: Maybe SourceSpan -> Expr -> m (Maybe SourceSpan, Expr)
goExpr _ e@(PositionedValue pos _ _) = return (Just pos, e)
- goExpr pos (Var name) = return (pos, case name `M.lookup` aliased of
- Just (Left alias) -> Var alias
- Just (Right alias) -> Constructor alias
- Nothing -> Var name)
+ goExpr pos (Var name) = return (pos, case name `M.lookup` valueAliased of
+ Just (Qualified mn' (AliasValue alias)) -> Var (Qualified mn' alias)
+ Just (Qualified mn' (AliasConstructor alias)) -> Constructor (Qualified mn' alias)
+ _ -> Var name)
goExpr pos other = return (pos, other)
goBinder :: Maybe SourceSpan -> Binder -> m (Maybe SourceSpan, Binder)
goBinder _ b@(PositionedBinder pos _ _) = return (Just pos, b)
- goBinder pos (BinaryNoParensBinder (OpBinder name) lhs rhs) = case name `M.lookup` aliased of
- Just (Left alias) ->
+ goBinder pos (BinaryNoParensBinder (OpBinder name) lhs rhs) = case name `M.lookup` valueAliased of
+ Just (Qualified _ (AliasValue alias)) ->
maybe id rethrowWithPosition pos $
- throwError . errorMessage $ InvalidOperatorInBinder (disqualify name) (disqualify alias)
- Just (Right alias) ->
- return (pos, ConstructorBinder alias [lhs, rhs])
- Nothing ->
+ throwError . errorMessage $ InvalidOperatorInBinder (disqualify name) alias
+ Just (Qualified mn' (AliasConstructor alias)) ->
+ return (pos, ConstructorBinder (Qualified mn' alias) [lhs, rhs])
+ _ ->
maybe id rethrowWithPosition pos $
throwError . errorMessage $ UnknownValue name
goBinder _ (BinaryNoParensBinder {}) =
internalError "BinaryNoParensBinder has no OpBinder"
goBinder pos other = return (pos, other)
+ goType :: Maybe SourceSpan -> Type -> m Type
+ goType pos = everywhereOnTypesM go
+ where
+ go :: Type -> m Type
+ go (BinaryNoParensType (TypeOp name) lhs rhs) = case name `M.lookup` typeAliased of
+ Just (Qualified mn' (AliasType alias)) ->
+ return $ TypeApp (TypeApp (TypeConstructor (Qualified mn' alias)) lhs) rhs
+ _ ->
+ maybe id rethrowWithPosition pos $
+ throwError . errorMessage $ UnknownTypeOp name
+ go other = return other
+
removeSignedLiterals :: Module -> Module
removeSignedLiterals (Module ss coms mn ds exts) = Module ss coms mn (map f' ds) exts
where
@@ -116,24 +160,64 @@ removeSignedLiterals (Module ss coms mn ds exts) = Module ss coms mn (map f' ds)
go other = other
rebracketModule
- :: (MonadError MultipleErrors m)
+ :: forall m
+ . (MonadError MultipleErrors m)
=> [[(Qualified Ident, Associativity)]]
+ -> [[(Qualified Ident, Associativity)]]
-> Module
-> m Module
-rebracketModule opTable (Module ss coms mn ds exts) =
- let (f, _, _) = everywhereOnValuesTopDownM return (matchExprOperators opTable) (matchBinderOperators opTable)
- in Module ss coms mn <$> (map removeParens <$> parU ds f) <*> pure exts
+rebracketModule valueOpTable typeOpTable (Module ss coms mn ds exts) =
+ Module ss coms mn <$> (map removeParens <$> parU ds f) <*> pure exts
+ where
+ (f, _, _) =
+ everywhereOnValuesTopDownM
+ (decontextify goDecl)
+ (goExpr <=< decontextify goExpr')
+ goBinder
+
+ (goDecl, goExpr') = updateTypes (\_ -> goType)
+
+ goExpr :: Expr -> m Expr
+ goExpr = return . matchExprOperators valueOpTable
+
+ goBinder :: Binder -> m Binder
+ goBinder = return . matchBinderOperators valueOpTable
+
+ goType :: Type -> m Type
+ goType = return . matchTypeOperators typeOpTable
+
+ decontextify :: (Maybe SourceSpan -> a -> m (Maybe SourceSpan, a)) -> a -> m a
+ decontextify ctxf = fmap snd . ctxf Nothing
removeParens :: Declaration -> Declaration
-removeParens =
- let (f, _, _) = everywhereOnValues id goExpr goBinder
- in f
+removeParens = f
where
+ (f, _, _) =
+ everywhereOnValues
+ (decontextify goDecl)
+ (goExpr . decontextify goExpr')
+ goBinder
+
+ (goDecl, goExpr') = updateTypes (\_ -> return . goType)
+
+ goExpr :: Expr -> Expr
goExpr (Parens val) = val
goExpr val = val
+
+ goBinder :: Binder -> Binder
goBinder (ParensInBinder b) = b
goBinder b = b
+ goType :: Type -> Type
+ goType (ParensInType t) = t
+ goType t = t
+
+ decontextify
+ :: (Maybe SourceSpan -> a -> Identity (Maybe SourceSpan, a))
+ -> a
+ -> a
+ decontextify ctxf = snd . runIdentity . ctxf Nothing
+
externsFixities
:: ExternsFile
-> [FixityRecord]
@@ -197,3 +281,52 @@ desugarOperatorSections (Module ss coms mn ds exts) =
Left val -> f2 val var
Right val -> f2 var val
goExpr other = return other
+
+updateTypes
+ :: forall m
+ . Monad m
+ => (Maybe SourceSpan -> Type -> m Type)
+ -> ( Maybe SourceSpan -> Declaration -> m (Maybe SourceSpan, Declaration)
+ , Maybe SourceSpan -> Expr -> m (Maybe SourceSpan, Expr)
+ )
+updateTypes goType = (goDecl, goExpr)
+ where
+
+ goType' :: Maybe SourceSpan -> Type -> m Type
+ goType' = everywhereOnTypesM . goType
+
+ goDecl :: Maybe SourceSpan -> Declaration -> m (Maybe SourceSpan, Declaration)
+ goDecl _ d@(PositionedDeclaration pos _ _) = return (Just pos, d)
+ goDecl pos (DataDeclaration ddt name args dctors) = do
+ dctors' <- traverse (sndM (traverse (goType' pos))) dctors
+ return (pos, DataDeclaration ddt name args dctors')
+ goDecl pos (ExternDeclaration name ty) = do
+ ty' <- goType' pos ty
+ return (pos, ExternDeclaration name ty')
+ goDecl pos (TypeClassDeclaration name args implies decls) = do
+ implies' <- traverse (sndM (traverse (goType' pos))) implies
+ return (pos, TypeClassDeclaration name args implies' decls)
+ goDecl pos (TypeInstanceDeclaration name cs className tys impls) = do
+ cs' <- traverse (sndM (traverse (goType' pos))) cs
+ tys' <- traverse (goType' pos) tys
+ return (pos, TypeInstanceDeclaration name cs' className tys' impls)
+ goDecl pos (TypeSynonymDeclaration name args ty) = do
+ ty' <- goType' pos ty
+ return (pos, TypeSynonymDeclaration name args ty')
+ goDecl pos (TypeDeclaration expr ty) = do
+ ty' <- goType' pos ty
+ return (pos, TypeDeclaration expr ty')
+ goDecl pos other = return (pos, other)
+
+ goExpr :: Maybe SourceSpan -> Expr -> m (Maybe SourceSpan, Expr)
+ goExpr _ e@(PositionedValue pos _ _) = return (Just pos, e)
+ goExpr pos (TypeClassDictionary (name, tys) dicts) = do
+ tys' <- traverse (goType' pos) tys
+ return (pos, TypeClassDictionary (name, tys') dicts)
+ goExpr pos (SuperClassDictionary cls tys) = do
+ tys' <- traverse (goType' pos) tys
+ return (pos, SuperClassDictionary cls tys')
+ goExpr pos (TypedValue check v ty) = do
+ ty' <- goType' pos ty
+ return (pos, TypedValue check v ty')
+ goExpr pos other = return (pos, other)
diff --git a/src/Language/PureScript/Sugar/Operators/Binders.hs b/src/Language/PureScript/Sugar/Operators/Binders.hs
index fc6fbf7..b095569 100644
--- a/src/Language/PureScript/Sugar/Operators/Binders.hs
+++ b/src/Language/PureScript/Sugar/Operators/Binders.hs
@@ -1,43 +1,27 @@
-{-# LANGUAGE FlexibleContexts #-}
-{-# LANGUAGE ScopedTypeVariables #-}
-
module Language.PureScript.Sugar.Operators.Binders where
import Prelude ()
import Prelude.Compat
-import Control.Monad.Error.Class (MonadError(..))
-
-import qualified Text.Parsec as P
-import qualified Text.Parsec.Expr as P
-
-import Language.PureScript.Crash
import Language.PureScript.AST
-import Language.PureScript.Errors
import Language.PureScript.Names
import Language.PureScript.Sugar.Operators.Common
-matchBinderOperators
- :: forall m
- . MonadError MultipleErrors m
- => [[(Qualified Ident, Associativity)]]
- -> Binder
- -> m Binder
-matchBinderOperators ops = parseChains
+matchBinderOperators :: [[(Qualified Ident, Associativity)]] -> Binder -> Binder
+matchBinderOperators = matchOperators isBinOp extractOp fromOp reapply id
where
- parseChains :: Binder -> m Binder
- parseChains b@BinaryNoParensBinder{} = bracketChain (extendChain b)
- parseChains other = return other
- extendChain :: Binder -> Chain Binder
- extendChain (BinaryNoParensBinder op l r) = Left l : Right op : extendChain r
- extendChain other = [Left other]
- bracketChain :: Chain Binder -> m Binder
- bracketChain =
- either
- (\_ -> internalError "matchBinderOperators: cannot reorder operators")
- return
- . P.parse opParser "operator expression"
- opParser = P.buildExpressionParser (opTable ops fromOp reapply) parseValue <* P.eof
+
+ isBinOp :: Binder -> Bool
+ isBinOp BinaryNoParensBinder{} = True
+ isBinOp _ = False
+
+ extractOp :: Binder -> Maybe (Binder, Binder, Binder)
+ extractOp (BinaryNoParensBinder op l r) = Just (op, l, r)
+ extractOp _ = Nothing
+
+ fromOp :: Binder -> Maybe (Qualified Ident)
fromOp (OpBinder q@(Qualified _ (Op _))) = Just q
fromOp _ = Nothing
+
+ reapply :: Qualified Ident -> Binder -> Binder -> Binder
reapply = BinaryNoParensBinder . OpBinder
diff --git a/src/Language/PureScript/Sugar/Operators/Common.hs b/src/Language/PureScript/Sugar/Operators/Common.hs
index a447ab6..6e56810 100644
--- a/src/Language/PureScript/Sugar/Operators/Common.hs
+++ b/src/Language/PureScript/Sugar/Operators/Common.hs
@@ -1,5 +1,6 @@
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE ScopedTypeVariables #-}
+{-# LANGUAGE PatternGuards #-}
module Language.PureScript.Sugar.Operators.Common where
@@ -15,6 +16,7 @@ import qualified Text.Parsec.Pos as P
import qualified Text.Parsec.Expr as P
import Language.PureScript.AST
+import Language.PureScript.Crash
import Language.PureScript.Names
type Chain a = [Either a a]
@@ -51,3 +53,32 @@ opTable
opTable ops fromOp reapply =
map (map (\(name, a) -> P.Infix (P.try (matchOp fromOp name) >> return (reapply name)) (toAssoc a))) ops
++ [[ P.Infix (P.try (parseOp fromOp >>= \ident -> return (reapply ident))) P.AssocLeft ]]
+
+matchOperators
+ :: forall a
+ . Show a
+ => (a -> Bool)
+ -> (a -> Maybe (a, a, a))
+ -> (a -> Maybe (Qualified Ident))
+ -> (Qualified Ident -> a -> a -> a)
+ -> ([[P.Operator (Chain a) () Identity a]] -> P.OperatorTable (Chain a) () Identity a)
+ -> [[(Qualified Ident, Associativity)]]
+ -> a
+ -> a
+matchOperators isBinOp extractOp fromOp reapply modOpTable ops = parseChains
+ where
+ parseChains :: a -> a
+ parseChains ty
+ | True <- isBinOp ty = bracketChain (extendChain ty)
+ | otherwise = ty
+ extendChain :: a -> Chain a
+ extendChain ty
+ | Just (op, l, r) <- extractOp ty = Left l : Right op : extendChain r
+ | otherwise = [Left ty]
+ bracketChain :: Chain a -> a
+ bracketChain =
+ either
+ (\_ -> internalError "matchTypeOperators: cannot reorder operators")
+ id
+ . P.parse opParser "operator expression"
+ opParser = P.buildExpressionParser (modOpTable (opTable ops fromOp reapply)) parseValue <* P.eof
diff --git a/src/Language/PureScript/Sugar/Operators/Expr.hs b/src/Language/PureScript/Sugar/Operators/Expr.hs
index 7ffafdf..71fbefd 100644
--- a/src/Language/PureScript/Sugar/Operators/Expr.hs
+++ b/src/Language/PureScript/Sugar/Operators/Expr.hs
@@ -6,47 +6,43 @@ module Language.PureScript.Sugar.Operators.Expr where
import Prelude ()
import Prelude.Compat
-import Control.Monad.Error.Class (MonadError(..))
+import Data.Functor.Identity
import qualified Text.Parsec as P
import qualified Text.Parsec.Expr as P
-import Language.PureScript.Crash
import Language.PureScript.AST
-import Language.PureScript.Errors
import Language.PureScript.Names
import Language.PureScript.Sugar.Operators.Common
-matchExprOperators
- :: forall m
- . MonadError MultipleErrors m
- => [[(Qualified Ident, Associativity)]]
- -> Expr
- -> m Expr
-matchExprOperators ops = parseChains
+matchExprOperators :: [[(Qualified Ident, Associativity)]] -> Expr -> Expr
+matchExprOperators = matchOperators isBinOp extractOp fromOp reapply modOpTable
where
- parseChains :: Expr -> m Expr
- parseChains b@BinaryNoParens{} = bracketChain (extendChain b)
- parseChains other = return other
- extendChain :: Expr -> Chain Expr
- extendChain (BinaryNoParens op l r) = Left l : Right op : extendChain r
- extendChain other = [Left other]
- bracketChain :: Chain Expr -> m Expr
- bracketChain =
- either
- (\_ -> internalError "matchExprOperators: cannot reorder operators")
- return
- . P.parse opParser "operator expression"
- opParser = P.buildExpressionParser opTable' parseValue <* P.eof
- opTable' =
- [ P.Infix (P.try (parseTicks >>= \op -> return (\t1 t2 -> App (App op t1) t2))) P.AssocLeft ]
- : opTable ops fromOp reapply
+
+ isBinOp :: Expr -> Bool
+ isBinOp BinaryNoParens{} = True
+ isBinOp _ = False
+
+ extractOp :: Expr -> Maybe (Expr, Expr, Expr)
+ extractOp (BinaryNoParens op l r) = Just (op, l, r)
+ extractOp _ = Nothing
+
+ fromOp :: Expr -> Maybe (Qualified Ident)
fromOp (Var q@(Qualified _ (Op _))) = Just q
fromOp _ = Nothing
+
+ reapply :: Qualified Ident -> Expr -> Expr -> Expr
reapply op t1 t2 = App (App (Var op) t1) t2
-parseTicks :: P.Parsec (Chain Expr) () Expr
-parseTicks = token (either (const Nothing) fromOther) P.<?> "infix function"
- where
- fromOther (Var (Qualified _ (Op _))) = Nothing
- fromOther v = Just v
+ modOpTable
+ :: [[P.Operator (Chain Expr) () Identity Expr]]
+ -> [[P.Operator (Chain Expr) () Identity Expr]]
+ modOpTable table =
+ [ P.Infix (P.try (parseTicks >>= \op -> return (\t1 t2 -> App (App op t1) t2))) P.AssocLeft ]
+ : table
+
+ parseTicks :: P.Parsec (Chain Expr) () Expr
+ parseTicks = token (either (const Nothing) fromOther) P.<?> "infix function"
+ where
+ fromOther (Var (Qualified _ (Op _))) = Nothing
+ fromOther v = Just v
diff --git a/src/Language/PureScript/Sugar/Operators/Types.hs b/src/Language/PureScript/Sugar/Operators/Types.hs
new file mode 100644
index 0000000..35b0886
--- /dev/null
+++ b/src/Language/PureScript/Sugar/Operators/Types.hs
@@ -0,0 +1,28 @@
+module Language.PureScript.Sugar.Operators.Types where
+
+import Prelude ()
+import Prelude.Compat
+
+import Language.PureScript.AST
+import Language.PureScript.Names
+import Language.PureScript.Sugar.Operators.Common
+import Language.PureScript.Types
+
+matchTypeOperators :: [[(Qualified Ident, Associativity)]] -> Type -> Type
+matchTypeOperators = matchOperators isBinOp extractOp fromOp reapply id
+ where
+
+ isBinOp :: Type -> Bool
+ isBinOp BinaryNoParensType{} = True
+ isBinOp _ = False
+
+ extractOp :: Type -> Maybe (Type, Type, Type)
+ extractOp (BinaryNoParensType op l r) = Just (op, l, r)
+ extractOp _ = Nothing
+
+ fromOp :: Type -> Maybe (Qualified Ident)
+ fromOp (TypeOp q@(Qualified _ (Op _))) = Just q
+ fromOp _ = Nothing
+
+ reapply :: Qualified Ident -> Type -> Type -> Type
+ reapply = BinaryNoParensType . TypeOp
diff --git a/src/Language/PureScript/Sugar/TypeClasses/Deriving.hs b/src/Language/PureScript/Sugar/TypeClasses/Deriving.hs
index f788d48..f788d48 100644..100755
--- a/src/Language/PureScript/Sugar/TypeClasses/Deriving.hs
+++ b/src/Language/PureScript/Sugar/TypeClasses/Deriving.hs
diff --git a/src/Language/PureScript/TypeChecker.hs b/src/Language/PureScript/TypeChecker.hs
index 15b13aa..8501e52 100644
--- a/src/Language/PureScript/TypeChecker.hs
+++ b/src/Language/PureScript/TypeChecker.hs
@@ -1,6 +1,7 @@
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE PatternGuards #-}
-- |
-- The top-level type checker, which checks all declarations in a module.
@@ -191,23 +192,19 @@ typeCheckAll moduleName _ ds = traverse go ds <* traverse_ checkFixities ds
go :: Declaration -> m Declaration
go (DataDeclaration dtype name args dctors) = do
warnAndRethrow (addHint (ErrorInTypeConstructor name)) $ do
- when (dtype == Newtype) $ checkNewtype dctors
+ when (dtype == Newtype) $ checkNewtype name dctors
checkDuplicateTypeArguments $ map fst args
ctorKind <- kindsOf True moduleName name args (concatMap snd dctors)
let args' = args `withKinds` ctorKind
addDataType moduleName dtype name args' dctors ctorKind
return $ DataDeclaration dtype name args dctors
- where
- checkNewtype :: [(ProperName 'ConstructorName, [Type])] -> m ()
- checkNewtype [(_, [_])] = return ()
- checkNewtype [(_, _)] = throwError . errorMessage $ InvalidNewtype name
- checkNewtype _ = throwError . errorMessage $ InvalidNewtype name
go (d@(DataBindingGroupDeclaration tys)) = do
warnAndRethrow (addHint ErrorInDataBindingGroup) $ do
let syns = mapMaybe toTypeSynonym tys
let dataDecls = mapMaybe toDataDecl tys
(syn_ks, data_ks) <- kindsOfAll moduleName syns (map (\(_, name, args, dctors) -> (name, args, concatMap snd dctors)) dataDecls)
for_ (zip dataDecls data_ks) $ \((dtype, name, args, dctors), ctorKind) -> do
+ when (dtype == Newtype) $ checkNewtype name dctors
checkDuplicateTypeArguments $ map fst args
let args' = args `withKinds` ctorKind
addDataType moduleName dtype name args' dctors ctorKind
@@ -281,15 +278,16 @@ typeCheckAll moduleName _ ds = traverse go ds <* traverse_ checkFixities ds
warnAndRethrowWithPosition pos $ PositionedDeclaration pos com <$> go d
checkFixities :: Declaration -> m ()
- checkFixities (FixityDeclaration _ name (Just (Left alias))) = do
- ty <- lookupVariable moduleName alias
+ checkFixities (FixityDeclaration _ name (Just (Qualified mn' (AliasValue ident)))) = do
+ ty <- lookupVariable moduleName (Qualified mn' ident)
addValue moduleName (Op name) ty Public
- checkFixities (FixityDeclaration _ name (Just (Right alias))) = do
+ checkFixities (FixityDeclaration _ name (Just (Qualified mn' (AliasConstructor ctor)))) = do
env <- getEnv
+ let alias = Qualified mn' ctor
case M.lookup alias (dataConstructors env) of
Nothing -> throwError . errorMessage $ UnknownDataConstructor alias Nothing
Just (_, _, ty, _) -> addValue moduleName (Op name) ty Public
- checkFixities (FixityDeclaration _ name _) = do
+ checkFixities (FixityDeclaration _ name Nothing) = do
env <- getEnv
guardWith (errorMessage (OrphanFixityDeclaration name)) $ M.member (moduleName, Op name) $ names env
checkFixities (PositionedDeclaration pos _ d) =
@@ -327,6 +325,10 @@ typeCheckAll moduleName _ ds = traverse go ds <* traverse_ checkFixities ds
checkType _ = internalError "Invalid type in instance in checkOrphanInstance"
checkOrphanInstance _ _ _ = internalError "Unqualified class name in checkOrphanInstance"
+ checkNewtype :: ProperName 'TypeName -> [(ProperName 'ConstructorName, [Type])] -> m ()
+ checkNewtype _ [(_, [_])] = return ()
+ checkNewtype name _ = throwError . errorMessage $ InvalidNewtype name
+
-- |
-- This function adds the argument kinds for a type constructor so that they may appear in the externs file,
-- extracted from the kind of the type constructor itself.
@@ -437,7 +439,7 @@ typeCheckModule (Module ss coms mn decls (Just exps)) = warnAndRethrow (addHint
checkNonAliasesAreExported :: [ProperName 'ConstructorName] -> DeclarationRef -> m ()
checkNonAliasesAreExported exportedDctors dr@(ValueRef (Op name)) =
- case listToMaybe (mapMaybe getAlias decls) of
+ case listToMaybe (mapMaybe (getAlias getValueAlias name) decls) of
Just (Left ident) ->
unless (ValueRef ident `elem` exps) $
throwError . errorMessage $ TransitiveExportError dr [ValueRef ident]
@@ -445,17 +447,24 @@ typeCheckModule (Module ss coms mn decls (Just exps)) = warnAndRethrow (addHint
unless (ctor `elem` exportedDctors) $
throwError . errorMessage $ TransitiveDctorExportError dr ctor
_ -> return ()
+ checkNonAliasesAreExported _ dr@(TypeOpRef (Op name)) =
+ case listToMaybe (mapMaybe (getAlias getTypeAlias name) decls) of
+ Just ty ->
+ unless (any (isTypeRefFor ty) exps) $
+ throwError . errorMessage $ TransitiveExportError dr [TypeRef ty Nothing]
+ _ -> return ()
where
- getAlias :: Declaration -> Maybe (Either Ident (ProperName 'ConstructorName))
- getAlias (PositionedDeclaration _ _ d) = getAlias d
- getAlias (FixityDeclaration _ name' (Just alias)) | name == name' =
- case alias of
- Left (Qualified (Just mn') ident) | mn == mn' -> Just (Left ident)
- Right (Qualified (Just mn') ctor) | mn == mn' -> Just (Right ctor)
- _ -> Nothing
- getAlias _ = Nothing
+ isTypeRefFor :: ProperName 'TypeName -> DeclarationRef -> Bool
+ isTypeRefFor ty (TypeRef ty' _) = ty == ty'
+ isTypeRefFor _ _ = False
checkNonAliasesAreExported _ _ = return ()
+ getAlias :: (FixityAlias -> Maybe a) -> String -> Declaration -> Maybe a
+ getAlias match name (PositionedDeclaration _ _ d) = getAlias match name d
+ getAlias match name (FixityDeclaration _ name' (Just (Qualified (Just mn') a)))
+ | Just alias <- match a, name == name' && mn == mn' = Just alias
+ getAlias _ _ _ = Nothing
+
exportedDataConstructors :: [DeclarationRef] -> [ProperName 'ConstructorName]
exportedDataConstructors = foldMap extractCtor
where
diff --git a/src/Language/PureScript/TypeChecker/Kinds.hs b/src/Language/PureScript/TypeChecker/Kinds.hs
index 188cf97..59ffa8b 100644
--- a/src/Language/PureScript/TypeChecker/Kinds.hs
+++ b/src/Language/PureScript/TypeChecker/Kinds.hs
@@ -268,4 +268,4 @@ infer' other = (, []) <$> go other
k <- go ty
unifyKinds k Star
return Star
- go _ = internalError "Invalid argument to infer"
+ go ty = internalError $ "Invalid argument to infer: " ++ show ty
diff --git a/src/Language/PureScript/TypeChecker/Monad.hs b/src/Language/PureScript/TypeChecker/Monad.hs
index e4ac9d8..c4e9450 100644
--- a/src/Language/PureScript/TypeChecker/Monad.hs
+++ b/src/Language/PureScript/TypeChecker/Monad.hs
@@ -225,6 +225,7 @@ runCheck = runCheck' initEnvironment
-- | Run a computation in the typechecking monad, failing with an error, or succeeding with a return value and the final @Environment@.
runCheck' :: (Functor m) => Environment -> StateT CheckState m a -> m (a, Environment)
runCheck' env check = second checkEnv <$> runStateT check (emptyCheckState env)
+
-- | Make an assertion, failing with an error message
guardWith :: (MonadError e m) => e -> Bool -> m ()
guardWith _ True = return ()
diff --git a/src/Language/PureScript/TypeChecker/Types.hs b/src/Language/PureScript/TypeChecker/Types.hs
index bc90c67..715e7aa 100644
--- a/src/Language/PureScript/TypeChecker/Types.hs
+++ b/src/Language/PureScript/TypeChecker/Types.hs
@@ -74,7 +74,7 @@ typesOf ::
[(Ident, Expr)] ->
m [(Ident, (Expr, Type))]
typesOf bindingGroupType moduleName vals = do
- tys <- fmap tidyUp . liftUnifyWarnings replace $ do
+ tys <- fmap tidyUp . escalateWarningWhen isHoleError . liftUnifyWarnings replace $ do
(untyped, typed, dict, untypedDict) <- typeDictionaryForBindingGroup moduleName vals
ds1 <- parU typed $ \e -> checkTypedBindingGroupElement moduleName e dict
ds2 <- forM untyped $ \e -> typeForBindingGroupElement e dict untypedDict
@@ -109,17 +109,28 @@ typesOf bindingGroupType moduleName vals = do
checkDuplicateLabels val'
return (ident, (foldr (Abs . Left . fst) val' unsolved, generalized))
where
+
-- | Generalize type vars using forall and add inferred constraints
generalize unsolved = varIfUnknown . constrain unsolved
+
-- | Add any unsolved constraints
constrain [] = id
constrain cs = ConstrainedType (map snd cs)
+
-- Apply the substitution that was returned from runUnify to both types and (type-annotated) values
tidyUp (ts, sub) = map (\(b, (i, (val, ty))) -> (b, (i, (overTypes (substituteType sub) val, substituteType sub ty)))) ts
+
-- Replace all the wildcards types with their inferred types
- replace sub (ErrorMessage hints (WildcardInferredType ty)) = ErrorMessage hints . WildcardInferredType $ substituteType sub ty
+ replace sub (ErrorMessage hints (WildcardInferredType ty)) =
+ ErrorMessage hints . WildcardInferredType $ substituteType sub ty
+ replace sub (ErrorMessage hints (HoleInferredType name ty)) =
+ ErrorMessage hints . HoleInferredType name $ substituteType sub ty
replace _ em = em
+ isHoleError :: ErrorMessage -> Bool
+ isHoleError (ErrorMessage _ HoleInferredType{}) = True
+ isHoleError _ = False
+
type TypeData = M.Map (ModuleName, Ident) (Type, NameKind, NameVisibility)
type UntypedData = [(Ident, Type)]
@@ -316,10 +327,14 @@ infer' (TypedValue checkType val ty) = do
ty' <- introduceSkolemScope <=< replaceAllTypeSynonyms <=< replaceTypeWildcards $ ty
val' <- if checkType then withScopedTypeVars moduleName args (check val ty') else return val
return $ TypedValue True val' ty'
+infer' (Hole name) = do
+ ty <- freshType
+ tell . errorMessage $ HoleInferredType name ty
+ return $ TypedValue True (Hole name) ty
infer' (PositionedValue pos c val) = warnAndRethrowWithPosition pos $ do
TypedValue t v ty <- infer' val
return $ TypedValue t (PositionedValue pos c v) ty
-infer' _ = internalError "Invalid argument to infer"
+infer' v = internalError $ "Invalid argument to infer: " ++ show v
inferLetBinding ::
(MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) =>
diff --git a/src/Language/PureScript/Types.hs b/src/Language/PureScript/Types.hs
index 925095b..308b6b5 100644
--- a/src/Language/PureScript/Types.hs
+++ b/src/Language/PureScript/Types.hs
@@ -49,6 +49,11 @@ data Type
--
| TypeConstructor (Qualified (ProperName 'TypeName))
-- |
+ -- A type operator. This will be desugared into a type constructor during the
+ -- "operators" phase of desugaring.
+ --
+ | TypeOp (Qualified Ident)
+ -- |
-- A type application
--
| TypeApp Type Type
@@ -89,6 +94,19 @@ data Type
-- A placeholder used in pretty printing
--
| PrettyPrintForAll [String] Type
+ -- |
+ -- Binary operator application. During the rebracketing phase of desugaring,
+ -- this data constructor will be removed.
+ --
+ | BinaryNoParensType Type Type Type
+ -- |
+ -- Explicit parentheses. During the rebracketing phase of desugaring, this
+ -- data constructor will be removed.
+ --
+ -- Note: although it seems this constructor is not used, it _is_ useful,
+ -- since it prevents certain traversals from matching.
+ --
+ | ParensInType Type
deriving (Show, Read, Eq, Ord)
-- |
@@ -154,6 +172,8 @@ replaceAllTypeVars = go []
go bs m (ConstrainedType cs t) = ConstrainedType (map (second $ map (go bs m)) cs) (go bs m t)
go bs m (RCons name' t r) = RCons name' (go bs m t) (go bs m r)
go bs m (KindedType t k) = KindedType (go bs m t) k
+ go bs m (BinaryNoParensType t1 t2 t3) = BinaryNoParensType (go bs m t1) (go bs m t2) (go bs m t3)
+ go bs m (ParensInType t) = ParensInType (go bs m t)
go _ _ ty = ty
genName orig inUse = try 0
@@ -184,6 +204,8 @@ freeTypeVariables = nub . go []
go bound (ConstrainedType cs t) = concatMap (concatMap (go bound) . snd) cs ++ go bound t
go bound (RCons _ t r) = go bound t ++ go bound r
go bound (KindedType t _) = go bound t
+ go bound (BinaryNoParensType t1 t2 t3) = go bound t1 ++ go bound t2 ++ go bound t3
+ go bound (ParensInType t) = go bound t
go _ _ = []
-- |
@@ -233,6 +255,8 @@ everywhereOnTypes f = go
go (PrettyPrintFunction t1 t2) = f (PrettyPrintFunction (go t1) (go t2))
go (PrettyPrintObject t) = f (PrettyPrintObject (go t))
go (PrettyPrintForAll args t) = f (PrettyPrintForAll args (go t))
+ go (BinaryNoParensType t1 t2 t3) = f (BinaryNoParensType (go t1) (go t2) (go t3))
+ go (ParensInType t) = f (ParensInType (go t))
go other = f other
everywhereOnTypesTopDown :: (Type -> Type) -> Type -> Type
@@ -246,6 +270,8 @@ everywhereOnTypesTopDown f = go . f
go (PrettyPrintFunction t1 t2) = PrettyPrintFunction (go (f t1)) (go (f t2))
go (PrettyPrintObject t) = PrettyPrintObject (go (f t))
go (PrettyPrintForAll args t) = PrettyPrintForAll args (go (f t))
+ go (BinaryNoParensType t1 t2 t3) = BinaryNoParensType (f (go t1)) (f (go t2)) (f (go t3))
+ go (ParensInType t) = ParensInType (f (go t))
go other = f other
everywhereOnTypesM :: Monad m => (Type -> m Type) -> Type -> m Type
@@ -259,6 +285,8 @@ everywhereOnTypesM f = go
go (PrettyPrintFunction t1 t2) = (PrettyPrintFunction <$> go t1 <*> go t2) >>= f
go (PrettyPrintObject t) = (PrettyPrintObject <$> go t) >>= f
go (PrettyPrintForAll args t) = (PrettyPrintForAll args <$> go t) >>= f
+ go (BinaryNoParensType t1 t2 t3) = (BinaryNoParensType <$> go t1 <*> go t2 <*> go t3) >>= f
+ go (ParensInType t) = (ParensInType <$> go t) >>= f
go other = f other
everywhereOnTypesTopDownM :: Monad m => (Type -> m Type) -> Type -> m Type
@@ -272,6 +300,8 @@ everywhereOnTypesTopDownM f = go <=< f
go (PrettyPrintFunction t1 t2) = PrettyPrintFunction <$> (f t1 >>= go) <*> (f t2 >>= go)
go (PrettyPrintObject t) = PrettyPrintObject <$> (f t >>= go)
go (PrettyPrintForAll args t) = PrettyPrintForAll args <$> (f t >>= go)
+ go (BinaryNoParensType t1 t2 t3) = BinaryNoParensType <$> (f t1 >>= go) <*> (f t2 >>= go) <*> (f t3 >>= go)
+ go (ParensInType t) = ParensInType <$> (f t >>= go)
go other = f other
everythingOnTypes :: (r -> r -> r) -> (Type -> r) -> Type -> r
@@ -285,6 +315,8 @@ everythingOnTypes (<>) f = go
go t@(PrettyPrintFunction t1 t2) = f t <> go t1 <> go t2
go t@(PrettyPrintObject t1) = f t <> go t1
go t@(PrettyPrintForAll _ t1) = f t <> go t1
+ go t@(BinaryNoParensType t1 t2 t3) = f t <> go t1 <> go t2 <> go t3
+ go t@(ParensInType t1) = f t <> go t1
go other = f other
everythingWithContextOnTypes :: s -> r -> (r -> r -> r) -> (s -> Type -> (s, r)) -> Type -> r
@@ -299,4 +331,6 @@ everythingWithContextOnTypes s0 r0 (<>) f = go' s0
go s (PrettyPrintFunction t1 t2) = go' s t1 <> go' s t2
go s (PrettyPrintObject t1) = go' s t1
go s (PrettyPrintForAll _ t1) = go' s t1
+ go s (BinaryNoParensType t1 t2 t3) = go' s t1 <> go' s t2 <> go' s t3
+ go s (ParensInType t1) = go' s t1
go _ _ = r0
diff --git a/tests/Language/PureScript/Ide/Integration.hs b/tests/Language/PureScript/Ide/Integration.hs
index 7a57662..cea69fd 100644
--- a/tests/Language/PureScript/Ide/Integration.hs
+++ b/tests/Language/PureScript/Ide/Integration.hs
@@ -27,11 +27,13 @@ module Language.PureScript.Ide.Integration
, projectDirectory
, deleteFileIfExists
-- sending commands
+ , loadModule
, loadModuleWithDeps
, getFlexCompletions
, getType
, addImport
, addImplicitImport
+ , rebuildModule
-- checking results
, resultIsSuccess
, parseCompletions
@@ -131,6 +133,9 @@ quitServer = do
loadModuleWithDeps :: String -> IO String
loadModuleWithDeps m = sendCommand $ load [] [m]
+loadModule :: String -> IO String
+loadModule m = sendCommand $ load [m] []
+
getFlexCompletions :: String -> IO [(String, String, String)]
getFlexCompletions q = parseCompletions <$> sendCommand (completion [] (Just (flexMatcher q)))
@@ -143,6 +148,9 @@ addImport identifier fp outfp = sendCommand (addImportC identifier fp outfp)
addImplicitImport :: String -> FilePath -> FilePath -> IO String
addImplicitImport mn fp outfp = sendCommand (addImplicitImportC mn fp outfp)
+rebuildModule :: FilePath -> IO String
+rebuildModule m = sendCommand (rebuildC m Nothing)
+
-- Command Encoding
commandWrapper :: String -> Value -> Value
@@ -166,6 +174,12 @@ addImplicitImportC mn = addImportW $
, "module" .= mn
]
+rebuildC :: FilePath -> Maybe FilePath -> Value
+rebuildC file outFile =
+ commandWrapper "rebuild" (object [ "file" .= file
+ , "outfile" .= outFile
+ ])
+
addImportW :: Value -> FilePath -> FilePath -> Value
addImportW importCommand fp outfp =
commandWrapper "import" (object [ "file" .= fp
diff --git a/tests/Language/PureScript/Ide/RebuildSpec.hs b/tests/Language/PureScript/Ide/RebuildSpec.hs
new file mode 100644
index 0000000..f7370af
--- /dev/null
+++ b/tests/Language/PureScript/Ide/RebuildSpec.hs
@@ -0,0 +1,62 @@
+module Language.PureScript.Ide.RebuildSpec where
+
+import Control.Monad
+import qualified Language.PureScript.Ide.Integration as Integration
+import Test.Hspec
+
+import System.FilePath
+
+compile :: IO ()
+compile = do
+ Integration.deleteOutputFolder
+ s <- Integration.compileTestProject
+ unless s $ fail "Failed to compile .purs sources"
+
+teardown :: IO ()
+teardown = Integration.quitServer
+
+restart :: IO ()
+restart = Integration.quitServer *> (void Integration.startServer)
+
+shouldBeSuccess :: String -> IO ()
+shouldBeSuccess = shouldBe True . Integration.resultIsSuccess
+
+shouldBeFailure :: String -> IO ()
+shouldBeFailure = shouldBe False . Integration.resultIsSuccess
+
+spec :: Spec
+spec = beforeAll_ compile $ afterAll_ teardown $ before_ restart $ do
+ describe "Rebuilding single modules" $ do
+ it "rebuilds a correct module without dependencies successfully" $ do
+ _ <- Integration.loadModuleWithDeps "RebuildSpecSingleModule"
+ pdir <- Integration.projectDirectory
+ let file = pdir </> "src" </> "RebuildSpecSingleModule.purs"
+ Integration.rebuildModule file >>= shouldBeSuccess
+ it "fails to rebuild an incorrect module without dependencies and returns the errors" $ do
+ pdir <- Integration.projectDirectory
+ let file = pdir </> "src" </> "RebuildSpecSingleModule.fail"
+ Integration.rebuildModule file >>= shouldBeFailure
+ it "rebuilds a correct module with its dependencies successfully" $ do
+ _ <- Integration.loadModuleWithDeps "RebuildSpecWithDeps"
+ pdir <- Integration.projectDirectory
+ let file = pdir </> "src" </> "RebuildSpecWithDeps.purs"
+ Integration.rebuildModule file >>= shouldBeSuccess
+ it "rebuilds a correct module that has reverse dependencies" $ do
+ _ <- Integration.loadModuleWithDeps "RebuildSpecWithDeps"
+ pdir <- Integration.projectDirectory
+ let file = pdir </> "src" </> "RebuildSpecDep.purs"
+ Integration.rebuildModule file >>= shouldBeSuccess
+ it "fails to rebuild a module if its dependencies are not loaded" $ do
+ _ <- Integration.loadModule "RebuildSpecWithDeps"
+ pdir <- Integration.projectDirectory
+ let file = pdir </> "src" </> "RebuildSpecWithDeps.purs"
+ Integration.rebuildModule file >>= shouldBeFailure
+ it "rebuilds a correct module with a foreign file" $ do
+ _ <- Integration.loadModuleWithDeps "RebuildSpecWithForeign"
+ pdir <- Integration.projectDirectory
+ let file = pdir </> "src" </> "RebuildSpecWithForeign.purs"
+ Integration.rebuildModule file >>= shouldBeSuccess
+ it "fails to rebuild a module with a foreign import but no file" $ do
+ pdir <- Integration.projectDirectory
+ let file = pdir </> "src" </> "RebuildSpecWithMissingForeign.fail"
+ Integration.rebuildModule file >>= shouldBeFailure
diff --git a/tests/Main.hs b/tests/Main.hs
index 152cd44..2a246ef 100644
--- a/tests/Main.hs
+++ b/tests/Main.hs
@@ -1,16 +1,3 @@
------------------------------------------------------------------------------
---
--- Module : Main
--- License : MIT (http://opensource.org/licenses/MIT)
---
--- Maintainer : Phil Freeman <paf31@cantab.net>
--- Stability : experimental
--- Portability :
---
--- |
---
------------------------------------------------------------------------------
-
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DoAndIfThenElse #-}
{-# LANGUAGE TupleSections #-}
@@ -27,8 +14,13 @@ import qualified TestDocs
import qualified TestPsci
import qualified TestPscIde
+import System.IO (hSetEncoding, stdout, stderr, utf8)
+
main :: IO ()
main = do
+ hSetEncoding stdout utf8
+ hSetEncoding stderr utf8
+
heading "Main compiler test suite"
TestCompiler.main
heading "Documentation test suite"
diff --git a/tests/TestDocs.hs b/tests/TestDocs.hs
index 1af8bd4..dff2da4 100644
--- a/tests/TestDocs.hs
+++ b/tests/TestDocs.hs
@@ -285,12 +285,20 @@ testCases =
, ValueShouldHaveTypeSignature (n "ExplicitTypeSignatures") "aNumber" (ShowFn (P.tyNumber ==))
])
- , ("ConstrainedArgument",
- [ TypeSynonymShouldRenderAs (n "ConstrainedArgument") "WithoutArgs" "forall a. (Partial => a) -> a"
- , TypeSynonymShouldRenderAs (n "ConstrainedArgument") "WithArgs" "forall a. (Foo a => a) -> a"
- , TypeSynonymShouldRenderAs (n "ConstrainedArgument") "MultiWithoutArgs" "forall a. ((Partial, Partial) => a) -> a"
- , TypeSynonymShouldRenderAs (n "ConstrainedArgument") "MultiWithArgs" "forall a b. ((Foo a, Foo b) => a) -> a"
- ])
+ , ("ConstrainedArgument",
+ [ TypeSynonymShouldRenderAs (n "ConstrainedArgument") "WithoutArgs" "forall a. (Partial => a) -> a"
+ , TypeSynonymShouldRenderAs (n "ConstrainedArgument") "WithArgs" "forall a. (Foo a => a) -> a"
+ , TypeSynonymShouldRenderAs (n "ConstrainedArgument") "MultiWithoutArgs" "forall a. ((Partial, Partial) => a) -> a"
+ , TypeSynonymShouldRenderAs (n "ConstrainedArgument") "MultiWithArgs" "forall a b. ((Foo a, Foo b) => a) -> a"
+ ])
+
+ , ("TypeOpAliases",
+ [ ValueShouldHaveTypeSignature (n "TypeOpAliases") "test1" (renderedType "forall a b. a ~> b")
+ , ValueShouldHaveTypeSignature (n "TypeOpAliases") "test2" (renderedType "forall a b c. a ~> b ~> c")
+ , ValueShouldHaveTypeSignature (n "TypeOpAliases") "test3" (renderedType "forall a b c d. a ~> (b ~> c) ~> d")
+ , ValueShouldHaveTypeSignature (n "TypeOpAliases") "test4" (renderedType "forall a b c d. ((a ~> b) ~> c) ~> d")
+ , ValueShouldHaveTypeSignature (n "TypeOpAliases") "third" (renderedType "forall a b c. a × b × c -> c")
+ ])
]
where
@@ -301,3 +309,6 @@ testCases =
isVar varName (P.TypeVar name) | varName == name = True
isVar _ _ = False
+
+ renderedType expected =
+ ShowFn $ \ty -> codeToString (Docs.renderType ty) == expected
diff --git a/tests/TestPsci.hs b/tests/TestPsci.hs
index 3d058df..ee0a2c1 100644
--- a/tests/TestPsci.hs
+++ b/tests/TestPsci.hs
@@ -17,6 +17,7 @@ import System.Exit (exitFailure)
import System.Console.Haskeline
import System.FilePath ((</>))
import System.Directory (getCurrentDirectory)
+import System.IO.UTF8 (readUTF8File)
import qualified System.FilePath.Glob as Glob
import Test.HUnit
@@ -132,7 +133,7 @@ getPSCiState = do
jsFiles <- supportFiles "js"
modulesOrFirstError <- loadAllModules pursFiles
- foreignFiles <- forM jsFiles (\f -> (f,) <$> readFile f)
+ foreignFiles <- forM jsFiles (\f -> (f,) <$> readUTF8File f)
Right (foreigns, _) <- runExceptT $ runWriterT $ P.parseForeignModulesFromFiles foreignFiles
case modulesOrFirstError of
Left err ->
diff --git a/tests/support/pscide/src/RebuildSpecDep.purs b/tests/support/pscide/src/RebuildSpecDep.purs
new file mode 100644
index 0000000..afd29a8
--- /dev/null
+++ b/tests/support/pscide/src/RebuildSpecDep.purs
@@ -0,0 +1,3 @@
+module RebuildSpecDep where
+
+dep = 42
diff --git a/tests/support/pscide/src/RebuildSpecSingleModule.fail b/tests/support/pscide/src/RebuildSpecSingleModule.fail
new file mode 100644
index 0000000..b411eb4
--- /dev/null
+++ b/tests/support/pscide/src/RebuildSpecSingleModule.fail
@@ -0,0 +1,3 @@
+module RebuildSpecSingleModule where
+
+let anerror \ No newline at end of file
diff --git a/tests/support/pscide/src/RebuildSpecSingleModule.purs b/tests/support/pscide/src/RebuildSpecSingleModule.purs
new file mode 100644
index 0000000..4059629
--- /dev/null
+++ b/tests/support/pscide/src/RebuildSpecSingleModule.purs
@@ -0,0 +1,4 @@
+module RebuildSpecSingleModule where
+
+id x = x
+const x y = x
diff --git a/tests/support/pscide/src/RebuildSpecWithDeps.purs b/tests/support/pscide/src/RebuildSpecWithDeps.purs
new file mode 100644
index 0000000..c095a92
--- /dev/null
+++ b/tests/support/pscide/src/RebuildSpecWithDeps.purs
@@ -0,0 +1,5 @@
+module RebuildSpecWithDeps where
+
+import RebuildSpecDep (dep)
+
+x = dep
diff --git a/tests/support/pscide/src/RebuildSpecWithForeign.js b/tests/support/pscide/src/RebuildSpecWithForeign.js
new file mode 100644
index 0000000..7c82dc8
--- /dev/null
+++ b/tests/support/pscide/src/RebuildSpecWithForeign.js
@@ -0,0 +1,3 @@
+// module RebuildSpecWithForeign
+
+exports.f = 5;
diff --git a/tests/support/pscide/src/RebuildSpecWithForeign.purs b/tests/support/pscide/src/RebuildSpecWithForeign.purs
new file mode 100644
index 0000000..2f425ef
--- /dev/null
+++ b/tests/support/pscide/src/RebuildSpecWithForeign.purs
@@ -0,0 +1,3 @@
+module RebuildSpecWithForeign where
+
+foreign import f :: Int
diff --git a/tests/support/pscide/src/RebuildSpecWithMissingForeign.fail b/tests/support/pscide/src/RebuildSpecWithMissingForeign.fail
new file mode 100644
index 0000000..c75fdea
--- /dev/null
+++ b/tests/support/pscide/src/RebuildSpecWithMissingForeign.fail
@@ -0,0 +1,3 @@
+module RebuildSpecWithMissingForeign where
+
+foreign import f :: Int