summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgaryb <>2019-01-14 00:01:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2019-01-14 00:01:00 (GMT)
commitc2355186ca642e6b53e1b8e391e2f7439dd52d80 (patch)
tree0784d0eff9d969d15973d90bfc031b9221eabcc3
parente475885477784963005d0b81bdc96f96002e07b4 (diff)
version 0.12.20.12.2
-rw-r--r--CONTRIBUTORS.md1
-rw-r--r--LICENSE1816
-rw-r--r--app/Command/Docs/Html.hs11
-rw-r--r--app/Command/REPL.hs37
-rw-r--r--purescript.cabal17
-rw-r--r--src/Language/PureScript/AST/Binders.hs2
-rw-r--r--src/Language/PureScript/AST/Declarations.hs104
-rw-r--r--src/Language/PureScript/AST/Exported.hs4
-rw-r--r--src/Language/PureScript/AST/SourcePos.hs41
-rw-r--r--src/Language/PureScript/AST/Traversals.hs36
-rw-r--r--src/Language/PureScript/CodeGen/JS.hs6
-rw-r--r--src/Language/PureScript/CodeGen/JS/Common.hs37
-rw-r--r--src/Language/PureScript/CodeGen/JS/Printer.hs4
-rw-r--r--src/Language/PureScript/Comments.hs7
-rw-r--r--src/Language/PureScript/Constants.hs19
-rw-r--r--src/Language/PureScript/CoreFn/Ann.hs50
-rw-r--r--src/Language/PureScript/CoreFn/Desugar.hs8
-rw-r--r--src/Language/PureScript/CoreFn/Optimizer.hs21
-rw-r--r--src/Language/PureScript/Docs/AsHtml.hs36
-rw-r--r--src/Language/PureScript/Docs/AsMarkdown.hs11
-rw-r--r--src/Language/PureScript/Docs/Convert.hs3
-rw-r--r--src/Language/PureScript/Docs/Convert/ReExports.hs16
-rw-r--r--src/Language/PureScript/Docs/Convert/Single.hs26
-rw-r--r--src/Language/PureScript/Docs/Prim.hs50
-rw-r--r--src/Language/PureScript/Docs/Render.hs65
-rw-r--r--src/Language/PureScript/Docs/RenderedCode/RenderKind.hs21
-rw-r--r--src/Language/PureScript/Docs/RenderedCode/RenderType.hs148
-rw-r--r--src/Language/PureScript/Docs/Types.hs64
-rw-r--r--src/Language/PureScript/Environment.hs159
-rw-r--r--src/Language/PureScript/Errors.hs82
-rw-r--r--src/Language/PureScript/Externs.hs30
-rw-r--r--src/Language/PureScript/Hierarchy.hs2
-rw-r--r--src/Language/PureScript/Ide/CaseSplit.hs26
-rw-r--r--src/Language/PureScript/Ide/Error.hs4
-rw-r--r--src/Language/PureScript/Ide/Externs.hs2
-rw-r--r--src/Language/PureScript/Ide/Prim.hs7
-rw-r--r--src/Language/PureScript/Ide/SourceFile.hs2
-rw-r--r--src/Language/PureScript/Ide/Types.hs26
-rw-r--r--src/Language/PureScript/Interactive.hs45
-rw-r--r--src/Language/PureScript/Interactive/Directive.hs13
-rw-r--r--src/Language/PureScript/Interactive/Module.hs14
-rw-r--r--src/Language/PureScript/Interactive/Parser.hs19
-rw-r--r--src/Language/PureScript/Interactive/Printer.hs18
-rw-r--r--src/Language/PureScript/Interactive/Types.hs59
-rw-r--r--src/Language/PureScript/Kinds.hs204
-rw-r--r--src/Language/PureScript/Linter.hs53
-rw-r--r--src/Language/PureScript/Linter/Exhaustive.hs18
-rw-r--r--src/Language/PureScript/Parser/Declarations.hs19
-rw-r--r--src/Language/PureScript/Parser/Kinds.hs26
-rw-r--r--src/Language/PureScript/Parser/Lexer.hs13
-rw-r--r--src/Language/PureScript/Parser/Types.hs112
-rw-r--r--src/Language/PureScript/Pretty/Common.hs9
-rw-r--r--src/Language/PureScript/Pretty/Kinds.hs20
-rw-r--r--src/Language/PureScript/Pretty/Types.hs181
-rw-r--r--src/Language/PureScript/Pretty/Values.hs11
-rw-r--r--src/Language/PureScript/Sugar/AdoNotation.hs18
-rw-r--r--src/Language/PureScript/Sugar/BindingGroups.hs8
-rw-r--r--src/Language/PureScript/Sugar/DoNotation.hs46
-rw-r--r--src/Language/PureScript/Sugar/Names.hs32
-rw-r--r--src/Language/PureScript/Sugar/Names/Env.hs9
-rw-r--r--src/Language/PureScript/Sugar/Operators.hs20
-rw-r--r--src/Language/PureScript/Sugar/Operators/Types.hs18
-rw-r--r--src/Language/PureScript/Sugar/TypeClasses.hs47
-rw-r--r--src/Language/PureScript/Sugar/TypeClasses/Deriving.hs124
-rw-r--r--src/Language/PureScript/TypeChecker.hs167
-rw-r--r--src/Language/PureScript/TypeChecker/Entailment.hs268
-rw-r--r--src/Language/PureScript/TypeChecker/Kinds.hs187
-rw-r--r--src/Language/PureScript/TypeChecker/Monad.hs36
-rw-r--r--src/Language/PureScript/TypeChecker/Skolems.hs34
-rw-r--r--src/Language/PureScript/TypeChecker/Subsumption.hs36
-rw-r--r--src/Language/PureScript/TypeChecker/Synonyms.hs20
-rw-r--r--src/Language/PureScript/TypeChecker/TypeSearch.hs27
-rw-r--r--src/Language/PureScript/TypeChecker/Types.hs191
-rw-r--r--src/Language/PureScript/TypeChecker/Unify.hs117
-rw-r--r--src/Language/PureScript/TypeClassDictionaries.hs4
-rw-r--r--src/Language/PureScript/Types.hs628
-rw-r--r--tests/Language/PureScript/Ide/MatcherSpec.hs2
-rw-r--r--tests/Language/PureScript/Ide/SourceFileSpec.hs10
-rw-r--r--tests/Language/PureScript/Ide/StateSpec.hs10
-rw-r--r--tests/Language/PureScript/Ide/Test.hs16
-rw-r--r--tests/Main.hs4
-rw-r--r--tests/TestDocs.hs18
-rw-r--r--tests/TestHierarchy.hs2
-rw-r--r--tests/TestPrimDocs.hs1
-rw-r--r--tests/TestPscPublish.hs64
-rw-r--r--tests/TestPsci/CommandTest.hs15
-rw-r--r--tests/TestPsci/CompletionTest.hs4
-rw-r--r--tests/TestPsci/TestEnv.hs5
-rw-r--r--tests/json-compat/v0.11.3/generics-4.0.0.json1
-rw-r--r--tests/json-compat/v0.11.3/symbols-3.0.0.json1
-rw-r--r--tests/json-compat/v0.12.1/typelevel-prelude-3.0.0.json1
-rw-r--r--tests/purs/failing/TypedHole2.purs8
-rw-r--r--tests/purs/passing/3481.purs7
-rw-r--r--tests/purs/passing/InheritMultipleSuperClasses.purs25
-rw-r--r--tests/purs/passing/PartialTCO.purs13
-rw-r--r--tests/purs/passing/QualifiedAdo.purs19
-rw-r--r--tests/purs/passing/QualifiedAdo/IxApplicative.purs8
-rw-r--r--tests/purs/passing/QualifiedDo.purs19
-rw-r--r--tests/purs/passing/QualifiedDo/IxMonad.purs5
-rw-r--r--tests/purs/psci/Multiline.purs2
-rw-r--r--tests/purs/warning/WildcardInferredType.purs9
-rw-r--r--tests/purs/warning/WildcardInferredType2.purs14
-rw-r--r--tests/support/psci/InteractivePrint.purs11
103 files changed, 3298 insertions, 2868 deletions
diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md
index 17b6b5a..30b7de3 100644
--- a/CONTRIBUTORS.md
+++ b/CONTRIBUTORS.md
@@ -127,6 +127,7 @@ If you would prefer to use different terms, please use the section below instead
| [@rgrinberg](https://github.com/rgrinberg) | Rudi Grinberg | [MIT license](http://opensource.org/licenses/MIT) |
| [@gabejohnson](https://github.com/gabejohnson) | Gabe Johnson | [MIT license](http://opensource.org/licenses/MIT) |
| [@dariooddenino](https://github.com/dariooddenino) | Dario Oddenino | [MIT license](http://opensource.org/licenses/MIT) |
+| [@jordanmartinez](https://github.com/jordanmartinez) | Jordan Martinez | [MIT license](http://opensource.org/licenses/MIT) |
### Contributors using Modified Terms
diff --git a/LICENSE b/LICENSE
index b25d9b3..a29686d 100644
--- a/LICENSE
+++ b/LICENSE
@@ -14,20 +14,15 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
PureScript uses the following Haskell library packages. Their license files follow.
+ Cabal
Glob
SHA
- StateVar
- adjunctions
aeson
aeson-better-errors
- aeson-pretty
ansi-terminal
ansi-wl-pprint
appar
array
- asn1-encoding
- asn1-parse
- asn1-types
async
attoparsec
auto-update
@@ -35,14 +30,14 @@ PureScript uses the following Haskell library packages. Their license files foll
base-compat
base-orphans
base64-bytestring
- bifunctors
+ basement
binary
blaze-builder
blaze-html
blaze-markup
bower-json
boxes
- byteable
+ bsb-http-chunked
byteorder
bytestring
bytestring-builder
@@ -50,61 +45,57 @@ PureScript uses the following Haskell library packages. Their license files foll
cereal
cheapskate
clock
- cmdargs
- comonad
+ colour
conduit
conduit-extra
- connection
containers
- contravariant
cookie
cryptonite
css-text
data-default
data-default-class
- data-default-instances-base
data-default-instances-containers
data-default-instances-dlist
data-default-instances-old-locale
data-ordlist
deepseq
directory
- distributive
dlist
easy-file
edit-distance
entropy
exceptions
- fail
fast-logger
file-embed
filepath
- free
+ foundation
fsnotify
+ ghc-boot-th
ghc-prim
hashable
haskeline
- hex
- hinotify
- hourglass
- http-client
- http-client-tls
+ hfsevents
http-date
http-types
http2
integer-gmp
+ integer-logarithms
iproute
- kan-extensions
language-javascript
- lens
lifted-base
memory
+ microlens
+ microlens-ghc
+ microlens-mtl
+ microlens-platform
+ microlens-th
mime-types
- mmorph
monad-control
monad-logger
monad-loops
+ mono-traversable
mtl
+ mtl-compat
network
network-uri
old-locale
@@ -113,28 +104,21 @@ PureScript uses the following Haskell library packages. Their license files foll
parallel
parsec
pattern-arrows
- pem
- pipes
- pipes-http
- prelude-extras
+ pretty
primitive
process
- profunctors
protolude
psqueues
random
- reflection
regex-base
regex-tdfa
resourcet
+ rts
safe
scientific
- semigroupoids
semigroups
simple-sendfile
- socks
sourcemap
- spdx
split
stm
stm-chans
@@ -146,19 +130,24 @@ PureScript uses the following Haskell library packages. Their license files foll
template-haskell
terminfo
text
+ th-abstraction
time
- tls
+ time-locale-compat
transformers
transformers-base
transformers-compat
+ typed-process
uniplate
unix
unix-compat
unix-time
+ unliftio-core
unordered-containers
utf8-string
+ uuid-types
vault
vector
+ vector-algorithms
void
wai
wai-app-static
@@ -168,20 +157,50 @@ PureScript uses the following Haskell library packages. Their license files foll
warp
websockets
word8
- x509
- x509-store
- x509-system
- x509-validation
xss-sanitize
zlib
+Cabal LICENSE file:
+
+ Copyright (c) 2003-2017, Cabal Development Team.
+ See the AUTHORS file for the full list of copyright holders.
+ 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 Isaac Jones 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.
+
Glob LICENSE file:
The code in Glob is released under the license below. Copyrights to parts of
the code are held by whoever wrote the code in question: see CREDITS.txt for a
list of authors.
- Copyright (c) 2008-2016 <authors>
+ Copyright (c) 2008-2018 <authors>
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -238,67 +257,6 @@ SHA LICENSE file:
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-StateVar LICENSE file:
-
- Copyright (c) 2014-2015, Edward Kmett
- Copyright (c) 2009-2016, Sven Panne
- 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 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.
-
-adjunctions LICENSE file:
-
- Copyright 2011-2014 Edward Kmett
-
- 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.
-
- 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.
-
aeson LICENSE file:
Copyright (c) 2011, MailRank, Inc.
@@ -355,39 +313,6 @@ aeson-better-errors LICENSE file:
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-aeson-pretty LICENSE file:
-
- Copyright (c)2011, Falko Peters
-
- 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 Falko Peters 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.
-
ansi-terminal LICENSE file:
Copyright (c) 2008, Maximilian Bolingbroke
@@ -559,96 +484,6 @@ 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
@@ -826,7 +661,7 @@ base LICENSE file:
base-compat LICENSE file:
- Copyright (c) 2012-2016 Simon Hengel <sol@typeful.net> and Ryan Scott <ryan.gl.scott@gmail.com>
+ Copyright (c) 2012-2018 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
@@ -848,7 +683,7 @@ base-compat LICENSE file:
base-orphans LICENSE file:
- Copyright (c) 2015-2016 Simon Hengel <sol@typeful.net>, João Cristóvão <jmacristovao@gmail.com>, Ryan Scott <ryan.gl.scott@gmail.com>
+ Copyright (c) 2015-2017 Simon Hengel <sol@typeful.net>, João Cristóvão <jmacristovao@gmail.com>, 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
@@ -902,34 +737,36 @@ base64-bytestring LICENSE file:
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-bifunctors LICENSE file:
+basement LICENSE file:
- Copyright 2008-2016 Edward Kmett
+ Copyright (c) 2015-2017 Vincent Hanquez <vincent@snarc.org>
+ Copyright (c) 2017 Foundation Maintainers
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
+ 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.
+ 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:
@@ -1116,35 +953,38 @@ boxes LICENSE file:
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
-byteable LICENSE file:
+bsb-http-chunked LICENSE file:
- Copyright (c) 2013 Vincent Hanquez <vincent@snarc.org>
+ Copyright Jasper Van der Jeugt 2010, Simon Meier 2010 & 2011
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.
+ modification, are permitted provided that the following conditions are met:
- 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.
+ * 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.
byteorder LICENSE file:
@@ -1380,68 +1220,28 @@ clock 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.
-cmdargs LICENSE file:
-
- Copyright Neil Mitchell 2009-2016.
- 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 Neil Mitchell 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.
-
-comonad LICENSE file:
+colour LICENSE file:
- Copyright 2008-2014 Edward Kmett
- Copyright 2004-2008 Dave Menendez
+ Copyright (c) 2008, 2009
+ Russell O'Connor
- 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.
+ 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:
- 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.
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
- 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.
+ 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 LICENSE file:
@@ -1489,36 +1289,6 @@ conduit-extra LICENSE file:
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
@@ -1553,39 +1323,6 @@ containers LICENSE file:
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
-contravariant LICENSE file:
-
- Copyright 2007-2015 Edward Kmett
-
- 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.
-
cookie LICENSE file:
Copyright (c) 2010 Michael Snoyman, http://www.yesodweb.com/
@@ -1642,31 +1379,26 @@ cryptonite LICENSE file:
css-text 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:
+ Copyright (c) 2010 Michael Snoyman, http://www.yesodweb.com/
- * Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
+ 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:
- * 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 above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
- 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.
+ 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.
data-default LICENSE file:
@@ -1715,35 +1447,6 @@ data-default-class LICENSE file:
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.
-
-data-default-instances-base 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 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
@@ -1963,38 +1666,9 @@ directory LICENSE file:
-----------------------------------------------------------------------------
-distributive LICENSE file:
-
- Copyright 2011-2016 Edward Kmett
-
- 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.
-
- 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.
-
dlist LICENSE file:
- Copyright (c) 2006-2009 Don Stewart, 2013-2014 Sean Leather
+ Copyright (c) 2006-2009 Don Stewart, 2013-2016 Sean Leather
All rights reserved.
@@ -2150,39 +1824,6 @@ exceptions LICENSE file:
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-fail LICENSE file:
-
- Copyright (c) 2015, David Luposchainsky & Herbert Valerio Riedel
-
- 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 Herbert Valerio Riedel 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.
-
fast-logger LICENSE file:
Copyright (c) 2009, IIJ Innovation Institute Inc.
@@ -2245,7 +1886,7 @@ file-embed LICENSE file:
filepath LICENSE file:
- Copyright Neil Mitchell 2005-2015.
+ Copyright Neil Mitchell 2005-2018.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -2276,38 +1917,36 @@ 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.
-free LICENSE file:
+foundation LICENSE file:
- Copyright 2008-2013 Edward Kmett
+ Copyright (c) 2015-2017 Vincent Hanquez <vincent@snarc.org>
+ Copyright (c) 2017-2018 Foundation Maintainers
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
+ 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.
+ 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.
fsnotify LICENSE file:
@@ -2342,6 +1981,40 @@ fsnotify 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.
+ghc-boot-th LICENSE file:
+
+ The Glasgow Haskell Compiler License
+
+ Copyright 2002, The University Court of the University of Glasgow.
+ 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.
+
ghc-prim LICENSE file:
This library (libraries/ghc-prim) is derived from code from several
@@ -2466,146 +2139,38 @@ 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.
-hex LICENSE file:
+hfsevents LICENSE file:
+
+ Copyright (c) 2012, Luite Stegeman
- Copyright (c) 2008, Taru Karttunen
All rights reserved.
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:
- 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.
- 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.
- Neither the name of the Taru Karttunen; nor the names of its contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
+ * Neither the name of Luite Stegeman 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.
-
-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.
+ 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.
http-date LICENSE file:
@@ -2738,6 +2303,25 @@ integer-gmp 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.
+integer-logarithms LICENSE file:
+
+ Copyright (c) 2011 Daniel Fischer, 2017 Oleg Grenrus
+
+ 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.
+
iproute LICENSE file:
Copyright (c) 2009, IIJ Innovation Institute Inc.
@@ -2770,39 +2354,6 @@ iproute LICENSE file:
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-kan-extensions LICENSE file:
-
- Copyright 2008-2013 Edward Kmett
-
- 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.
-
language-javascript LICENSE file:
Copyright (c)2010, Alan Zimmerman
@@ -2836,39 +2387,6 @@ language-javascript 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.
-lens LICENSE file:
-
- Copyright 2012-2015 Edward Kmett
-
- 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.
-
lifted-base LICENSE file:
Copyright © 2010-2012, Bas van Dijk, Anders Kaseorg
@@ -2932,6 +2450,175 @@ memory LICENSE file:
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
+microlens LICENSE file:
+
+ Copyright (c) 2013-2016 Edward Kmett,
+ 2015-2016 Artyom
+
+ 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 Artyom 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.
+
+microlens-ghc LICENSE file:
+
+ Copyright (c) 2013-2016 Edward Kmett,
+ 2015-2016 Artyom
+
+ 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 Artyom 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.
+
+microlens-mtl LICENSE file:
+
+ Copyright (c) 2013-2016 Edward Kmett,
+ 2015-2016 Artyom
+
+ 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 Artyom 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.
+
+microlens-platform LICENSE file:
+
+ Copyright (c) 2012-2016 Edward Kmett,
+ 2015-2016 Artyom
+
+ 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 Artyom 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.
+
+microlens-th LICENSE file:
+
+ Copyright (c) 2013-2016 Eric Mertens, Edward Kmett, Artyom
+
+ 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 Artyom 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.
+
mime-types LICENSE file:
Copyright (c) 2012 Michael Snoyman, http://www.yesodweb.com/
@@ -2955,34 +2642,6 @@ mime-types LICENSE file:
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
@@ -3038,6 +2697,29 @@ monad-logger LICENSE file:
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+mono-traversable LICENSE file:
+
+ Copyright (c) 2013 Michael Snoyman, http://www.fpcomplete.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.
+
mtl LICENSE file:
The Glasgow Haskell Compiler License
@@ -3072,6 +2754,39 @@ mtl LICENSE file:
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
+mtl-compat LICENSE file:
+
+ Copyright (c) 2015, Ryan Scott
+
+ 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 Ryan Scott 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.
+
network LICENSE file:
Copyright (c) 2002-2010, The University Court of the University of Glasgow.
@@ -3390,122 +3105,47 @@ 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.
-pem LICENSE file:
+pretty LICENSE file:
- Copyright (c) 2010-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.
-
-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) 2016 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.
+ 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).
-prelude-extras LICENSE file:
+ -----------------------------------------------------------------------------
- Copyright 2011-2016 Edward Kmett
+ The Glasgow Haskell Compiler License
+ Copyright 2004, The University Court of the University of Glasgow.
All rights reserved.
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.
+
+ -----------------------------------------------------------------------------
primitive LICENSE file:
@@ -3606,42 +3246,9 @@ process LICENSE file:
-----------------------------------------------------------------------------
-profunctors LICENSE file:
-
- Copyright 2011-2015 Edward Kmett
-
- 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.
-
protolude LICENSE file:
- Copyright (c) 2016, Stephen Diehl
+ Copyright (c) 2016-2017, Stephen Diehl
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
@@ -3761,40 +3368,6 @@ random LICENSE file:
-----------------------------------------------------------------------------
-reflection LICENSE file:
-
- Copyright (c) 2009-2013 Edward Kmett
- Copyright (c) 2004 Oleg Kiselyov and Chung-chieh Shan
- 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 Edward Kmett 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.
-
regex-base LICENSE file:
This modile is under this "3 clause" BSD license:
@@ -3860,7 +3433,7 @@ resourcet LICENSE file:
safe LICENSE file:
- Copyright Neil Mitchell 2007-2016.
+ Copyright Neil Mitchell 2007-2018.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -3924,35 +3497,6 @@ scientific 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.
-semigroupoids LICENSE file:
-
- Copyright 2011-2015 Edward Kmett
-
- 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.
-
- 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.
-
semigroups LICENSE file:
Copyright 2011-2015 Edward Kmett
@@ -4014,36 +3558,6 @@ simple-sendfile 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
@@ -4077,39 +3591,6 @@ 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
@@ -4390,7 +3871,7 @@ tagged LICENSE file:
tagsoup LICENSE file:
- Copyright Neil Mitchell 2006-2016.
+ Copyright Neil Mitchell 2006-2018.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -4512,6 +3993,22 @@ text 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.
+th-abstraction LICENSE file:
+
+ Copyright (c) 2017 Eric Mertens
+
+ Permission to use, copy, modify, and/or distribute this software for any purpose
+ with or without fee is hereby granted, provided that the above copyright notice
+ and this permission notice appear in all copies.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+ THIS SOFTWARE.
+
time LICENSE file:
TimeLib is Copyright (c) Ashley Yakeley, 2004-2014. All rights reserved.
@@ -4525,35 +4022,38 @@ 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:
+time-locale-compat LICENSE file:
- Copyright (c) 2010-2015 Vincent Hanquez <vincent@snarc.org>
+ Copyright (c) 2014, Kei Hibino
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.
+ modification, are permitted provided that the following conditions are met:
- 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.
+ * 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 Kei Hibino 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.
transformers LICENSE file:
@@ -4621,7 +4121,7 @@ transformers-base LICENSE file:
transformers-compat LICENSE file:
- Copyright 2012 Edward Kmett
+ Copyright 2012-2015 Edward Kmett
All rights reserved.
@@ -4652,6 +4152,29 @@ transformers-compat LICENSE file:
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
+typed-process LICENSE file:
+
+ Copyright (c) 2016 FP Complete, https://www.fpcomplete.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.
+
uniplate LICENSE file:
Copyright Neil Mitchell 2006-2013.
@@ -4783,6 +4306,29 @@ unix-time LICENSE file:
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
+unliftio-core LICENSE file:
+
+ Copyright (c) 2017 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.
+
unordered-containers LICENSE file:
Copyright (c) 2010, Johan Tibell
@@ -4843,6 +4389,37 @@ utf8-string 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.
+uuid-types LICENSE file:
+
+ Copyright (c) 2008, Antoine Latter
+
+ 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 authors 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.
+
vault LICENSE file:
Copyright (c)2011, Heinrich Apfelmus
@@ -4909,6 +4486,75 @@ vector LICENSE file:
DAMAGE.
+vector-algorithms LICENSE file:
+
+ Copyright (c) 2015 Dan Doel
+ Copyright (c) 2015 Tim Baumann
+
+ 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.
+
+ ------------------------------------------------------------------------------
+
+ The code in Data.Array.Vector.Algorithms.Mutable.Optimal is adapted from a C
+ algorithm for the same purpose. The folowing is the copyright notice for said
+ C code:
+
+ Copyright (c) 2004 Paul Hsieh
+ 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 sorttest 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.
+
void LICENSE file:
Copyright 2015 Edward Kmett
@@ -5154,126 +4800,6 @@ word8 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.
-
xss-sanitize LICENSE file:
The following license covers this documentation, and the source code, except
diff --git a/app/Command/Docs/Html.hs b/app/Command/Docs/Html.hs
index 0352fce..1e4a176 100644
--- a/app/Command/Docs/Html.hs
+++ b/app/Command/Docs/Html.hs
@@ -48,8 +48,7 @@ writeHtmlFile filepath =
getHtmlRenderContext :: P.ModuleName -> D.HtmlRenderContext
getHtmlRenderContext mn = D.HtmlRenderContext
- { D.currentModuleName = mn
- , D.buildDocLink = getLink mn
+ { D.buildDocLink = getLink mn
, D.renderDocLink = renderLink
, D.renderSourceLink = const Nothing
}
@@ -70,11 +69,11 @@ getLink curMn namespace target containingMod = do
normalLinkLocation = do
case containingMod of
D.ThisModule ->
- return D.SameModule
+ return $ D.LocalModule curMn
D.OtherModule destMn ->
-- This is OK because all modules count as 'local' for purs docs in
-- html mode
- return $ D.LocalModule curMn destMn
+ return $ D.LocalModule destMn
builtinLinkLocation = do
let primMn = P.moduleNameFromString "Prim"
@@ -84,9 +83,7 @@ getLink curMn namespace target containingMod = do
renderLink :: D.DocLink -> Text
renderLink l =
case D.linkLocation l of
- D.SameModule ->
- ""
- D.LocalModule _ dest ->
+ D.LocalModule dest ->
P.runModuleName dest <> ".html"
D.DepsModule{} ->
P.internalError "DepsModule: not implemented"
diff --git a/app/Command/REPL.hs b/app/Command/REPL.hs
index c2ddb69..df9a66e 100644
--- a/app/Command/REPL.hs
+++ b/app/Command/REPL.hs
@@ -96,15 +96,15 @@ psciOptions = PSCiOptions <$> many inputFile
<*> backend
-- | Parses the input and returns either a command, or an error as a 'String'.
-getCommand :: forall m. MonadException m => InputT m (Either String (Maybe Command))
-getCommand = handleInterrupt (return (Right Nothing)) $ do
+getCommand :: forall m. MonadException m => InputT m (Either String [Command])
+getCommand = handleInterrupt (return (Right [])) $ do
line <- withInterrupt $ getInputLine "> "
case line of
- Nothing -> return (Right (Just QuitPSCi)) -- Ctrl-D when input is empty
- Just "" -> return (Right Nothing)
- Just s -> return . fmap Just $ parseCommand s
+ Nothing -> return (Right [QuitPSCi]) -- Ctrl-D when input is empty
+ Just "" -> return (Right [])
+ Just s -> return (parseCommand s)
-pasteMode :: forall m. MonadException m => InputT m (Either String Command)
+pasteMode :: forall m. MonadException m => InputT m (Either String [Command])
pasteMode =
parseCommand <$> go []
where
@@ -292,7 +292,7 @@ nodeBackend nodePath nodeArgs = Backend setup eval reload shutdown
case result of
Just (ExitSuccess, out, _) -> putStrLn out
Just (ExitFailure _, _, err) -> putStrLn err
- Nothing -> putStrLn "Couldn't find node.js"
+ Nothing -> putStrLn "Could not find node.js. Do you have node.js installed and available in your PATH?"
reload :: () -> IO ()
reload _ = return ()
@@ -343,16 +343,20 @@ command = loop <$> options
c <- getCommand
case c of
Left err -> outputStrLn err >> go state
- Right Nothing -> go state
- Right (Just PasteLines) -> do
+ Right xs -> goExec xs
+ where
+ goExec :: [Command] -> InputT (StateT PSCiState (ReaderT PSCiConfig IO)) ()
+ goExec xs = case xs of
+ [] -> go state
+ (PasteLines : rest) -> do
c' <- pasteMode
case c' of
- Left err -> outputStrLn err >> go state
- Right c'' -> handleCommandWithInterrupts state c''
- Right (Just QuitPSCi) -> do
+ Left err -> outputStrLn err >> goExec rest
+ Right c'' -> handleCommandWithInterrupts state c'' >> goExec rest
+ (QuitPSCi : _) -> do
outputStrLn quitMessage
liftIO $ shutdown state
- Right (Just c') -> handleCommandWithInterrupts state c'
+ (c' : rest) -> handleCommandWithInterrupts state [c'] >> goExec rest
loadUserConfig :: state -> StateT PSCiState (ReaderT PSCiConfig IO) ()
loadUserConfig state = do
@@ -366,12 +370,11 @@ command = loop <$> options
handleCommandWithInterrupts
:: state
- -> Command
+ -> [Command]
-> InputT (StateT PSCiState (ReaderT PSCiConfig IO)) ()
- handleCommandWithInterrupts state cmd = do
+ handleCommandWithInterrupts state cmds = do
handleInterrupt (outputStrLn "Interrupted.")
- (withInterrupt (lift (handleCommand' state cmd)))
- go state
+ (withInterrupt (lift (for_ cmds (handleCommand' state))))
putStrLn prologueMessage
backendState <- setup
diff --git a/purescript.cabal b/purescript.cabal
index d1bf5fc..22da6ea 100644
--- a/purescript.cabal
+++ b/purescript.cabal
@@ -2,10 +2,10 @@
--
-- see: https://github.com/sol/hpack
--
--- hash: 628bcaed9683521da81533454c6e643bda4bea5445007164d4783767f98f0173
+-- hash: 41d1259da9e21e4b7e604e45d306d0a5b69939ff6ef1dc59b410a7d51ea3f7f9
name: purescript
-version: 0.12.1
+version: 0.12.2
synopsis: PureScript Programming Language Compiler
description: A small strongly, statically typed programming language with expressive types, inspired by Haskell and compiling to JavaScript.
category: Language
@@ -31,6 +31,9 @@ extra-source-files:
INSTALL.md
README.md
stack.yaml
+ tests/json-compat/v0.11.3/generics-4.0.0.json
+ tests/json-compat/v0.11.3/symbols-3.0.0.json
+ tests/json-compat/v0.12.1/typelevel-prelude-3.0.0.json
tests/purs/docs/bower.json
tests/purs/docs/bower_components/purescript-prelude/src/Prelude.purs
tests/purs/docs/output/ConstrainedArgument/externs.json
@@ -310,6 +313,7 @@ extra-source-files:
tests/purs/failing/TypedBinders2.purs
tests/purs/failing/TypedBinders3.purs
tests/purs/failing/TypedHole.purs
+ tests/purs/failing/TypedHole2.purs
tests/purs/failing/TypeError.purs
tests/purs/failing/TypeOperatorAliasNoExport.purs
tests/purs/failing/TypeSynonyms.purs
@@ -369,6 +373,7 @@ extra-source-files:
tests/purs/passing/3187-UnusedNameClash.purs
tests/purs/passing/3388.purs
tests/purs/passing/3410.purs
+ tests/purs/passing/3481.purs
tests/purs/passing/652.purs
tests/purs/passing/810.purs
tests/purs/passing/862.purs
@@ -463,6 +468,7 @@ extra-source-files:
tests/purs/passing/ImportQualified.purs
tests/purs/passing/ImportQualified/M1.purs
tests/purs/passing/InferRecFunWithConstrainedArgument.purs
+ tests/purs/passing/InheritMultipleSuperClasses.purs
tests/purs/passing/InstanceBeforeClass.purs
tests/purs/passing/InstanceChain.purs
tests/purs/passing/InstanceSigs.purs
@@ -549,6 +555,7 @@ extra-source-files:
tests/purs/passing/ParensInType.purs
tests/purs/passing/ParensInTypedBinder.purs
tests/purs/passing/PartialFunction.purs
+ tests/purs/passing/PartialTCO.purs
tests/purs/passing/Patterns.purs
tests/purs/passing/PendingConflictingImports.purs
tests/purs/passing/PendingConflictingImports/A.purs
@@ -559,6 +566,10 @@ extra-source-files:
tests/purs/passing/PolyLabels.js
tests/purs/passing/PolyLabels.purs
tests/purs/passing/PrimedTypeName.purs
+ tests/purs/passing/QualifiedAdo.purs
+ tests/purs/passing/QualifiedAdo/IxApplicative.purs
+ tests/purs/passing/QualifiedDo.purs
+ tests/purs/passing/QualifiedDo/IxMonad.purs
tests/purs/passing/QualifiedNames.purs
tests/purs/passing/QualifiedNames/Either.purs
tests/purs/passing/QualifiedQualifiedImports.purs
@@ -696,9 +707,11 @@ extra-source-files:
tests/purs/warning/UnusedImport.purs
tests/purs/warning/UnusedTypeVar.purs
tests/purs/warning/WildcardInferredType.purs
+ tests/purs/warning/WildcardInferredType2.purs
tests/support/bower.json
tests/support/package.json
tests/support/prelude-resolutions.json
+ tests/support/psci/InteractivePrint.purs
tests/support/psci/Reload.edit
tests/support/psci/Reload.purs
tests/support/pscide/src/CompletionSpecDocs.purs
diff --git a/src/Language/PureScript/AST/Binders.hs b/src/Language/PureScript/AST/Binders.hs
index 19e1d18..528ffb0 100644
--- a/src/Language/PureScript/AST/Binders.hs
+++ b/src/Language/PureScript/AST/Binders.hs
@@ -60,7 +60,7 @@ data Binder
-- |
-- A binder with a type annotation
--
- | TypedBinder Type Binder
+ | TypedBinder SourceType Binder
deriving (Show)
-- Manual Eq and Ord instances for `Binder` were added on 2018-03-05. Comparing
diff --git a/src/Language/PureScript/AST/Declarations.hs b/src/Language/PureScript/AST/Declarations.hs
index 2725f5d..8dab6de 100644
--- a/src/Language/PureScript/AST/Declarations.hs
+++ b/src/Language/PureScript/AST/Declarations.hs
@@ -39,16 +39,16 @@ import qualified Language.PureScript.Constants as C
import qualified Text.Parsec as P
-- | A map of locally-bound names in scope.
-type Context = [(Ident, Type)]
+type Context = [(Ident, SourceType)]
-- | Holds the data necessary to do type directed search for typed holes
data TypeSearch
= TSBefore Environment
-- ^ An Environment captured for later consumption by type directed search
| TSAfter
- { tsAfterIdentifiers :: [(Qualified Text, Type)]
+ { tsAfterIdentifiers :: [(Qualified Text, SourceType)]
-- ^ The identifiers that fully satisfy the subsumption check
- , tsAfterRecordFields :: Maybe [(Label, Type)]
+ , tsAfterRecordFields :: Maybe [(Label, SourceType)]
-- ^ Record fields that are available on the first argument to the typed
-- hole
}
@@ -56,10 +56,10 @@ data TypeSearch
-- Environment
deriving Show
-onTypeSearchTypes :: (Type -> Type) -> TypeSearch -> TypeSearch
+onTypeSearchTypes :: (SourceType -> SourceType) -> TypeSearch -> TypeSearch
onTypeSearchTypes f = runIdentity . onTypeSearchTypesM (Identity . f)
-onTypeSearchTypesM :: (Applicative m) => (Type -> m Type) -> TypeSearch -> m TypeSearch
+onTypeSearchTypesM :: (Applicative m) => (SourceType -> m SourceType) -> TypeSearch -> m TypeSearch
onTypeSearchTypesM f (TSAfter i r) = TSAfter <$> traverse (traverse f) i <*> traverse (traverse (traverse f)) r
onTypeSearchTypesM _ (TSBefore env) = pure (TSBefore env)
@@ -76,8 +76,8 @@ data SimpleErrorMessage
| CannotGetFileInfo FilePath
| CannotReadFile FilePath
| CannotWriteFile FilePath
- | InfiniteType Type
- | InfiniteKind Kind
+ | InfiniteType SourceType
+ | InfiniteKind SourceKind
| MultipleValueOpFixities (OpName 'ValueOpName)
| MultipleTypeOpFixities (OpName 'TypeOpName)
| OrphanTypeDeclaration Ident
@@ -104,46 +104,46 @@ data SimpleErrorMessage
| NameIsUndefined Ident
| UndefinedTypeVariable (ProperName 'TypeName)
| PartiallyAppliedSynonym (Qualified (ProperName 'TypeName))
- | EscapedSkolem Text (Maybe SourceSpan) Type
- | TypesDoNotUnify Type Type
- | KindsDoNotUnify Kind Kind
- | ConstrainedTypeUnified Type Type
- | OverlappingInstances (Qualified (ProperName 'ClassName)) [Type] [Qualified Ident]
- | NoInstanceFound Constraint
- | AmbiguousTypeVariables Type Constraint
+ | EscapedSkolem Text (Maybe SourceSpan) SourceType
+ | TypesDoNotUnify SourceType SourceType
+ | KindsDoNotUnify SourceKind SourceKind
+ | ConstrainedTypeUnified SourceType SourceType
+ | OverlappingInstances (Qualified (ProperName 'ClassName)) [SourceType] [Qualified Ident]
+ | NoInstanceFound SourceConstraint
+ | AmbiguousTypeVariables SourceType SourceConstraint
| UnknownClass (Qualified (ProperName 'ClassName))
- | PossiblyInfiniteInstance (Qualified (ProperName 'ClassName)) [Type]
- | CannotDerive (Qualified (ProperName 'ClassName)) [Type]
- | InvalidDerivedInstance (Qualified (ProperName 'ClassName)) [Type] Int
- | ExpectedTypeConstructor (Qualified (ProperName 'ClassName)) [Type] Type
- | InvalidNewtypeInstance (Qualified (ProperName 'ClassName)) [Type]
- | MissingNewtypeSuperclassInstance (Qualified (ProperName 'ClassName)) (Qualified (ProperName 'ClassName)) [Type]
- | UnverifiableSuperclassInstance (Qualified (ProperName 'ClassName)) (Qualified (ProperName 'ClassName)) [Type]
+ | PossiblyInfiniteInstance (Qualified (ProperName 'ClassName)) [SourceType]
+ | CannotDerive (Qualified (ProperName 'ClassName)) [SourceType]
+ | InvalidDerivedInstance (Qualified (ProperName 'ClassName)) [SourceType] Int
+ | ExpectedTypeConstructor (Qualified (ProperName 'ClassName)) [SourceType] SourceType
+ | InvalidNewtypeInstance (Qualified (ProperName 'ClassName)) [SourceType]
+ | MissingNewtypeSuperclassInstance (Qualified (ProperName 'ClassName)) (Qualified (ProperName 'ClassName)) [SourceType]
+ | UnverifiableSuperclassInstance (Qualified (ProperName 'ClassName)) (Qualified (ProperName 'ClassName)) [SourceType]
| CannotFindDerivingType (ProperName 'TypeName)
| DuplicateLabel Label (Maybe Expr)
| DuplicateValueDeclaration Ident
| ArgListLengthsDiffer Ident
| OverlappingArgNames (Maybe Ident)
- | MissingClassMember (NEL.NonEmpty (Ident, Type))
+ | MissingClassMember (NEL.NonEmpty (Ident, SourceType))
| ExtraneousClassMember Ident (Qualified (ProperName 'ClassName))
- | ExpectedType Type Kind
+ | ExpectedType SourceType SourceKind
-- | constructor name, expected argument count, actual argument count
| IncorrectConstructorArity (Qualified (ProperName 'ConstructorName)) Int Int
- | ExprDoesNotHaveType Expr Type
+ | ExprDoesNotHaveType Expr SourceType
| PropertyIsMissing Label
| AdditionalProperty Label
| TypeSynonymInstance
- | OrphanInstance Ident (Qualified (ProperName 'ClassName)) (Set ModuleName) [Type]
+ | OrphanInstance Ident (Qualified (ProperName 'ClassName)) (Set ModuleName) [SourceType]
| InvalidNewtype (ProperName 'TypeName)
- | InvalidInstanceHead Type
+ | InvalidInstanceHead SourceType
| TransitiveExportError DeclarationRef [DeclarationRef]
| TransitiveDctorExportError DeclarationRef (ProperName 'ConstructorName)
| ShadowedName Ident
| ShadowedTypeVar Text
| UnusedTypeVar Text
- | WildcardInferredType Type Context
- | HoleInferredType Text Type Context TypeSearch
- | MissingTypeDeclaration Ident Type
+ | WildcardInferredType SourceType Context
+ | HoleInferredType Text SourceType Context (Maybe TypeSearch)
+ | MissingTypeDeclaration Ident SourceType
| OverlappingPattern [[Binder]] Bool
| IncompleteExhaustivityCheck
| MisleadingEmptyTypeImport ModuleName (ProperName 'TypeName)
@@ -164,14 +164,14 @@ data SimpleErrorMessage
| CaseBinderLengthDiffers Int [Binder]
| IncorrectAnonymousArgument
| InvalidOperatorInBinder (Qualified (OpName 'ValueOpName)) (Qualified Ident)
- | CannotGeneralizeRecursiveFunction Ident Type
+ | CannotGeneralizeRecursiveFunction Ident SourceType
| CannotDeriveNewtypeForData (ProperName 'TypeName)
| ExpectedWildcard (ProperName 'TypeName)
| CannotUseBindWithDo Ident
-- | instance name, type class, expected argument count, actual argument count
| ClassInstanceArityMismatch Ident (Qualified (ProperName 'ClassName)) Int Int
-- | a user-defined warning raised by using the Warn type class
- | UserDefinedWarning Type
+ | UserDefinedWarning SourceType
-- | a declaration couldn't be used because it contained free variables
| UnusableDeclaration Ident [[Text]]
| CannotDefinePrimModules ModuleName
@@ -181,17 +181,17 @@ data SimpleErrorMessage
-- | Error message hints, providing more detailed information about failure.
data ErrorMessageHint
- = ErrorUnifyingTypes Type Type
+ = ErrorUnifyingTypes SourceType SourceType
| ErrorInExpression Expr
| ErrorInModule ModuleName
- | ErrorInInstance (Qualified (ProperName 'ClassName)) [Type]
- | ErrorInSubsumption Type Type
+ | ErrorInInstance (Qualified (ProperName 'ClassName)) [SourceType]
+ | ErrorInSubsumption SourceType SourceType
| ErrorCheckingAccessor Expr PSString
- | ErrorCheckingType Expr Type
- | ErrorCheckingKind Type
+ | ErrorCheckingType Expr SourceType
+ | ErrorCheckingKind SourceType
| ErrorCheckingGuard
| ErrorInferringType Expr
- | ErrorInApplication Expr Type Expr
+ | ErrorInApplication Expr SourceType Expr
| ErrorInDataConstructor (ProperName 'ConstructorName)
| ErrorInTypeConstructor (ProperName 'TypeName)
| ErrorInBindingGroup (NEL.NonEmpty Ident)
@@ -201,7 +201,7 @@ data ErrorMessageHint
| ErrorInTypeDeclaration Ident
| ErrorInTypeClassDeclaration (ProperName 'ClassName)
| ErrorInForeignImport Ident
- | ErrorSolvingConstraint Constraint
+ | ErrorSolvingConstraint SourceConstraint
| PositionedError (NEL.NonEmpty SourceSpan)
deriving (Show)
@@ -432,7 +432,7 @@ isExplicit _ = False
data TypeDeclarationData = TypeDeclarationData
{ tydeclSourceAnn :: !SourceAnn
, tydeclIdent :: !Ident
- , tydeclType :: !Type
+ , tydeclType :: !SourceType
} deriving (Show, Eq)
overTypeDeclaration :: (TypeDeclarationData -> TypeDeclarationData) -> Declaration -> Declaration
@@ -442,7 +442,7 @@ getTypeDeclaration :: Declaration -> Maybe TypeDeclarationData
getTypeDeclaration (TypeDeclaration d) = Just d
getTypeDeclaration _ = Nothing
-unwrapTypeDeclaration :: TypeDeclarationData -> (Ident, Type)
+unwrapTypeDeclaration :: TypeDeclarationData -> (Ident, SourceType)
unwrapTypeDeclaration td = (tydeclIdent td, tydeclType td)
-- | A value declaration assigns a name and potential binders, to an expression (or multiple guarded expressions).
@@ -478,7 +478,7 @@ data Declaration
-- |
-- A data type declaration (data or newtype, name, arguments, data constructors)
--
- = DataDeclaration SourceAnn DataDeclType (ProperName 'TypeName) [(Text, Maybe Kind)] [(ProperName 'ConstructorName, [Type])]
+ = DataDeclaration SourceAnn DataDeclType (ProperName 'TypeName) [(Text, Maybe SourceKind)] [(ProperName 'ConstructorName, [SourceType])]
-- |
-- A minimal mutually recursive set of data type declarations
--
@@ -486,7 +486,7 @@ data Declaration
-- |
-- A type synonym declaration (name, arguments, type)
--
- | TypeSynonymDeclaration SourceAnn (ProperName 'TypeName) [(Text, Maybe Kind)] Type
+ | TypeSynonymDeclaration SourceAnn (ProperName 'TypeName) [(Text, Maybe SourceKind)] SourceType
-- |
-- A type declaration for a value (name, ty)
--
@@ -505,11 +505,11 @@ data Declaration
-- |
-- A foreign import declaration (name, type)
--
- | ExternDeclaration SourceAnn Ident Type
+ | ExternDeclaration SourceAnn Ident SourceType
-- |
-- A data type foreign import (name, kind)
--
- | ExternDataDeclaration SourceAnn (ProperName 'TypeName) Kind
+ | ExternDataDeclaration SourceAnn (ProperName 'TypeName) SourceKind
-- |
-- A foreign kind import (name)
--
@@ -525,12 +525,12 @@ data Declaration
-- |
-- A type class declaration (name, argument, implies, member declarations)
--
- | TypeClassDeclaration SourceAnn (ProperName 'ClassName) [(Text, Maybe Kind)] [Constraint] [FunctionalDependency] [Declaration]
+ | TypeClassDeclaration SourceAnn (ProperName 'ClassName) [(Text, Maybe SourceKind)] [SourceConstraint] [FunctionalDependency] [Declaration]
-- |
-- A type instance declaration (instance chain, chain index, name,
-- dependencies, class name, instance types, member declarations)
--
- | TypeInstanceDeclaration SourceAnn [Ident] Integer Ident [Constraint] (Qualified (ProperName 'ClassName)) [Type] TypeInstanceBody
+ | TypeInstanceDeclaration SourceAnn [Ident] Integer Ident [SourceConstraint] (Qualified (ProperName 'ClassName)) [SourceType] TypeInstanceBody
deriving (Show)
data ValueFixity = ValueFixity Fixity (Qualified (Either Ident (ProperName 'ConstructorName))) (OpName 'ValueOpName)
@@ -767,7 +767,7 @@ data Expr
-- |
-- A value with a type annotation
--
- | TypedValue Bool Expr Type
+ | TypedValue Bool Expr SourceType
-- |
-- A let binding
--
@@ -775,11 +775,11 @@ data Expr
-- |
-- A do-notation block
--
- | Do [DoNotationElement]
+ | Do (Maybe ModuleName) [DoNotationElement]
-- |
-- An ado-notation block
--
- | Ado [DoNotationElement] Expr
+ | Ado (Maybe ModuleName) [DoNotationElement] Expr
-- |
-- An application of a typeclass dictionary constructor. The value should be
-- an ObjectLiteral.
@@ -792,8 +792,8 @@ data Expr
-- at superclass implementations when searching for a dictionary, the type class name and
-- instance type, and the type class dictionaries in scope.
--
- | TypeClassDictionary Constraint
- (M.Map (Maybe ModuleName) (M.Map (Qualified (ProperName 'ClassName)) (M.Map (Qualified Ident) NamedDict)))
+ | TypeClassDictionary SourceConstraint
+ (M.Map (Maybe ModuleName) (M.Map (Qualified (ProperName 'ClassName)) (M.Map (Qualified Ident) (NEL.NonEmpty NamedDict))))
[ErrorMessageHint]
-- |
-- A typeclass dictionary accessor, the implementation is left unspecified until CoreFn desugaring.
@@ -802,7 +802,7 @@ data Expr
-- |
-- A placeholder for a superclass dictionary to be turned into a TypeClassDictionary during typechecking
--
- | DeferredDictionary (Qualified (ProperName 'ClassName)) [Type]
+ | DeferredDictionary (Qualified (ProperName 'ClassName)) [SourceType]
-- |
-- A placeholder for an anonymous function argument
--
diff --git a/src/Language/PureScript/AST/Exported.hs b/src/Language/PureScript/AST/Exported.hs
index a566773..f24b1dc 100644
--- a/src/Language/PureScript/AST/Exported.hs
+++ b/src/Language/PureScript/AST/Exported.hs
@@ -110,8 +110,8 @@ typeInstanceConstituents (TypeInstanceDeclaration _ _ _ _ constraints className
-- Note that type synonyms are disallowed in instance declarations, so
-- we don't need to handle them here.
- go (TypeConstructor n) = [Right n]
- go (ConstrainedType c _) = fromConstraint c
+ go (TypeConstructor _ n) = [Right n]
+ go (ConstrainedType _ c _) = fromConstraint c
go _ = []
typeInstanceConstituents _ = []
diff --git a/src/Language/PureScript/AST/SourcePos.hs b/src/Language/PureScript/AST/SourcePos.hs
index 6ad6754..d47de81 100644
--- a/src/Language/PureScript/AST/SourcePos.hs
+++ b/src/Language/PureScript/AST/SourcePos.hs
@@ -33,6 +33,11 @@ displaySourcePos sp =
"line " <> T.pack (show (sourcePosLine sp)) <>
", column " <> T.pack (show (sourcePosColumn sp))
+displaySourcePosShort :: SourcePos -> Text
+displaySourcePosShort sp =
+ T.pack (show (sourcePosLine sp)) <>
+ ":" <> T.pack (show (sourcePosColumn sp))
+
instance A.ToJSON SourcePos where
toJSON SourcePos{..} =
A.toJSON [sourcePosLine, sourcePosColumn]
@@ -55,12 +60,19 @@ instance NFData SourceSpan
displayStartEndPos :: SourceSpan -> Text
displayStartEndPos sp =
+ "(" <>
displaySourcePos (spanStart sp) <> " - " <>
- displaySourcePos (spanEnd sp)
+ displaySourcePos (spanEnd sp) <> ")"
+
+displayStartEndPosShort :: SourceSpan -> Text
+displayStartEndPosShort sp =
+ displaySourcePosShort (spanStart sp) <> " - " <>
+ displaySourcePosShort (spanEnd sp)
displaySourceSpan :: FilePath -> SourceSpan -> Text
displaySourceSpan relPath sp =
- T.pack (makeRelative relPath (spanName sp)) <> " " <>
+ T.pack (makeRelative relPath (spanName sp)) <> ":" <>
+ displayStartEndPosShort sp <> " " <>
displayStartEndPos sp
instance A.ToJSON SourceSpan where
@@ -82,3 +94,28 @@ internalModuleSourceSpan name = SourceSpan name (SourcePos 0 0) (SourcePos 0 0)
nullSourceSpan :: SourceSpan
nullSourceSpan = internalModuleSourceSpan ""
+
+nullSourceAnn :: SourceAnn
+nullSourceAnn = (nullSourceSpan, [])
+
+pattern NullSourceSpan :: SourceSpan
+pattern NullSourceSpan = SourceSpan "" (SourcePos 0 0) (SourcePos 0 0)
+
+pattern NullSourceAnn :: SourceAnn
+pattern NullSourceAnn = (NullSourceSpan, [])
+
+nonEmptySpan :: SourceAnn -> Maybe SourceSpan
+nonEmptySpan (NullSourceSpan, _) = Nothing
+nonEmptySpan (ss, _) = Just ss
+
+widenSourceSpan :: SourceSpan -> SourceSpan -> SourceSpan
+widenSourceSpan NullSourceSpan b = b
+widenSourceSpan a NullSourceSpan = a
+widenSourceSpan (SourceSpan n1 s1 e1) (SourceSpan n2 s2 e2) =
+ SourceSpan n (min s1 s2) (max e1 e2)
+ where
+ n | n1 == "" = n2
+ | otherwise = n1
+
+widenSourceAnn :: SourceAnn -> SourceAnn -> SourceAnn
+widenSourceAnn (s1, _) (s2, _) = (widenSourceSpan s1 s2, [])
diff --git a/src/Language/PureScript/AST/Traversals.hs b/src/Language/PureScript/AST/Traversals.hs
index 50bf45d..a6ede54 100644
--- a/src/Language/PureScript/AST/Traversals.hs
+++ b/src/Language/PureScript/AST/Traversals.hs
@@ -76,8 +76,8 @@ everywhereOnValues f g h = (f', g', h')
g' (Case vs alts) = g (Case (fmap g' vs) (fmap handleCaseAlternative alts))
g' (TypedValue check v ty) = g (TypedValue check (g' v) ty)
g' (Let w ds v) = g (Let w (fmap f' ds) (g' v))
- g' (Do es) = g (Do (fmap handleDoNotationElement es))
- g' (Ado es v) = g (Ado (fmap handleDoNotationElement es) (g' v))
+ g' (Do m es) = g (Do m (fmap handleDoNotationElement es))
+ g' (Ado m es v) = g (Ado m (fmap handleDoNotationElement es) (g' v))
g' (PositionedValue pos com v) = g (PositionedValue pos com (g' v))
g' other = g other
@@ -150,8 +150,8 @@ everywhereOnValuesTopDownM f g h = (f' <=< f, g' <=< g, h' <=< h)
g' (Case vs alts) = Case <$> traverse (g' <=< g) vs <*> traverse handleCaseAlternative alts
g' (TypedValue check v ty) = TypedValue check <$> (g v >>= g') <*> pure ty
g' (Let w ds v) = Let w <$> traverse (f' <=< f) ds <*> (g v >>= g')
- g' (Do es) = Do <$> traverse handleDoNotationElement es
- g' (Ado es v) = Ado <$> traverse handleDoNotationElement es <*> (g v >>= g')
+ g' (Do m es) = Do m <$> traverse handleDoNotationElement es
+ g' (Ado m es v) = Ado m <$> traverse handleDoNotationElement es <*> (g v >>= g')
g' (PositionedValue pos com v) = PositionedValue pos com <$> (g v >>= g')
g' other = g other
@@ -219,8 +219,8 @@ everywhereOnValuesM f g h = (f', g', h')
g' (Case vs alts) = (Case <$> traverse g' vs <*> traverse handleCaseAlternative alts) >>= g
g' (TypedValue check v ty) = (TypedValue check <$> g' v <*> pure ty) >>= g
g' (Let w ds v) = (Let w <$> traverse f' ds <*> g' v) >>= g
- g' (Do es) = (Do <$> traverse handleDoNotationElement es) >>= g
- g' (Ado es v) = (Ado <$> traverse handleDoNotationElement es <*> g' v) >>= g
+ g' (Do m es) = (Do m <$> traverse handleDoNotationElement es) >>= g
+ g' (Ado m es v) = (Ado m <$> traverse handleDoNotationElement es <*> g' v) >>= g
g' (PositionedValue pos com v) = (PositionedValue pos com <$> g' v) >>= g
g' other = g other
@@ -291,8 +291,8 @@ everythingOnValues (<>.) f g h i j = (f', g', h', i', j')
g' v@(Case vs alts) = foldl (<>.) (foldl (<>.) (g v) (fmap g' vs)) (fmap i' alts)
g' v@(TypedValue _ v1 _) = g v <>. g' v1
g' v@(Let _ ds v1) = foldl (<>.) (g v) (fmap f' ds) <>. g' v1
- g' v@(Do es) = foldl (<>.) (g v) (fmap j' es)
- g' v@(Ado es v1) = foldl (<>.) (g v) (fmap j' es) <>. g' v1
+ g' v@(Do _ es) = foldl (<>.) (g v) (fmap j' es)
+ g' v@(Ado _ es v1) = foldl (<>.) (g v) (fmap j' es) <>. g' v1
g' v@(PositionedValue _ _ v1) = g v <>. g' v1
g' v = g v
@@ -372,8 +372,8 @@ everythingWithContextOnValues s0 r0 (<>.) f g h i j = (f'' s0, g'' s0, h'' s0, i
g' s (Case vs alts) = foldl (<>.) (foldl (<>.) r0 (fmap (g'' s) vs)) (fmap (i'' s) alts)
g' s (TypedValue _ v1 _) = g'' s v1
g' s (Let _ ds v1) = foldl (<>.) r0 (fmap (f'' s) ds) <>. g'' s v1
- g' s (Do es) = foldl (<>.) r0 (fmap (j'' s) es)
- g' s (Ado es v1) = foldl (<>.) r0 (fmap (j'' s) es) <>. g'' s v1
+ g' s (Do _ es) = foldl (<>.) r0 (fmap (j'' s) es)
+ g' s (Ado _ es v1) = foldl (<>.) r0 (fmap (j'' s) es) <>. g'' s v1
g' s (PositionedValue _ _ v1) = g'' s v1
g' _ _ = r0
@@ -457,8 +457,8 @@ everywhereWithContextOnValuesM s0 f g h i j = (f'' s0, g'' s0, h'' s0, i'' s0, j
g' s (Case vs alts) = Case <$> traverse (g'' s) vs <*> traverse (i'' s) alts
g' s (TypedValue check v ty) = TypedValue check <$> g'' s v <*> pure ty
g' s (Let w ds v) = Let w <$> traverse (f'' s) ds <*> g'' s v
- g' s (Do es) = Do <$> traverse (j'' s) es
- g' s (Ado es v) = Ado <$> traverse (j'' s) es <*> g'' s v
+ g' s (Do m es) = Do m <$> traverse (j'' s) es
+ g' s (Ado m es v) = Ado m <$> traverse (j'' s) es <*> g'' s v
g' s (PositionedValue pos com v) = PositionedValue pos com <$> g'' s v
g' _ other = return other
@@ -554,8 +554,8 @@ everythingWithScope f g h i j = (f'', g'', h'', i'', \s -> snd . j'' s)
g' s (Let _ ds v1) =
let s' = S.union s (S.fromList (map LocalIdent (mapMaybe getDeclIdent ds)))
in foldMap (f'' s') ds <> g'' s' v1
- g' s (Do es) = fold . snd . mapAccumL j'' s $ es
- g' s (Ado es v1) =
+ g' s (Do _ es) = fold . snd . mapAccumL j'' s $ es
+ g' s (Ado _ es v1) =
let s' = S.union s (foldMap (fst . j'' s) es)
in g'' s' v1
g' s (PositionedValue _ _ v1) = g'' s v1
@@ -620,7 +620,7 @@ everythingWithScope f g h i j = (f'', g'', h'', i'', \s -> snd . j'' s)
accumTypes
:: (Monoid r)
- => (Type -> r)
+ => (SourceType -> r)
-> ( Declaration -> r
, Expr -> r
, Binder -> r
@@ -644,7 +644,7 @@ accumTypes f = everythingOnValues mappend forDecls forValues (const mempty) (con
accumKinds
:: (Monoid r)
- => (Kind -> r)
+ => (SourceKind -> r)
-> ( Declaration -> r
, Expr -> r
, Binder -> r
@@ -675,13 +675,13 @@ accumKinds f = everythingOnValues mappend forDecls forValues (const mempty) (con
forValues (TypedValue _ _ ty) = forTypes ty
forValues _ = mempty
- forTypes (KindedType _ k) = f k
+ forTypes (KindedType _ _ k) = f k
forTypes _ = mempty
-- |
-- Map a function over type annotations appearing inside a value
--
-overTypes :: (Type -> Type) -> Expr -> Expr
+overTypes :: (SourceType -> SourceType) -> Expr -> Expr
overTypes f = let (_, f', _) = everywhereOnValues id g id in f'
where
g :: Expr -> Expr
diff --git a/src/Language/PureScript/CodeGen/JS.hs b/src/Language/PureScript/CodeGen/JS.hs
index adf235f..59576f0 100644
--- a/src/Language/PureScript/CodeGen/JS.hs
+++ b/src/Language/PureScript/CodeGen/JS.hs
@@ -233,16 +233,16 @@ moduleToJs (Module _ coms mn _ imps exps foreigns decls) foreign_ =
ds' <- concat <$> mapM bindToJs ds
ret <- valueToJs val
return $ AST.App Nothing (AST.Function Nothing Nothing [] (AST.Block Nothing (ds' ++ [AST.Return Nothing ret]))) []
- valueToJs' (Constructor (_, _, _, Just IsNewtype) _ (ProperName ctor) _) =
+ valueToJs' (Constructor (_, _, _, Just IsNewtype) _ ctor _) =
return $ AST.VariableIntroduction Nothing (properToJs ctor) (Just $
AST.ObjectLiteral Nothing [("create",
AST.Function Nothing Nothing ["value"]
(AST.Block Nothing [AST.Return Nothing $ AST.Var Nothing "value"]))])
- valueToJs' (Constructor _ _ (ProperName ctor) []) =
+ valueToJs' (Constructor _ _ ctor []) =
return $ iife (properToJs ctor) [ AST.Function Nothing (Just (properToJs ctor)) [] (AST.Block Nothing [])
, AST.Assignment Nothing (accessorString "value" (AST.Var Nothing (properToJs ctor)))
(AST.Unary Nothing AST.New $ AST.App Nothing (AST.Var Nothing (properToJs ctor)) []) ]
- valueToJs' (Constructor _ _ (ProperName ctor) fields) =
+ valueToJs' (Constructor _ _ ctor fields) =
let constructor =
let body = [ AST.Assignment Nothing ((accessorString $ mkString $ identToJs f) (AST.Var Nothing "this")) (var f) | f <- fields ]
in AST.Function Nothing (Just (properToJs ctor)) (identToJs `map` fields) (AST.Block Nothing body)
diff --git a/src/Language/PureScript/CodeGen/JS/Common.hs b/src/Language/PureScript/CodeGen/JS/Common.hs
index 603b75d..c13a22d 100644
--- a/src/Language/PureScript/CodeGen/JS/Common.hs
+++ b/src/Language/PureScript/CodeGen/JS/Common.hs
@@ -20,21 +20,42 @@ moduleNameToJs (ModuleName pns) =
-- * Alphanumeric characters are kept unmodified.
--
-- * Reserved javascript identifiers are prefixed with '$$'.
---
--- * Symbols are prefixed with '$' followed by a symbol name or their ordinal value.
identToJs :: Ident -> Text
-identToJs (Ident name) = properToJs name
+identToJs (Ident name) = anyNameToJs name
identToJs (GenIdent _ _) = internalError "GenIdent in identToJs"
identToJs UnusedIdent = "$__unused"
-properToJs :: Text -> Text
-properToJs name
+-- | Convert a 'ProperName' into a valid JavaScript identifier:
+--
+-- * Alphanumeric characters are kept unmodified.
+--
+-- * Reserved javascript identifiers are prefixed with '$$'.
+properToJs :: ProperName a -> Text
+properToJs = anyNameToJs . runProperName
+
+-- | Convert any name into a valid JavaScript identifier.
+--
+-- Note that this function assumes that the argument is a valid PureScript
+-- identifier (either an 'Ident' or a 'ProperName') to begin with; as such it
+-- will not produce valid JavaScript identifiers if the argument e.g. begins
+-- with a digit. Prefer 'identToJs' or 'properToJs' where possible.
+anyNameToJs :: Text -> Text
+anyNameToJs name
| nameIsJsReserved name || nameIsJsBuiltIn name = "$$" <> name
| otherwise = T.concatMap identCharToText name
--- | Test if a string is a valid AST identifier without escaping.
-identNeedsEscaping :: Text -> Bool
-identNeedsEscaping s = s /= properToJs s || T.null s
+-- | Test if a string is a valid JavaScript identifier as-is. Note that, while
+-- a return value of 'True' guarantees that the string is a valid JS
+-- identifier, a return value of 'False' does not guarantee that the string is
+-- not a valid JS identifier. That is, this check is more conservative than
+-- absolutely necessary.
+isValidJsIdentifier :: Text -> Bool
+isValidJsIdentifier s =
+ and
+ [ not (T.null s)
+ , isAlpha (T.head s)
+ , s == anyNameToJs s
+ ]
-- | Attempts to find a human-readable name for a symbol, if none has been specified returns the
-- ordinal value.
diff --git a/src/Language/PureScript/CodeGen/JS/Printer.hs b/src/Language/PureScript/CodeGen/JS/Printer.hs
index da67fa7..b69270c 100644
--- a/src/Language/PureScript/CodeGen/JS/Printer.hs
+++ b/src/Language/PureScript/CodeGen/JS/Printer.hs
@@ -57,7 +57,7 @@ literals = mkPattern' match'
objectPropertyToString :: (Emit gen) => PSString -> gen
objectPropertyToString s =
emit $ case decodeString s of
- Just s' | not (identNeedsEscaping s') ->
+ Just s' | isValidJsIdentifier s' ->
s'
_ ->
prettyPrintStringJS s
@@ -154,7 +154,7 @@ accessor = mkPattern match
where
match (Indexer _ (StringLiteral _ prop) val) =
case decodeString prop of
- Just s | not (identNeedsEscaping s) -> Just (s, val)
+ Just s | isValidJsIdentifier s -> Just (s, val)
_ -> Nothing
match _ = Nothing
diff --git a/src/Language/PureScript/Comments.hs b/src/Language/PureScript/Comments.hs
index fd8f678..5c5acd8 100644
--- a/src/Language/PureScript/Comments.hs
+++ b/src/Language/PureScript/Comments.hs
@@ -1,4 +1,5 @@
{-# LANGUAGE TemplateHaskell #-}
+{-# LANGUAGE DeriveGeneric #-}
-- |
-- Defines the types of source code comments
@@ -6,13 +7,17 @@
module Language.PureScript.Comments where
import Prelude.Compat
+import Control.DeepSeq (NFData)
import Data.Text (Text)
+import GHC.Generics (Generic)
import Data.Aeson.TH
data Comment
= LineComment Text
| BlockComment Text
- deriving (Show, Eq, Ord)
+ deriving (Show, Eq, Ord, Generic)
+
+instance NFData Comment
$(deriveJSON (defaultOptions { sumEncoding = ObjectWithSingleField }) ''Comment)
diff --git a/src/Language/PureScript/Constants.hs b/src/Language/PureScript/Constants.hs
index b4e3a5e..cd07a9c 100644
--- a/src/Language/PureScript/Constants.hs
+++ b/src/Language/PureScript/Constants.hs
@@ -387,6 +387,17 @@ pattern Partial = Qualified (Just Prim) (ProperName "Partial")
pattern Record :: Qualified (ProperName 'TypeName)
pattern Record = Qualified (Just Prim) (ProperName "Record")
+-- Prim.Boolean
+
+pattern PrimBoolean :: ModuleName
+pattern PrimBoolean = ModuleName [ProperName "Prim", ProperName "Boolean"]
+
+booleanTrue :: Qualified (ProperName 'TypeName)
+booleanTrue = Qualified (Just PrimBoolean) (ProperName "True")
+
+booleanFalse :: Qualified (ProperName 'TypeName)
+booleanFalse = Qualified (Just PrimBoolean) (ProperName "False")
+
-- Prim.Ordering
pattern PrimOrdering :: ModuleName
@@ -458,7 +469,7 @@ pattern Warn :: Qualified (ProperName 'ClassName)
pattern Warn = Qualified (Just PrimTypeError) (ProperName "Warn")
primModules :: [ModuleName]
-primModules = [Prim, PrimOrdering, PrimRow, PrimRowList, PrimSymbol, PrimTypeError]
+primModules = [Prim, PrimBoolean, PrimOrdering, PrimRow, PrimRowList, PrimSymbol, PrimTypeError]
-- Data.Symbol
@@ -471,6 +482,9 @@ pattern IsSymbol = Qualified (Just DataSymbol) (ProperName "IsSymbol")
typ :: forall a. (IsString a) => a
typ = "Type"
+kindBoolean :: forall a. (IsString a) => a
+kindBoolean = "Boolean"
+
kindOrdering :: forall a. (IsString a) => a
kindOrdering = "Ordering"
@@ -488,6 +502,9 @@ doc = "Doc"
prim :: forall a. (IsString a) => a
prim = "Prim"
+moduleBoolean :: forall a. (IsString a) => a
+moduleBoolean = "Boolean"
+
moduleOrdering :: forall a. (IsString a) => a
moduleOrdering = "Ordering"
diff --git a/src/Language/PureScript/CoreFn/Ann.hs b/src/Language/PureScript/CoreFn/Ann.hs
index 5d5b96f..cb536cc 100644
--- a/src/Language/PureScript/CoreFn/Ann.hs
+++ b/src/Language/PureScript/CoreFn/Ann.hs
@@ -1,25 +1,25 @@
-module Language.PureScript.CoreFn.Ann where
-
-import Prelude.Compat
-
-import Language.PureScript.AST.SourcePos
-import Language.PureScript.Comments
-import Language.PureScript.CoreFn.Meta
-import Language.PureScript.Types
-
--- |
--- Type alias for basic annotations
---
-type Ann = (SourceSpan, [Comment], Maybe Type, Maybe Meta)
-
--- |
--- An annotation empty of metadata aside from a source span.
---
-ssAnn :: SourceSpan -> Ann
-ssAnn ss = (ss, [], Nothing, Nothing)
-
--- |
--- Remove the comments from an annotation
---
-removeComments :: Ann -> Ann
-removeComments (ss, _, ty, meta) = (ss, [], ty, meta)
+module Language.PureScript.CoreFn.Ann where
+
+import Prelude.Compat
+
+import Language.PureScript.AST.SourcePos
+import Language.PureScript.Comments
+import Language.PureScript.CoreFn.Meta
+import Language.PureScript.Types
+
+-- |
+-- Type alias for basic annotations
+--
+type Ann = (SourceSpan, [Comment], Maybe SourceType, Maybe Meta)
+
+-- |
+-- An annotation empty of metadata aside from a source span.
+--
+ssAnn :: SourceSpan -> Ann
+ssAnn ss = (ss, [], Nothing, Nothing)
+
+-- |
+-- Remove the comments from an annotation
+--
+removeComments :: Ann -> Ann
+removeComments (ss, _, ty, meta) = (ss, [], ty, meta)
diff --git a/src/Language/PureScript/CoreFn/Desugar.hs b/src/Language/PureScript/CoreFn/Desugar.hs
index c16c54f..b404558 100644
--- a/src/Language/PureScript/CoreFn/Desugar.hs
+++ b/src/Language/PureScript/CoreFn/Desugar.hs
@@ -72,7 +72,7 @@ moduleToCoreFn env (A.Module modSS coms mn decls (Just exps)) =
declToCoreFn _ = []
-- | Desugars expressions from AST to CoreFn representation.
- exprToCoreFn :: SourceSpan -> [Comment] -> Maybe Type -> A.Expr -> Expr Ann
+ exprToCoreFn :: SourceSpan -> [Comment] -> Maybe SourceType -> A.Expr -> Expr Ann
exprToCoreFn _ com ty (A.Literal ss lit) =
Literal (ss, com, ty, Nothing) (fmap (exprToCoreFn ss com Nothing) lit)
exprToCoreFn ss com ty (A.Accessor name v) =
@@ -178,12 +178,12 @@ moduleToCoreFn env (A.Module modSS coms mn decls (Just exps)) =
where
numConstructors
- :: (Qualified (ProperName 'ConstructorName), (DataDeclType, ProperName 'TypeName, Type, [Ident]))
+ :: (Qualified (ProperName 'ConstructorName), (DataDeclType, ProperName 'TypeName, SourceType, [Ident]))
-> Int
numConstructors ty = length $ filter (((==) `on` typeConstructor) ty) $ M.toList $ dataConstructors env
typeConstructor
- :: (Qualified (ProperName 'ConstructorName), (DataDeclType, ProperName 'TypeName, Type, [Ident]))
+ :: (Qualified (ProperName 'ConstructorName), (DataDeclType, ProperName 'TypeName, SourceType, [Ident]))
-> (ModuleName, ProperName 'TypeName)
typeConstructor (Qualified (Just mn') _, (_, tyCtor, _, _)) = (mn', tyCtor)
typeConstructor _ = internalError "Invalid argument to typeConstructor"
@@ -241,7 +241,7 @@ exportToCoreFn _ = []
-- | Makes a typeclass dictionary constructor function. The returned expression
-- is a function that accepts the superclass instances and member
-- implementations and returns a record for the instance dictionary.
-mkTypeClassConstructor :: SourceAnn -> [Constraint] -> [A.Declaration] -> Expr Ann
+mkTypeClassConstructor :: SourceAnn -> [SourceConstraint] -> [A.Declaration] -> Expr Ann
mkTypeClassConstructor (ss, com) [] [] = Literal (ss, com, Nothing, Just IsTypeClassConstructor) (ObjectLiteral [])
mkTypeClassConstructor (ss, com) supers members =
let args@(a:as) = sort $ fmap typeClassMemberName members ++ superClassDictionaryNames supers
diff --git a/src/Language/PureScript/CoreFn/Optimizer.hs b/src/Language/PureScript/CoreFn/Optimizer.hs
index 5adeeb9..4456702 100644
--- a/src/Language/PureScript/CoreFn/Optimizer.hs
+++ b/src/Language/PureScript/CoreFn/Optimizer.hs
@@ -9,6 +9,7 @@ import Language.PureScript.CoreFn.Ann
import Language.PureScript.CoreFn.Expr
import Language.PureScript.CoreFn.Module
import Language.PureScript.CoreFn.Traversals
+import Language.PureScript.Names (Ident(UnusedIdent), Qualified(Qualified))
import Language.PureScript.Label
import Language.PureScript.Types
import qualified Language.PureScript.Constants as C
@@ -23,7 +24,7 @@ optimizeModuleDecls :: [Bind Ann] -> [Bind Ann]
optimizeModuleDecls = map transformBinds
where
(transformBinds, _, _) = everywhereOnValues identity transformExprs identity
- transformExprs = optimizeClosedRecordUpdate
+ transformExprs = optimizeUnusedPartialFn . optimizeClosedRecordUpdate
optimizeClosedRecordUpdate :: Expr Ann -> Expr Ann
optimizeClosedRecordUpdate ou@(ObjectUpdate a@(_, _, Just t, _) r updatedFields) =
@@ -36,12 +37,20 @@ optimizeClosedRecordUpdate ou@(ObjectUpdate a@(_, _, Just t, _) r updatedFields)
optimizeClosedRecordUpdate e = e
-- | Return the labels of a closed record, or Nothing for other types or open records.
-closedRecordFields :: Type -> Maybe [Label]
-closedRecordFields (TypeApp (TypeConstructor C.Record) row) =
+closedRecordFields :: Type a -> Maybe [Label]
+closedRecordFields (TypeApp _ (TypeConstructor _ C.Record) row) =
collect row
where
- collect :: Type -> Maybe [Label]
- collect REmpty = Just []
- collect (RCons l _ r) = collect r >>= return . (l :)
+ collect :: Type a -> Maybe [Label]
+ collect (REmpty _) = Just []
+ collect (RCons _ l _ r) = collect r >>= return . (l :)
collect _ = Nothing
closedRecordFields _ = Nothing
+
+-- | See https://github.com/purescript/purescript/issues/3157
+optimizeUnusedPartialFn :: Expr a -> Expr a
+optimizeUnusedPartialFn (Let _
+ [NonRec _ UnusedIdent _]
+ (App _ (App _ (Var _ (Qualified _ UnusedIdent)) _) originalCoreFn)) =
+ originalCoreFn
+optimizeUnusedPartialFn e = e
diff --git a/src/Language/PureScript/Docs/AsHtml.hs b/src/Language/PureScript/Docs/AsHtml.hs
index adeeab7..cc9c3b7 100644
--- a/src/Language/PureScript/Docs/AsHtml.hs
+++ b/src/Language/PureScript/Docs/AsHtml.hs
@@ -53,18 +53,16 @@ data HtmlOutputModule a = HtmlOutputModule
deriving (Show, Functor)
data HtmlRenderContext = HtmlRenderContext
- { currentModuleName :: P.ModuleName
- , buildDocLink :: Namespace -> Text -> ContainingModule -> Maybe DocLink
+ { buildDocLink :: Namespace -> Text -> ContainingModule -> Maybe DocLink
, renderDocLink :: DocLink -> Text
, renderSourceLink :: P.SourceSpan -> Maybe Text
}
-- |
-- An HtmlRenderContext for when you don't want to render any links.
-nullRenderContext :: P.ModuleName -> HtmlRenderContext
-nullRenderContext mn = HtmlRenderContext
- { currentModuleName = mn
- , buildDocLink = const (const (const Nothing))
+nullRenderContext :: HtmlRenderContext
+nullRenderContext = HtmlRenderContext
+ { buildDocLink = const (const (const Nothing))
, renderDocLink = const ""
, renderSourceLink = const Nothing
}
@@ -83,16 +81,16 @@ moduleAsHtml
:: (InPackage P.ModuleName -> Maybe HtmlRenderContext)
-> Module
-> (P.ModuleName, HtmlOutputModule Html)
-moduleAsHtml getR Module{..} = (modName, HtmlOutputModule modHtml reexports)
+moduleAsHtml getHtmlCtx Module{..} = (modName, HtmlOutputModule modHtml reexports)
where
modHtml = do
- let r = fromMaybe (nullRenderContext modName) $ getR (Local modName)
+ let r = fromMaybe nullRenderContext $ getHtmlCtx (Local modName)
in do
for_ modComments renderMarkdown
for_ modDeclarations (declAsHtml r)
reexports =
flip map modReExports $ \(pkg, decls) ->
- let r = fromMaybe (nullRenderContext modName) $ getR pkg
+ let r = fromMaybe nullRenderContext $ getHtmlCtx pkg
in (pkg, foldMap (declAsHtml r) decls)
-- renderIndex :: LinksContext -> [(Maybe Char, Html)]
@@ -101,17 +99,17 @@ moduleAsHtml getR Module{..} = (modName, HtmlOutputModule modHtml reexports)
-- go = takeLocals
-- >>> groupIndex getIndex renderEntry
-- >>> map (second (ul . mconcat))
---
+--
-- getIndex (_, title_) = do
-- c <- textHeadMay title_
-- guard (toUpper c `elem` ['A'..'Z'])
-- pure c
---
+--
-- textHeadMay t =
-- case T.length t of
-- 0 -> Nothing
-- _ -> Just (T.index t 0)
---
+--
-- renderEntry (mn, title_) =
-- li $ do
-- let url = T.pack (filePathFor mn `relativeTo` "index") <> "#" <> title_
@@ -119,7 +117,7 @@ moduleAsHtml getR Module{..} = (modName, HtmlOutputModule modHtml reexports)
-- a ! A.href (v url) $ text title_
-- sp
-- text ("(" <> P.runModuleName mn <> ")")
---
+--
-- groupIndex :: Ord i => (a -> Maybe i) -> (a -> b) -> [a] -> [(Maybe i, [b])]
-- groupIndex f g =
-- map (second DList.toList) . M.toList . foldr go' M.empty . sortBy (comparing f)
@@ -233,13 +231,13 @@ renderLink r link_@DocLink{..} =
a ! A.href (v (renderDocLink r link_ <> fragmentFor link_))
! A.title (v fullyQualifiedName)
where
- fullyQualifiedName = case linkLocation of
- SameModule -> fq (currentModuleName r) linkTitle
- LocalModule _ modName -> fq modName linkTitle
- DepsModule _ _ _ modName -> fq modName linkTitle
- BuiltinModule modName -> fq modName linkTitle
+ fullyQualifiedName =
+ P.runModuleName modName <> "." <> linkTitle
- fq mn str = P.runModuleName mn <> "." <> str
+ modName = case linkLocation of
+ LocalModule m -> m
+ DepsModule _ _ m -> m
+ BuiltinModule m -> m
makeFragment :: Namespace -> Text -> Text
makeFragment ns = (prefix <>) . escape
diff --git a/src/Language/PureScript/Docs/AsMarkdown.hs b/src/Language/PureScript/Docs/AsMarkdown.hs
index 13c513b..6765217 100644
--- a/src/Language/PureScript/Docs/AsMarkdown.hs
+++ b/src/Language/PureScript/Docs/AsMarkdown.hs
@@ -42,23 +42,22 @@ moduleAsMarkdown Module{..} = do
headerLevel 2 $ "Module " <> P.runModuleName modName
spacer
for_ modComments tell'
- mapM_ (declAsMarkdown modName) modDeclarations
+ mapM_ declAsMarkdown modDeclarations
spacer
for_ modReExports $ \(mn', decls) -> do
let mn = ignorePackage mn'
headerLevel 3 $ "Re-exported from " <> P.runModuleName mn <> ":"
spacer
- mapM_ (declAsMarkdown mn) decls
+ mapM_ declAsMarkdown decls
-declAsMarkdown :: P.ModuleName -> Declaration -> Docs
-declAsMarkdown mn decl@Declaration{..} = do
- let options = defaultRenderTypeOptions { currentModule = Just mn }
+declAsMarkdown :: Declaration -> Docs
+declAsMarkdown decl@Declaration{..} = do
headerLevel 4 (ticks declTitle)
spacer
let (instances, children) = partition (isChildInstance . cdeclInfo) declChildren
fencedBlock $ do
- tell' (codeToString $ Render.renderDeclarationWithOptions options decl)
+ tell' (codeToString $ Render.renderDeclaration decl)
zipWithM_ (\f c -> tell' (childToString f c)) (First : repeat NotFirst) children
spacer
diff --git a/src/Language/PureScript/Docs/Convert.hs b/src/Language/PureScript/Docs/Convert.hs
index be6db2f..1acbadd 100644
--- a/src/Language/PureScript/Docs/Convert.hs
+++ b/src/Language/PureScript/Docs/Convert.hs
@@ -14,6 +14,7 @@ import Protolude hiding (check)
import Control.Arrow ((&&&))
import Control.Category ((>>>))
import Control.Monad.Writer.Strict (runWriterT)
+import Data.Functor (($>))
import qualified Data.Map as Map
import Data.String (String)
@@ -213,7 +214,7 @@ insertValueTypes env m =
ident = parseIdent (declTitle d)
ty = lookupName ident
in
- d { declInfo = ValueDeclaration ty }
+ d { declInfo = ValueDeclaration (ty $> ()) }
go other =
other
diff --git a/src/Language/PureScript/Docs/Convert/ReExports.hs b/src/Language/PureScript/Docs/Convert/ReExports.hs
index 241acaa..980af53 100644
--- a/src/Language/PureScript/Docs/Convert/ReExports.hs
+++ b/src/Language/PureScript/Docs/Convert/ReExports.hs
@@ -195,7 +195,7 @@ lookupValueDeclaration ::
MonadReader P.ModuleName m) =>
P.ModuleName ->
P.Ident ->
- m (P.ModuleName, [Either (Text, P.Constraint, ChildDeclaration) Declaration])
+ m (P.ModuleName, [Either (Text, Constraint', ChildDeclaration) Declaration])
lookupValueDeclaration importedFrom ident = do
decls <- lookupModuleDeclarations "lookupValueDeclaration" importedFrom
let
@@ -360,7 +360,7 @@ lookupModuleDeclarations definedIn moduleName = do
handleTypeClassMembers ::
(MonadReader P.ModuleName m) =>
- Map P.ModuleName [Either (Text, P.Constraint, ChildDeclaration) Declaration] ->
+ Map P.ModuleName [Either (Text, Constraint', ChildDeclaration) Declaration] ->
Map P.ModuleName [Declaration] ->
m (Map P.ModuleName [Declaration], Map P.ModuleName [Declaration])
handleTypeClassMembers valsAndMembers typeClasses =
@@ -375,7 +375,7 @@ handleTypeClassMembers valsAndMembers typeClasses =
|> fmap splitMap
valsAndMembersToEnv ::
- [Either (Text, P.Constraint, ChildDeclaration) Declaration] -> TypeClassEnv
+ [Either (Text, Constraint', ChildDeclaration) Declaration] -> TypeClassEnv
valsAndMembersToEnv xs =
let (envUnhandledMembers, envValues) = partitionEithers xs
envTypeClasses = []
@@ -400,7 +400,7 @@ data TypeClassEnv = TypeClassEnv
-- name of the type class they belong to, and the constraint is used to
-- make sure that they have the correct type if they get promoted.
--
- envUnhandledMembers :: [(Text, P.Constraint, ChildDeclaration)]
+ envUnhandledMembers :: [(Text, Constraint', ChildDeclaration)]
-- |
-- A list of normal value declarations. Type class members will be added to
-- this list if their parent type class is not available.
@@ -468,7 +468,7 @@ handleEnv TypeClassEnv{..} =
++ T.unpack cdeclTitle)
addConstraint constraint =
- P.quantify . P.moveQuantifiersToFront . P.ConstrainedType constraint
+ P.quantify . P.moveQuantifiersToFront . P.ConstrainedType () constraint
splitMap :: Map k (v1, v2) -> (Map k v1, Map k v2)
splitMap = fmap fst &&& fmap snd
@@ -534,12 +534,12 @@ internalErrorInModule msg = do
-- If the provided Declaration is a TypeClassDeclaration, construct an
-- appropriate Constraint for use with the types of its members.
--
-typeClassConstraintFor :: Declaration -> Maybe P.Constraint
+typeClassConstraintFor :: Declaration -> Maybe Constraint'
typeClassConstraintFor Declaration{..} =
case declInfo of
TypeClassDeclaration tyArgs _ _ ->
- Just (P.Constraint (P.Qualified Nothing (P.ProperName declTitle)) (mkConstraint tyArgs) Nothing)
+ Just (P.Constraint () (P.Qualified Nothing (P.ProperName declTitle)) (mkConstraint tyArgs) Nothing)
_ ->
Nothing
where
- mkConstraint = map (P.TypeVar . fst)
+ mkConstraint = map (P.TypeVar () . fst)
diff --git a/src/Language/PureScript/Docs/Convert/Single.hs b/src/Language/PureScript/Docs/Convert/Single.hs
index 045fe34..608c02f 100644
--- a/src/Language/PureScript/Docs/Convert/Single.hs
+++ b/src/Language/PureScript/Docs/Convert/Single.hs
@@ -7,6 +7,7 @@ import Protolude hiding (moduleName)
import Control.Category ((>>>))
+import Data.Functor (($>))
import qualified Data.Text as T
import Language.PureScript.Docs.Types
@@ -110,33 +111,34 @@ basicDeclaration sa title = Just . Right . mkDeclaration sa title
convertDeclaration :: P.Declaration -> Text -> Maybe IntermediateDeclaration
convertDeclaration (P.ValueDecl sa _ _ _ [P.MkUnguarded (P.TypedValue _ _ ty)]) title =
- basicDeclaration sa title (ValueDeclaration ty)
+ basicDeclaration sa title (ValueDeclaration (ty $> ()))
convertDeclaration (P.ValueDecl sa _ _ _ _) title =
-- If no explicit type declaration was provided, insert a wildcard, so that
-- the actual type will be added during type checking.
- basicDeclaration sa title (ValueDeclaration (P.TypeWildcard (fst sa)))
+ basicDeclaration sa title (ValueDeclaration (P.TypeWildcard () Nothing))
convertDeclaration (P.ExternDeclaration sa _ ty) title =
- basicDeclaration sa title (ValueDeclaration ty)
+ basicDeclaration sa title (ValueDeclaration (ty $> ()))
convertDeclaration (P.DataDeclaration sa dtype _ args ctors) title =
Just (Right (mkDeclaration sa title info) { declChildren = children })
where
- info = DataDeclaration dtype args
- children = map convertCtor ctors
+ info = DataDeclaration dtype (fmap (fmap (fmap ($> ()))) args)
+ children = map convertCtor (fmap (fmap (fmap ($> ()))) ctors)
convertCtor (ctor', tys) =
ChildDeclaration (P.runProperName ctor') Nothing Nothing (ChildDataConstructor tys)
convertDeclaration (P.ExternDataDeclaration sa _ kind') title =
- basicDeclaration sa title (ExternDataDeclaration kind')
+ basicDeclaration sa title (ExternDataDeclaration (kind' $> ()))
convertDeclaration (P.ExternKindDeclaration sa _) title =
basicDeclaration sa title ExternKindDeclaration
convertDeclaration (P.TypeSynonymDeclaration sa _ args ty) title =
- basicDeclaration sa title (TypeSynonymDeclaration args ty)
+ basicDeclaration sa title (TypeSynonymDeclaration (fmap (fmap (fmap ($> ()))) args) (ty $> ()))
convertDeclaration (P.TypeClassDeclaration sa _ args implies fundeps ds) title =
Just (Right (mkDeclaration sa title info) { declChildren = children })
where
- info = TypeClassDeclaration args implies (convertFundepsToStrings args fundeps)
+ args' = fmap (fmap (fmap ($> ()))) args
+ info = TypeClassDeclaration args' (fmap ($> ()) implies) (convertFundepsToStrings args' fundeps)
children = map convertClassMember ds
convertClassMember (P.TypeDeclaration (P.TypeDeclarationData (ss, com) ident' ty)) =
- ChildDeclaration (P.showIdent ident') (convertComments com) (Just ss) (ChildTypeClassMember ty)
+ ChildDeclaration (P.showIdent ident') (convertComments com) (Just ss) (ChildTypeClassMember (ty $> ()))
convertClassMember _ =
P.internalError "convertDeclaration: Invalid argument to convertClassMember."
convertDeclaration (P.TypeInstanceDeclaration (ss, com) _ _ _ constraints className tys _) title =
@@ -146,11 +148,11 @@ convertDeclaration (P.TypeInstanceDeclaration (ss, com) _ _ _ constraints classN
typeNameStrings = ordNub (concatMap (P.everythingOnTypes (++) extractProperNames) tys)
unQual x = let (P.Qualified _ y) = x in P.runProperName y
- extractProperNames (P.TypeConstructor n) = [unQual n]
+ extractProperNames (P.TypeConstructor _ n) = [unQual n]
extractProperNames _ = []
- childDecl = ChildDeclaration title (convertComments com) (Just ss) (ChildInstance constraints classApp)
- classApp = foldl' P.TypeApp (P.TypeConstructor (fmap P.coerceProperName className)) tys
+ childDecl = ChildDeclaration title (convertComments com) (Just ss) (ChildInstance (fmap ($> ()) constraints) (classApp $> ()))
+ classApp = foldl' P.srcTypeApp (P.srcTypeConstructor (fmap P.coerceProperName className)) tys
convertDeclaration (P.ValueFixityDeclaration sa fixity (P.Qualified mn alias) _) title =
Just . Right $ mkDeclaration sa title (AliasDeclaration fixity (P.Qualified mn (Right alias)))
convertDeclaration (P.TypeFixityDeclaration sa fixity (P.Qualified mn alias) _) title =
diff --git a/src/Language/PureScript/Docs/Prim.hs b/src/Language/PureScript/Docs/Prim.hs
index a6ee336..9d1b04d 100644
--- a/src/Language/PureScript/Docs/Prim.hs
+++ b/src/Language/PureScript/Docs/Prim.hs
@@ -7,6 +7,7 @@ module Language.PureScript.Docs.Prim
) where
import Prelude.Compat hiding (fail)
+import Data.Functor (($>))
import Data.Text (Text)
import qualified Data.Text as T
import qualified Data.Map as Map
@@ -17,6 +18,7 @@ import qualified Language.PureScript as P
primModules :: [Module]
primModules =
[ primDocsModule
+ , primBooleanDocsModule
, primOrderingDocsModule
, primRowDocsModule
, primRowListDocsModule
@@ -27,7 +29,11 @@ primModules =
primDocsModule :: Module
primDocsModule = Module
{ modName = P.moduleNameFromString "Prim"
- , modComments = Just "The Prim module is embedded in the PureScript compiler in order to provide compiler support for certain types &mdash; for example, value literals, or syntax sugar. It is implicitly imported unqualified in every module except those that list it as a qualified import."
+ , modComments = Just $ T.unlines
+ [ "The `Prim` module is embedded in the PureScript compiler in order to provide compiler support for certain types &mdash; for example, value literals, or syntax sugar. It is implicitly imported unqualified in every module except those that list it as a qualified import."
+ , ""
+ , "`Prim` does not include additional built-in types and kinds that are defined deeper in the compiler. For example, row kinds (e.g. `# Type`, which is the kind of types such as `(name :: String, age :: Int)`), Type wildcards (e.g. `f :: _ -> Int`), and Quantified Types. Rather, these are documented in [the PureScript language reference](https://github.com/purescript/documentation/blob/master/language/Types.md)."
+ ]
, modDeclarations =
[ function
, array
@@ -44,10 +50,22 @@ primDocsModule = Module
, modReExports = []
}
+primBooleanDocsModule :: Module
+primBooleanDocsModule = Module
+ { modName = P.moduleNameFromString "Prim.Boolean"
+ , modComments = Just "The Prim.Boolean module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains a type level `Boolean` data structure."
+ , modDeclarations =
+ [ kindBoolean
+ , booleanTrue
+ , booleanFalse
+ ]
+ , modReExports = []
+ }
+
primOrderingDocsModule :: Module
primOrderingDocsModule = Module
{ modName = P.moduleNameFromString "Prim.Ordering"
- , modComments = Just "The Prim.Row module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains a type level `Ordering` data structure."
+ , modComments = Just "The Prim.Ordering module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains a type level `Ordering` data structure."
, modDeclarations =
[ kindOrdering
, orderingLT
@@ -150,9 +168,10 @@ primKind = primKindOf P.primName
lookupPrimTypeKindOf
:: NameGen 'P.TypeName
-> Text
- -> P.Kind
-lookupPrimTypeKindOf k = fst . unsafeLookupOf k
+ -> Kind'
+lookupPrimTypeKindOf k = ($> ()) . fst . unsafeLookupOf k
( P.primTypes <>
+ P.primBooleanTypes <>
P.primOrderingTypes <>
P.primRowTypes <>
P.primRowListTypes <>
@@ -194,8 +213,8 @@ primClassOf gen title comments = Declaration
, declInfo =
let
tcd = lookupPrimClassOf gen title
- args = P.typeClassArguments tcd
- superclasses = P.typeClassSuperclasses tcd
+ args = fmap (fmap (fmap ($> ()))) $ P.typeClassArguments tcd
+ superclasses = fmap ($> ()) $ P.typeClassSuperclasses tcd
fundeps = convertFundepsToStrings args (P.typeClassDependencies tcd)
in
TypeClassDeclaration args superclasses fundeps
@@ -203,8 +222,7 @@ primClassOf gen title comments = Declaration
kindType :: Declaration
kindType = primKind "Type" $ T.unlines
- [ "`Type` (also known as `*`) is the kind of all proper types: those that"
- , "classify value-level terms."
+ [ "`Type` is the kind of all proper types: those that classify value-level terms."
, "For example the type `Boolean` has kind `Type`; denoted by `Boolean :: Type`."
]
@@ -330,6 +348,21 @@ partial = primClass "Partial" $ T.unlines
, "[the Partial type class guide](https://github.com/purescript/documentation/blob/master/guides/The-Partial-type-class.md)."
]
+kindBoolean :: Declaration
+kindBoolean = primKindOf (P.primSubName "Boolean") "Boolean" $ T.unlines
+ [ "The `Boolean` kind provides True/False types at the type level"
+ ]
+
+booleanTrue :: Declaration
+booleanTrue = primTypeOf (P.primSubName "Boolean") "True" $ T.unlines
+ [ "The 'True' boolean type."
+ ]
+
+booleanFalse :: Declaration
+booleanFalse = primTypeOf (P.primSubName "Boolean") "False" $ T.unlines
+ [ "The 'False' boolean type."
+ ]
+
kindOrdering :: Declaration
kindOrdering = primKindOf (P.primSubName "Ordering") "Ordering" $ T.unlines
[ "The `Ordering` kind represents the three possibilites of comparing two"
@@ -489,4 +522,3 @@ aboveDoc = primTypeOf (P.primSubName "TypeError") "Above" $ T.unlines
, "For more information, see"
, "[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md)."
]
-
diff --git a/src/Language/PureScript/Docs/Render.hs b/src/Language/PureScript/Docs/Render.hs
index c0c6565..6e37c20 100644
--- a/src/Language/PureScript/Docs/Render.hs
+++ b/src/Language/PureScript/Docs/Render.hs
@@ -21,36 +21,33 @@ import Language.PureScript.Docs.Utils.MonoidExtras
import qualified Language.PureScript as P
renderDeclaration :: Declaration -> RenderedCode
-renderDeclaration = renderDeclarationWithOptions defaultRenderTypeOptions
-
-renderDeclarationWithOptions :: RenderTypeOptions -> Declaration -> RenderedCode
-renderDeclarationWithOptions opts Declaration{..} =
+renderDeclaration Declaration{..} =
mintersperse sp $ case declInfo of
ValueDeclaration ty ->
[ ident' declTitle
, syntax "::"
- , renderType' ty
+ , renderType ty
]
DataDeclaration dtype args ->
[ keyword (P.showDataDeclType dtype)
- , renderType' (typeApp declTitle args)
+ , renderType (typeApp declTitle args)
]
ExternDataDeclaration kind' ->
[ keywordData
- , renderType' (P.TypeConstructor (notQualified declTitle))
+ , renderType (P.TypeConstructor () (notQualified declTitle))
, syntax "::"
, renderKind kind'
]
TypeSynonymDeclaration args ty ->
[ keywordType
- , renderType' (typeApp declTitle args)
+ , renderType (typeApp declTitle args)
, syntax "="
- , renderType' ty
+ , renderType ty
]
TypeClassDeclaration args implies fundeps ->
[ keywordClass ]
++ maybeToList superclasses
- ++ [renderType' (typeApp declTitle args)]
+ ++ [renderType (typeApp declTitle args)]
++ fundepsList
++ [keywordWhere | any isTypeClassMember declChildren]
@@ -84,43 +81,27 @@ renderDeclarationWithOptions opts Declaration{..} =
, kind (notQualified declTitle)
]
- where
- renderType' :: P.Type -> RenderedCode
- renderType' = renderTypeWithOptions opts
-
renderChildDeclaration :: ChildDeclaration -> RenderedCode
-renderChildDeclaration = renderChildDeclarationWithOptions defaultRenderTypeOptions
-
-renderChildDeclarationWithOptions :: RenderTypeOptions -> ChildDeclaration -> RenderedCode
-renderChildDeclarationWithOptions opts ChildDeclaration{..} =
+renderChildDeclaration ChildDeclaration{..} =
mintersperse sp $ case cdeclInfo of
ChildInstance constraints ty ->
- maybeToList (renderConstraints constraints) ++ [ renderType' ty ]
+ maybeToList (renderConstraints constraints) ++ [ renderType ty ]
ChildDataConstructor args ->
[ dataCtor' cdeclTitle ]
- ++ map renderTypeAtom' args
+ ++ map renderTypeAtom args
ChildTypeClassMember ty ->
[ ident' cdeclTitle
, syntax "::"
- , renderType' ty
+ , renderType ty
]
- where
- renderType' = renderTypeWithOptions opts
- renderTypeAtom' = renderTypeAtomWithOptions opts
-
-renderConstraint :: P.Constraint -> RenderedCode
-renderConstraint = renderConstraintWithOptions defaultRenderTypeOptions
-
-renderConstraintWithOptions :: RenderTypeOptions -> P.Constraint -> RenderedCode
-renderConstraintWithOptions opts (P.Constraint pn tys _) =
- renderTypeWithOptions opts $ foldl P.TypeApp (P.TypeConstructor (fmap P.coerceProperName pn)) tys
-renderConstraints :: [P.Constraint] -> Maybe RenderedCode
-renderConstraints = renderConstraintsWithOptions defaultRenderTypeOptions
+renderConstraint :: Constraint' -> RenderedCode
+renderConstraint (P.Constraint ann pn tys _) =
+ renderType $ foldl (P.TypeApp ann) (P.TypeConstructor ann (fmap P.coerceProperName pn)) tys
-renderConstraintsWithOptions :: RenderTypeOptions -> [P.Constraint] -> Maybe RenderedCode
-renderConstraintsWithOptions opts constraints
+renderConstraints :: [Constraint'] -> Maybe RenderedCode
+renderConstraints constraints
| null constraints = Nothing
| otherwise = Just $
syntax "("
@@ -129,7 +110,7 @@ renderConstraintsWithOptions opts constraints
where
renderedConstraints =
mintersperse (syntax "," <> sp)
- (map (renderConstraintWithOptions opts) constraints)
+ (map renderConstraint constraints)
notQualified :: Text -> P.Qualified (P.ProperName a)
notQualified = P.Qualified Nothing . P.ProperName
@@ -140,12 +121,12 @@ ident' = ident . P.Qualified Nothing . P.Ident
dataCtor' :: Text -> RenderedCode
dataCtor' = dataCtor . notQualified
-typeApp :: Text -> [(Text, Maybe P.Kind)] -> P.Type
+typeApp :: Text -> [(Text, Maybe Kind')] -> Type'
typeApp title typeArgs =
- foldl P.TypeApp
- (P.TypeConstructor (notQualified title))
+ foldl (P.TypeApp ())
+ (P.TypeConstructor () (notQualified title))
(map toTypeVar typeArgs)
-toTypeVar :: (Text, Maybe P.Kind) -> P.Type
-toTypeVar (s, Nothing) = P.TypeVar s
-toTypeVar (s, Just k) = P.KindedType (P.TypeVar s) k
+toTypeVar :: (Text, Maybe Kind') -> Type'
+toTypeVar (s, Nothing) = P.TypeVar () s
+toTypeVar (s, Just k) = P.KindedType () (P.TypeVar () s) k
diff --git a/src/Language/PureScript/Docs/RenderedCode/RenderKind.hs b/src/Language/PureScript/Docs/RenderedCode/RenderKind.hs
index bbdbe8c..f4c3862 100644
--- a/src/Language/PureScript/Docs/RenderedCode/RenderKind.hs
+++ b/src/Language/PureScript/Docs/RenderedCode/RenderKind.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE ScopedTypeVariables #-}
-- | Functions for producing RenderedCode values from PureScript Kind values.
--
module Language.PureScript.Docs.RenderedCode.RenderKind
@@ -20,37 +21,37 @@ import Language.PureScript.Kinds
import Language.PureScript.Docs.RenderedCode.Types
-typeLiterals :: Pattern () Kind RenderedCode
+typeLiterals :: Pattern () (Kind a) RenderedCode
typeLiterals = mkPattern match
where
- match (KUnknown u) =
+ match (KUnknown _ u) =
Just $ typeVar $ T.cons 'k' (T.pack (show u))
- match (NamedKind n) =
+ match (NamedKind _ n) =
Just $ kind n
match _ = Nothing
-matchRow :: Pattern () Kind ((), Kind)
+matchRow :: Pattern () (Kind a) ((), Kind a)
matchRow = mkPattern match
where
- match (Row k) = Just ((), k)
+ match (Row _ k) = Just ((), k)
match _ = Nothing
-funKind :: Pattern () Kind (Kind, Kind)
+funKind :: Pattern () (Kind a) (Kind a, Kind a)
funKind = mkPattern match
where
- match (FunKind arg ret) = Just (arg, ret)
+ match (FunKind _ arg ret) = Just (arg, ret)
match _ = Nothing
-- | Generate RenderedCode value representing a Kind
-renderKind :: Kind -> RenderedCode
+renderKind :: forall a. Kind a -> RenderedCode
renderKind
= fromMaybe (internalError "Incomplete pattern")
. PA.pattern matchKind ()
where
- matchKind :: Pattern () Kind RenderedCode
+ matchKind :: Pattern () (Kind a) RenderedCode
matchKind = buildPrettyPrinter operators (typeLiterals <+> fmap parens matchKind)
- operators :: OperatorTable () Kind RenderedCode
+ operators :: OperatorTable () (Kind a) RenderedCode
operators =
OperatorTable [ [ Wrap matchRow $ \_ k -> syntax "#" <> sp <> k]
, [ AssocR funKind $ \arg ret -> arg <> sp <> syntax "->" <> sp <> ret ] ]
diff --git a/src/Language/PureScript/Docs/RenderedCode/RenderType.hs b/src/Language/PureScript/Docs/RenderedCode/RenderType.hs
index 3857dfd..be5753d 100644
--- a/src/Language/PureScript/Docs/RenderedCode/RenderType.hs
+++ b/src/Language/PureScript/Docs/RenderedCode/RenderType.hs
@@ -2,12 +2,10 @@
module Language.PureScript.Docs.RenderedCode.RenderType
( renderType
+ , renderType'
, renderTypeAtom
+ , renderTypeAtom'
, renderRow
- , RenderTypeOptions(..)
- , defaultRenderTypeOptions
- , renderTypeWithOptions
- , renderTypeAtomWithOptions
) where
import Prelude.Compat
@@ -19,52 +17,51 @@ import Control.Arrow ((<+>))
import Control.PatternArrows as PA
import Language.PureScript.Crash
-import Language.PureScript.Environment
import Language.PureScript.Kinds
+import Language.PureScript.Label
import Language.PureScript.Names
import Language.PureScript.Pretty.Types
import Language.PureScript.Types
-import Language.PureScript.Label (Label)
import Language.PureScript.PSString (prettyPrintString)
import Language.PureScript.Docs.RenderedCode.Types
import Language.PureScript.Docs.Utils.MonoidExtras
import Language.PureScript.Docs.RenderedCode.RenderKind (renderKind)
-typeLiterals :: Pattern () Type RenderedCode
+typeLiterals :: Pattern () PrettyPrintType RenderedCode
typeLiterals = mkPattern match
where
- match TypeWildcard{} =
- Just (syntax "_")
- match (TypeVar var) =
+ match (PPTypeWildcard name) =
+ Just $ maybe (syntax "_") (syntax . ("?" <>)) name
+ match (PPTypeVar var) =
Just (typeVar var)
- match (PrettyPrintObject row) =
+ match (PPRecord row) =
Just $ mintersperse sp
[ syntax "{"
, renderRow row
, syntax "}"
]
- match (TypeConstructor n) =
+ match (PPTypeConstructor n) =
Just (typeCtor n)
- match REmpty =
+ match PPREmpty =
Just (syntax "()")
- match row@RCons{} =
+ match row@PPRCons{} =
Just (syntax "(" <> renderRow row <> syntax ")")
- match (BinaryNoParensType op l r) =
- Just $ renderTypeAtom l <> sp <> renderTypeAtom op <> sp <> renderTypeAtom r
- match (TypeOp n) =
+ match (PPBinaryNoParensType op l r) =
+ Just $ renderTypeAtom' l <> sp <> renderTypeAtom' op <> sp <> renderTypeAtom' r
+ match (PPTypeOp n) =
Just (typeOp n)
- match (TypeLevelString str) =
+ match (PPTypeLevelString str) =
Just (syntax (prettyPrintString str))
match _ =
Nothing
-renderConstraint :: Constraint -> RenderedCode
-renderConstraint (Constraint pn tys _) =
- let instApp = foldl TypeApp (TypeConstructor (fmap coerceProperName pn)) tys
- in renderType instApp
+renderConstraint :: PrettyPrintConstraint -> RenderedCode
+renderConstraint (pn, tys) =
+ let instApp = foldl PPTypeApp (PPTypeConstructor (fmap coerceProperName pn)) tys
+ in renderType' instApp
-renderConstraints :: Constraint -> RenderedCode -> RenderedCode
+renderConstraints :: PrettyPrintConstraint -> RenderedCode -> RenderedCode
renderConstraints con ty =
mintersperse sp
[ renderConstraint con
@@ -75,65 +72,68 @@ renderConstraints con ty =
-- |
-- Render code representing a Row
--
-renderRow :: Type -> RenderedCode
-renderRow = uncurry renderRow' . rowToList
+renderRow :: PrettyPrintType -> RenderedCode
+renderRow = uncurry renderRow' . go []
where
renderRow' h t = renderHead h <> renderTail t
-renderHead :: [(Label, Type)] -> RenderedCode
+ go ts (PPRCons l t r) = go ((l, t) : ts) r
+ go ts t = (reverse ts, t)
+
+renderHead :: [(Label, PrettyPrintType)] -> RenderedCode
renderHead = mintersperse (syntax "," <> sp) . map renderLabel
-renderLabel :: (Label, Type) -> RenderedCode
+renderLabel :: (Label, PrettyPrintType) -> RenderedCode
renderLabel (label, ty) =
mintersperse sp
[ typeVar $ prettyPrintLabel label
, syntax "::"
- , renderType ty
+ , renderType' ty
]
-renderTail :: Type -> RenderedCode
-renderTail REmpty = mempty
-renderTail other = sp <> syntax "|" <> sp <> renderType other
+renderTail :: PrettyPrintType -> RenderedCode
+renderTail PPREmpty = mempty
+renderTail other = sp <> syntax "|" <> sp <> renderType' other
-typeApp :: Pattern () Type (Type, Type)
+typeApp :: Pattern () PrettyPrintType (PrettyPrintType, PrettyPrintType)
typeApp = mkPattern match
where
- match (TypeApp f x) = Just (f, x)
+ match (PPTypeApp f x) = Just (f, x)
match _ = Nothing
-appliedFunction :: Pattern () Type (Type, Type)
+appliedFunction :: Pattern () PrettyPrintType (PrettyPrintType, PrettyPrintType)
appliedFunction = mkPattern match
where
- match (PrettyPrintFunction arg ret) = Just (arg, ret)
+ match (PPFunction arg ret) = Just (arg, ret)
match _ = Nothing
-kinded :: Pattern () Type (Kind, Type)
+kinded :: Pattern () PrettyPrintType (Kind (), PrettyPrintType)
kinded = mkPattern match
where
- match (KindedType t k) = Just (k, t)
+ match (PPKindedType t k) = Just (k, t)
match _ = Nothing
-constrained :: Pattern () Type (Constraint, Type)
+constrained :: Pattern () PrettyPrintType (PrettyPrintConstraint, PrettyPrintType)
constrained = mkPattern match
where
- match (ConstrainedType con ty) = Just (con, ty)
+ match (PPConstrainedType con ty) = Just (con, ty)
match _ = Nothing
-explicitParens :: Pattern () Type ((), Type)
+explicitParens :: Pattern () PrettyPrintType ((), PrettyPrintType)
explicitParens = mkPattern match
where
- match (ParensInType ty) = Just ((), ty)
+ match (PPParensInType ty) = Just ((), ty)
match _ = Nothing
-matchTypeAtom :: Pattern () Type RenderedCode
+matchTypeAtom :: Pattern () PrettyPrintType RenderedCode
matchTypeAtom = typeLiterals <+> fmap parens_ matchType
where
parens_ x = syntax "(" <> x <> syntax ")"
-matchType :: Pattern () Type RenderedCode
+matchType :: Pattern () PrettyPrintType RenderedCode
matchType = buildPrettyPrinter operators matchTypeAtom
where
- operators :: OperatorTable () Type RenderedCode
+ operators :: OperatorTable () PrettyPrintType RenderedCode
operators =
OperatorTable [ [ AssocL typeApp $ \f x -> f <> sp <> x ]
, [ AssocR appliedFunction $ \arg ret -> mintersperse sp [arg, syntax "->", ret] ]
@@ -143,64 +143,30 @@ matchType = buildPrettyPrinter operators matchTypeAtom
, [ Wrap explicitParens $ \_ ty -> ty ]
]
-forall_ :: Pattern () Type ([Text], Type)
+forall_ :: Pattern () PrettyPrintType ([Text], PrettyPrintType)
forall_ = mkPattern match
where
- match (PrettyPrintForAll idents ty) = Just (idents, ty)
+ match (PPForAll idents ty) = Just (idents, ty)
match _ = Nothing
-insertPlaceholders :: RenderTypeOptions -> Type -> Type
-insertPlaceholders opts =
- everywhereOnTypesTopDown convertForAlls . everywhereOnTypes (convert opts)
-
-convert :: RenderTypeOptions -> Type -> Type
-convert _ (TypeApp (TypeApp f arg) ret) | f == tyFunction = PrettyPrintFunction arg ret
-convert opts (TypeApp o r) | o == tyRecord && prettyPrintObjects opts = PrettyPrintObject r
-convert _ other = other
-
-convertForAlls :: Type -> Type
-convertForAlls (ForAll i ty _) = go [i] ty
- where
- go idents (ForAll i' ty' _) = go (i' : idents) ty'
- go idents other = PrettyPrintForAll idents other
-convertForAlls other = other
-
-preprocessType :: RenderTypeOptions -> Type -> Type
-preprocessType opts = insertPlaceholders opts
-
-
-- |
-- Render code representing a Type
--
-renderType :: Type -> RenderedCode
-renderType = renderTypeWithOptions defaultRenderTypeOptions
+renderType :: Type a -> RenderedCode
+renderType = renderType' . convertPrettyPrintType
+
+renderType' :: PrettyPrintType -> RenderedCode
+renderType'
+ = fromMaybe (internalError "Incomplete pattern")
+ . PA.pattern matchType ()
-- |
-- Render code representing a Type, as it should appear inside parentheses
--
-renderTypeAtom :: Type -> RenderedCode
-renderTypeAtom = renderTypeAtomWithOptions defaultRenderTypeOptions
-
-data RenderTypeOptions = RenderTypeOptions
- { prettyPrintObjects :: Bool
- , currentModule :: Maybe ModuleName
- }
-
-defaultRenderTypeOptions :: RenderTypeOptions
-defaultRenderTypeOptions =
- RenderTypeOptions
- { prettyPrintObjects = True
- , currentModule = Nothing
- }
-
-renderTypeWithOptions :: RenderTypeOptions -> Type -> RenderedCode
-renderTypeWithOptions opts
- = fromMaybe (internalError "Incomplete pattern")
- . PA.pattern matchType ()
- . preprocessType opts
+renderTypeAtom :: Type a -> RenderedCode
+renderTypeAtom = renderTypeAtom' . convertPrettyPrintType
-renderTypeAtomWithOptions :: RenderTypeOptions -> Type -> RenderedCode
-renderTypeAtomWithOptions opts
+renderTypeAtom' :: PrettyPrintType -> RenderedCode
+renderTypeAtom'
= fromMaybe (internalError "Incomplete pattern")
. PA.pattern matchTypeAtom ()
- . preprocessType opts
diff --git a/src/Language/PureScript/Docs/Types.hs b/src/Language/PureScript/Docs/Types.hs
index 9bba522..16a18d5 100644
--- a/src/Language/PureScript/Docs/Types.hs
+++ b/src/Language/PureScript/Docs/Types.hs
@@ -39,6 +39,10 @@ import Language.PureScript.Docs.RenderedCode as ReExports
RenderedCodeElement(..), asRenderedCodeElement,
Namespace(..), FixityAlias)
+type Type' = P.Type ()
+type Kind' = P.Kind ()
+type Constraint' = P.Constraint ()
+
--------------------
-- Types
@@ -147,30 +151,30 @@ data DeclarationInfo
-- |
-- A value declaration, with its type.
--
- = ValueDeclaration P.Type
+ = ValueDeclaration Type'
-- |
-- A data/newtype declaration, with the kind of declaration (data or
-- newtype) and its type arguments. Constructors are represented as child
-- declarations.
--
- | DataDeclaration P.DataDeclType [(Text, Maybe P.Kind)]
+ | DataDeclaration P.DataDeclType [(Text, Maybe Kind')]
-- |
-- A data type foreign import, with its kind.
--
- | ExternDataDeclaration P.Kind
+ | ExternDataDeclaration Kind'
-- |
-- A type synonym, with its type arguments and its type.
--
- | TypeSynonymDeclaration [(Text, Maybe P.Kind)] P.Type
+ | TypeSynonymDeclaration [(Text, Maybe Kind')] Type'
-- |
-- A type class, with its type arguments, its superclasses and functional
-- dependencies. Instances and members are represented as child declarations.
--
- | TypeClassDeclaration [(Text, Maybe P.Kind)] [P.Constraint] [([Text], [Text])]
+ | TypeClassDeclaration [(Text, Maybe Kind')] [Constraint'] [([Text], [Text])]
-- |
-- An operator alias declaration, with the member the alias is for and the
@@ -186,7 +190,7 @@ data DeclarationInfo
instance NFData DeclarationInfo
-convertFundepsToStrings :: [(Text, Maybe P.Kind)] -> [P.FunctionalDependency] -> [([Text], [Text])]
+convertFundepsToStrings :: [(Text, Maybe Kind')] -> [P.FunctionalDependency] -> [([Text], [Text])]
convertFundepsToStrings args fundeps =
map (\(P.FunctionalDependency from to) -> toArgs from to) fundeps
where
@@ -287,19 +291,19 @@ data ChildDeclarationInfo
-- |
-- A type instance declaration, with its dependencies and its type.
--
- = ChildInstance [P.Constraint] P.Type
+ = ChildInstance [Constraint'] Type'
-- |
-- A data constructor, with its type arguments.
--
- | ChildDataConstructor [P.Type]
+ | ChildDataConstructor [Type']
-- |
-- A type class member, with its type. Note that the type does not include
-- the type class constraint; this may be added manually if desired. For
-- example, `pure` from `Applicative` would be `forall a. a -> f a`.
--
- | ChildTypeClassMember P.Type
+ | ChildTypeClassMember Type'
deriving (Show, Eq, Ord, Generic)
instance NFData ChildDeclarationInfo
@@ -410,18 +414,13 @@ data DocLink = DocLink
instance NFData DocLink
data LinkLocation
- -- | A link to a declaration in the same module.
- = SameModule
-
- -- | A link to a declaration in a different module, but still in the current
- -- package; we need to store the current module and the other declaration's
- -- module.
- | LocalModule P.ModuleName P.ModuleName
+ -- | A link to a declaration in the current package.
+ = LocalModule P.ModuleName
- -- | A link to a declaration in a different package. We store: current module
- -- name, name of the other package, version of the other package, and name of
- -- the module in the other package that the declaration is in.
- | DepsModule P.ModuleName PackageName Version P.ModuleName
+ -- | A link to a declaration in a different package. The arguments represent
+ -- the name of the other package, the version of the other package, and the
+ -- name of the module in the other package that the declaration is in.
+ | DepsModule PackageName Version P.ModuleName
-- | A link to a declaration that is built in to the compiler, e.g. the Prim
-- module. In this case we only need to store the module that the builtin
@@ -450,14 +449,14 @@ getLink LinksContext{..} curMn namespace target containingMod = do
normalLinkLocation = do
case containingMod of
ThisModule ->
- return SameModule
+ return $ LocalModule curMn
OtherModule destMn ->
case Map.lookup destMn ctxModuleMap of
Nothing ->
- return $ LocalModule curMn destMn
+ return $ LocalModule destMn
Just pkgName -> do
pkgVersion <- lookup pkgName ctxResolvedDependencies
- return $ DepsModule curMn pkgName pkgVersion destMn
+ return $ DepsModule pkgName pkgVersion destMn
builtinLinkLocation =
case containingMod of
@@ -652,15 +651,15 @@ asDeclarationInfo = do
other ->
throwCustomError (InvalidDeclarationType other)
-asTypeArguments :: Parse PackageError [(Text, Maybe P.Kind)]
+asTypeArguments :: Parse PackageError [(Text, Maybe Kind')]
asTypeArguments = eachInArray asTypeArgument
where
asTypeArgument = (,) <$> nth 0 asText <*> nth 1 (perhaps asKind)
-asKind :: Parse PackageError P.Kind
-asKind = P.kindFromJSON .! InvalidKind
+asKind :: Parse PackageError Kind'
+asKind = fromAesonParser .! InvalidKind
-asType :: Parse e P.Type
+asType :: Parse e Type'
asType = fromAesonParser
asFunDeps :: Parse PackageError [([Text], [Text])]
@@ -700,10 +699,10 @@ asSourcePos :: Parse e P.SourcePos
asSourcePos = P.SourcePos <$> nth 0 asIntegral
<*> nth 1 asIntegral
-asConstraint :: Parse PackageError P.Constraint
-asConstraint = P.Constraint <$> key "constraintClass" asQualifiedProperName
- <*> key "constraintArgs" (eachInArray asType)
- <*> pure Nothing
+asConstraint :: Parse PackageError Constraint'
+asConstraint = P.Constraint () <$> key "constraintClass" asQualifiedProperName
+ <*> key "constraintArgs" (eachInArray asType)
+ <*> pure Nothing
asQualifiedProperName :: Parse e (P.Qualified (P.ProperName a))
asQualifiedProperName = fromAesonParser
@@ -711,6 +710,9 @@ asQualifiedProperName = fromAesonParser
asQualifiedIdent :: Parse e (P.Qualified P.Ident)
asQualifiedIdent = fromAesonParser
+asSourceAnn :: Parse e (P.SourceAnn)
+asSourceAnn = fromAesonParser
+
asModuleMap :: Parse PackageError (Map P.ModuleName PackageName)
asModuleMap =
Map.fromList <$>
diff --git a/src/Language/PureScript/Environment.hs b/src/Language/PureScript/Environment.hs
index c806470..3e9505a 100644
--- a/src/Language/PureScript/Environment.hs
+++ b/src/Language/PureScript/Environment.hs
@@ -17,7 +17,9 @@ import qualified Data.Text as T
import Data.Tree (Tree, rootLabel)
import qualified Data.Graph as G
import Data.Foldable (toList, fold)
+import qualified Data.List.NonEmpty as NEL
+import Language.PureScript.AST.SourcePos
import Language.PureScript.Crash
import Language.PureScript.Kinds
import Language.PureScript.Names
@@ -27,16 +29,16 @@ import qualified Language.PureScript.Constants as C
-- | The @Environment@ defines all values and types which are currently in scope:
data Environment = Environment
- { names :: M.Map (Qualified Ident) (Type, NameKind, NameVisibility)
+ { names :: M.Map (Qualified Ident) (SourceType, NameKind, NameVisibility)
-- ^ Values currently in scope
- , types :: M.Map (Qualified (ProperName 'TypeName)) (Kind, TypeKind)
+ , types :: M.Map (Qualified (ProperName 'TypeName)) (SourceKind, TypeKind)
-- ^ Type names currently in scope
- , dataConstructors :: M.Map (Qualified (ProperName 'ConstructorName)) (DataDeclType, ProperName 'TypeName, Type, [Ident])
+ , dataConstructors :: M.Map (Qualified (ProperName 'ConstructorName)) (DataDeclType, ProperName 'TypeName, SourceType, [Ident])
-- ^ Data constructors currently in scope, along with their associated type
-- constructor name, argument types and return type.
- , typeSynonyms :: M.Map (Qualified (ProperName 'TypeName)) ([(Text, Maybe Kind)], Type)
+ , typeSynonyms :: M.Map (Qualified (ProperName 'TypeName)) ([(Text, Maybe SourceKind)], SourceType)
-- ^ Type synonyms currently in scope
- , typeClassDictionaries :: M.Map (Maybe ModuleName) (M.Map (Qualified (ProperName 'ClassName)) (M.Map (Qualified Ident) NamedDict))
+ , typeClassDictionaries :: M.Map (Maybe ModuleName) (M.Map (Qualified (ProperName 'ClassName)) (M.Map (Qualified Ident) (NEL.NonEmpty NamedDict)))
-- ^ Available type class dictionaries. When looking up 'Nothing' in the
-- outer map, this returns the map of type class dictionaries in local
-- scope (ie dictionaries brought in by a constrained type).
@@ -50,13 +52,13 @@ instance NFData Environment
-- | Information about a type class
data TypeClassData = TypeClassData
- { typeClassArguments :: [(Text, Maybe Kind)]
+ { typeClassArguments :: [(Text, Maybe SourceKind)]
-- ^ A list of type argument names, and their kinds, where kind annotations
-- were provided.
- , typeClassMembers :: [(Ident, Type)]
+ , typeClassMembers :: [(Ident, SourceType)]
-- ^ A list of type class members and their types. Type arguments listed above
-- are considered bound in these types.
- , typeClassSuperclasses :: [Constraint]
+ , typeClassSuperclasses :: [SourceConstraint]
-- ^ A list of superclasses of this type class. Type arguments listed above
-- are considered bound in the types appearing in these constraints.
, typeClassDependencies :: [FunctionalDependency]
@@ -119,9 +121,9 @@ initEnvironment = Environment M.empty allPrimTypes M.empty M.empty M.empty allPr
-- determine X that X does not determine. This is the same thing: everything X determines includes everything
-- in its SCC, and everything determining X is either before it in an SCC path, or in the same SCC.
makeTypeClassData
- :: [(Text, Maybe Kind)]
- -> [(Ident, Type)]
- -> [Constraint]
+ :: [(Text, Maybe SourceKind)]
+ -> [(Ident, SourceType)]
+ -> [SourceConstraint]
-> [FunctionalDependency]
-> TypeClassData
makeTypeClassData args m s deps = TypeClassData args m s deps determinedArgs coveringSets
@@ -196,7 +198,7 @@ instance NFData NameKind
-- | The kinds of a type
data TypeKind
- = DataType [(Text, Maybe Kind)] [(ProperName 'ConstructorName, [Type])]
+ = DataType [(Text, Maybe SourceKind)] [(ProperName 'ConstructorName, [SourceType])]
-- ^ Data type
| TypeSynonym
-- ^ Type synonym
@@ -266,87 +268,97 @@ primSubName :: Text -> Text -> Qualified (ProperName a)
primSubName sub =
Qualified (Just $ ModuleName [ProperName C.prim, ProperName sub]) . ProperName
-primKind :: Text -> Kind
-primKind = NamedKind . primName
+primKind :: Text -> SourceKind
+primKind = NamedKind nullSourceAnn . primName
-primSubKind :: Text -> Text -> Kind
-primSubKind sub = NamedKind . primSubName sub
+primSubKind :: Text -> Text -> SourceKind
+primSubKind sub = NamedKind nullSourceAnn . primSubName sub
-- | Kind of ground types
-kindType :: Kind
+kindType :: SourceKind
kindType = primKind C.typ
--- To make reading the kind signatures below easier
-kindConstraint :: Kind
+kindConstraint :: SourceKind
kindConstraint = kindType
-(-:>) :: Kind -> Kind -> Kind
-(-:>) = FunKind
+isKindType :: Kind a -> Bool
+isKindType (NamedKind _ n) = n == primName C.typ
+isKindType _ = False
+
+-- To make reading the kind signatures below easier
+(-:>) :: SourceKind -> SourceKind -> SourceKind
+(-:>) = FunKind nullSourceAnn
infixr 4 -:>
-kindSymbol :: Kind
+kindSymbol :: SourceKind
kindSymbol = primKind C.symbol
-kindDoc :: Kind
+kindDoc :: SourceKind
kindDoc = primSubKind C.typeError C.doc
-kindOrdering :: Kind
+kindBoolean :: SourceKind
+kindBoolean = primSubKind C.moduleBoolean C.kindBoolean
+
+kindOrdering :: SourceKind
kindOrdering = primSubKind C.moduleOrdering C.kindOrdering
-kindRowList :: Kind
+kindRowList :: SourceKind
kindRowList = primSubKind C.moduleRowList C.kindRowList
+kindRow :: SourceKind -> SourceKind
+kindRow = Row nullSourceAnn
+
-- | Construct a type in the Prim module
-primTy :: Text -> Type
-primTy = TypeConstructor . primName
+primTy :: Text -> SourceType
+primTy = TypeConstructor nullSourceAnn . primName
-- | Type constructor for functions
-tyFunction :: Type
+tyFunction :: SourceType
tyFunction = primTy "Function"
-- | Type constructor for strings
-tyString :: Type
+tyString :: SourceType
tyString = primTy "String"
-- | Type constructor for strings
-tyChar :: Type
+tyChar :: SourceType
tyChar = primTy "Char"
-- | Type constructor for numbers
-tyNumber :: Type
+tyNumber :: SourceType
tyNumber = primTy "Number"
-- | Type constructor for integers
-tyInt :: Type
+tyInt :: SourceType
tyInt = primTy "Int"
-- | Type constructor for booleans
-tyBoolean :: Type
+tyBoolean :: SourceType
tyBoolean = primTy "Boolean"
-- | Type constructor for arrays
-tyArray :: Type
+tyArray :: SourceType
tyArray = primTy "Array"
-- | Type constructor for records
-tyRecord :: Type
+tyRecord :: SourceType
tyRecord = primTy "Record"
-- | Check whether a type is a record
-isObject :: Type -> Bool
+isObject :: Type a -> Bool
isObject = isTypeOrApplied tyRecord
-- | Check whether a type is a function
-isFunction :: Type -> Bool
+isFunction :: Type a -> Bool
isFunction = isTypeOrApplied tyFunction
-isTypeOrApplied :: Type -> Type -> Bool
-isTypeOrApplied t1 (TypeApp t2 _) = t1 == t2
-isTypeOrApplied t1 t2 = t1 == t2
+isTypeOrApplied :: Type a -> Type b -> Bool
+isTypeOrApplied t1 (TypeApp _ t2 _) = eqType t1 t2
+isTypeOrApplied t1 t2 = eqType t1 t2
-- | Smart constructor for function types
-function :: Type -> Type -> Type
-function t1 = TypeApp (TypeApp tyFunction t1)
+function :: SourceType -> SourceType -> SourceType
+function t1 t2 = TypeApp nullSourceAnn (TypeApp nullSourceAnn tyFunction t1) t2
-- | Kinds in @Prim@
primKinds :: S.Set (Qualified (ProperName 'KindName))
@@ -355,6 +367,12 @@ primKinds = S.fromList
, primName C.symbol
]
+-- | Kinds in @Prim.Boolean@
+primBooleanKinds :: S.Set (Qualified (ProperName 'KindName))
+primBooleanKinds = S.fromList
+ [ primSubName C.moduleBoolean C.kindBoolean
+ ]
+
-- | Kinds in @Prim.Ordering@
primOrderingKinds :: S.Set (Qualified (ProperName 'KindName))
primOrderingKinds = S.fromList
@@ -377,6 +395,7 @@ primTypeErrorKinds = S.fromList
allPrimKinds :: S.Set (Qualified (ProperName 'KindName))
allPrimKinds = fold
[ primKinds
+ , primBooleanKinds
, primOrderingKinds
, primRowListKinds
, primTypeErrorKinds
@@ -385,11 +404,11 @@ allPrimKinds = fold
-- | The primitive types in the external javascript environment with their
-- associated kinds. There are also pseudo `Fail`, `Warn`, and `Partial` types
-- that correspond to the classes with the same names.
-primTypes :: M.Map (Qualified (ProperName 'TypeName)) (Kind, TypeKind)
+primTypes :: M.Map (Qualified (ProperName 'TypeName)) (SourceKind, TypeKind)
primTypes = M.fromList
[ (primName "Function", (kindType -:> kindType -:> kindType, ExternData))
, (primName "Array", (kindType -:> kindType, ExternData))
- , (primName "Record", (Row kindType -:> kindType, ExternData))
+ , (primName "Record", (kindRow kindType -:> kindType, ExternData))
, (primName "String", (kindType, ExternData))
, (primName "Char", (kindType, ExternData))
, (primName "Number", (kindType, ExternData))
@@ -399,9 +418,10 @@ primTypes = M.fromList
]
-- | This 'Map' contains all of the prim types from all Prim modules.
-allPrimTypes :: M.Map (Qualified (ProperName 'TypeName)) (Kind, TypeKind)
+allPrimTypes :: M.Map (Qualified (ProperName 'TypeName)) (SourceKind, TypeKind)
allPrimTypes = M.unions
[ primTypes
+ , primBooleanTypes
, primOrderingTypes
, primRowTypes
, primRowListTypes
@@ -409,7 +429,14 @@ allPrimTypes = M.unions
, primTypeErrorTypes
]
-primOrderingTypes :: M.Map (Qualified (ProperName 'TypeName)) (Kind, TypeKind)
+primBooleanTypes :: M.Map (Qualified (ProperName 'TypeName)) (SourceKind, TypeKind)
+primBooleanTypes =
+ M.fromList
+ [ (primSubName C.moduleBoolean "True", (kindBoolean, ExternData))
+ , (primSubName C.moduleBoolean "False", (kindBoolean, ExternData))
+ ]
+
+primOrderingTypes :: M.Map (Qualified (ProperName 'TypeName)) (SourceKind, TypeKind)
primOrderingTypes =
M.fromList
[ (primSubName C.moduleOrdering "LT", (kindOrdering, ExternData))
@@ -417,24 +444,24 @@ primOrderingTypes =
, (primSubName C.moduleOrdering "GT", (kindOrdering, ExternData))
]
-primRowTypes :: M.Map (Qualified (ProperName 'TypeName)) (Kind, TypeKind)
+primRowTypes :: M.Map (Qualified (ProperName 'TypeName)) (SourceKind, TypeKind)
primRowTypes =
M.fromList
- [ (primSubName C.moduleRow "Union", (Row kindType -:> Row kindType -:> Row kindType -:> kindConstraint, ExternData))
- , (primSubName C.moduleRow "Nub", (Row kindType -:> Row kindType -:> kindConstraint, ExternData))
- , (primSubName C.moduleRow "Lacks", (kindSymbol -:> Row kindType -:> kindConstraint, ExternData))
- , (primSubName C.moduleRow "Cons", (kindSymbol -:> kindType -:> Row kindType -:> Row kindType -:> kindConstraint, ExternData))
+ [ (primSubName C.moduleRow "Union", (kindRow kindType -:> kindRow kindType -:> kindRow kindType -:> kindConstraint, ExternData))
+ , (primSubName C.moduleRow "Nub", (kindRow kindType -:> kindRow kindType -:> kindConstraint, ExternData))
+ , (primSubName C.moduleRow "Lacks", (kindSymbol -:> kindRow kindType -:> kindConstraint, ExternData))
+ , (primSubName C.moduleRow "Cons", (kindSymbol -:> kindType -:> kindRow kindType -:> kindRow kindType -:> kindConstraint, ExternData))
]
-primRowListTypes :: M.Map (Qualified (ProperName 'TypeName)) (Kind, TypeKind)
+primRowListTypes :: M.Map (Qualified (ProperName 'TypeName)) (SourceKind, TypeKind)
primRowListTypes =
M.fromList
[ (primSubName C.moduleRowList "Cons", (kindSymbol -:> kindType -:> kindRowList -:> kindRowList, ExternData))
, (primSubName C.moduleRowList "Nil", (kindRowList, ExternData))
- , (primSubName C.moduleRowList "RowToList", (Row kindType -:> kindRowList -:> kindConstraint, ExternData))
+ , (primSubName C.moduleRowList "RowToList", (kindRow kindType -:> kindRowList -:> kindConstraint, ExternData))
]
-primSymbolTypes :: M.Map (Qualified (ProperName 'TypeName)) (Kind, TypeKind)
+primSymbolTypes :: M.Map (Qualified (ProperName 'TypeName)) (SourceKind, TypeKind)
primSymbolTypes =
M.fromList
[ (primSubName C.moduleSymbol "Append", (kindSymbol -:> kindSymbol -:> kindSymbol -:> kindConstraint, ExternData))
@@ -442,7 +469,7 @@ primSymbolTypes =
, (primSubName C.moduleSymbol "Cons", (kindSymbol -:> kindSymbol -:> kindSymbol -:> kindConstraint, ExternData))
]
-primTypeErrorTypes :: M.Map (Qualified (ProperName 'TypeName)) (Kind, TypeKind)
+primTypeErrorTypes :: M.Map (Qualified (ProperName 'TypeName)) (SourceKind, TypeKind)
primTypeErrorTypes =
M.fromList
[ (primSubName C.typeError "Fail", (kindDoc -:> kindConstraint, ExternData))
@@ -477,9 +504,9 @@ primRowClasses =
M.fromList
-- class Union (left :: # Type) (right :: # Type) (union :: # Type) | left right -> union, right union -> left, union left -> right
[ (primSubName C.moduleRow "Union", makeTypeClassData
- [ ("left", Just (Row kindType))
- , ("right", Just (Row kindType))
- , ("union", Just (Row kindType))
+ [ ("left", Just (kindRow kindType))
+ , ("right", Just (kindRow kindType))
+ , ("union", Just (kindRow kindType))
] [] []
[ FunctionalDependency [0, 1] [2]
, FunctionalDependency [1, 2] [0]
@@ -488,8 +515,8 @@ primRowClasses =
-- class Nub (original :: # Type) (nubbed :: # Type) | i -> o
, (primSubName C.moduleRow "Nub", makeTypeClassData
- [ ("original", Just (Row kindType))
- , ("nubbed", Just (Row kindType))
+ [ ("original", Just (kindRow kindType))
+ , ("nubbed", Just (kindRow kindType))
] [] []
[ FunctionalDependency [0] [1]
])
@@ -497,15 +524,15 @@ primRowClasses =
-- class Lacks (label :: Symbol) (row :: # Type)
, (primSubName C.moduleRow "Lacks", makeTypeClassData
[ ("label", Just kindSymbol)
- , ("row", Just (Row kindType))
+ , ("row", Just (kindRow kindType))
] [] [] [])
-- class RowCons (label :: Symbol) (a :: Type) (tail :: # Type) (row :: # Type) | label tail a -> row, label row -> tail a
, (primSubName C.moduleRow "Cons", makeTypeClassData
[ ("label", Just kindSymbol)
, ("a", Just kindType)
- , ("tail", Just (Row kindType))
- , ("row", Just (Row kindType))
+ , ("tail", Just (kindRow kindType))
+ , ("row", Just (kindRow kindType))
] [] []
[ FunctionalDependency [0, 1, 2] [3]
, FunctionalDependency [0, 3] [1, 2]
@@ -517,7 +544,7 @@ primRowListClasses =
M.fromList
-- class RowToList (row :: # Type) (list :: RowList) | row -> list
[ (primSubName C.moduleRowList "RowToList", makeTypeClassData
- [ ("row", Just (Row kindType))
+ [ ("row", Just (kindRow kindType))
, ("list", Just kindRowList)
] [] []
[ FunctionalDependency [0] [1]
@@ -571,7 +598,7 @@ primTypeErrorClasses =
]
-- | Finds information about data constructors from the current environment.
-lookupConstructor :: Environment -> Qualified (ProperName 'ConstructorName) -> (DataDeclType, ProperName 'TypeName, Type, [Ident])
+lookupConstructor :: Environment -> Qualified (ProperName 'ConstructorName) -> (DataDeclType, ProperName 'TypeName, SourceType, [Ident])
lookupConstructor env ctor =
fromMaybe (internalError "Data constructor not found") $ ctor `M.lookup` dataConstructors env
@@ -582,5 +609,5 @@ isNewtypeConstructor e ctor = case lookupConstructor e ctor of
(Data, _, _, _) -> False
-- | Finds information about values from the current environment.
-lookupValue :: Environment -> Qualified Ident -> Maybe (Type, NameKind, NameVisibility)
+lookupValue :: Environment -> Qualified Ident -> Maybe (SourceType, NameKind, NameVisibility)
lookupValue env ident = ident `M.lookup` names env
diff --git a/src/Language/PureScript/Errors.hs b/src/Language/PureScript/Errors.hs
index d4807d6..f730b60 100644
--- a/src/Language/PureScript/Errors.hs
+++ b/src/Language/PureScript/Errors.hs
@@ -18,10 +18,11 @@ import Data.Char (isSpace)
import Data.Either (partitionEithers)
import Data.Foldable (fold)
import Data.Functor.Identity (Identity(..))
-import Data.List (transpose, nubBy, sort, partition, dropWhileEnd)
+import Data.List (transpose, nubBy, partition, dropWhileEnd, sort, sortBy)
import qualified Data.List.NonEmpty as NEL
import Data.Maybe (maybeToList, fromMaybe, mapMaybe)
import qualified Data.Map as M
+import Data.Ord (comparing)
import qualified Data.Set as S
import qualified Data.Text as T
import Data.Text (Text)
@@ -204,6 +205,15 @@ errorMessage' ss err = MultipleErrors [ErrorMessage [positionedError ss] err]
errorMessage'' :: NEL.NonEmpty SourceSpan -> SimpleErrorMessage -> MultipleErrors
errorMessage'' sss err = MultipleErrors [ErrorMessage [PositionedError sss] err]
+-- | Create an error from multiple (possibly empty) source spans, reversed sorted.
+errorMessage''' :: [SourceSpan] -> SimpleErrorMessage -> MultipleErrors
+errorMessage''' sss err =
+ maybe (errorMessage err) (flip errorMessage'' err)
+ . NEL.nonEmpty
+ . reverse
+ . sort
+ $ filter (/= NullSourceSpan) sss
+
-- | Create an error set from a single error message
singleError :: ErrorMessage -> MultipleErrors
singleError = MultipleErrors . pure
@@ -241,31 +251,31 @@ data Level = Error | Warning deriving Show
unwrapErrorMessage :: ErrorMessage -> SimpleErrorMessage
unwrapErrorMessage (ErrorMessage _ se) = se
-replaceUnknowns :: Type -> State TypeMap Type
+replaceUnknowns :: SourceType -> State TypeMap SourceType
replaceUnknowns = everywhereOnTypesM replaceTypes where
- replaceTypes :: Type -> State TypeMap Type
- replaceTypes (TUnknown u) = do
+ replaceTypes :: SourceType -> State TypeMap SourceType
+ replaceTypes (TUnknown ann u) = do
m <- get
case M.lookup u (umUnknownMap m) of
Nothing -> do
let u' = umNextIndex m
put $ m { umUnknownMap = M.insert u u' (umUnknownMap m), umNextIndex = u' + 1 }
- return (TUnknown u')
- Just u' -> return (TUnknown u')
- replaceTypes (Skolem name s sko ss) = do
+ return (TUnknown ann u')
+ Just u' -> return (TUnknown ann u')
+ replaceTypes (Skolem ann name s sko) = do
m <- get
case M.lookup s (umSkolemMap m) of
Nothing -> do
let s' = umNextIndex m
- put $ m { umSkolemMap = M.insert s (T.unpack name, s', ss) (umSkolemMap m), umNextIndex = s' + 1 }
- return (Skolem name s' sko ss)
- Just (_, s', _) -> return (Skolem name s' sko ss)
+ put $ m { umSkolemMap = M.insert s (T.unpack name, s', Just (fst ann)) (umSkolemMap m), umNextIndex = s' + 1 }
+ return (Skolem ann name s' sko)
+ Just (_, s', _) -> return (Skolem ann name s' sko)
replaceTypes other = return other
-onTypesInErrorMessage :: (Type -> Type) -> ErrorMessage -> ErrorMessage
+onTypesInErrorMessage :: (SourceType -> SourceType) -> ErrorMessage -> ErrorMessage
onTypesInErrorMessage f = runIdentity . onTypesInErrorMessageM (Identity . f)
-onTypesInErrorMessageM :: Applicative m => (Type -> m Type) -> ErrorMessage -> m ErrorMessage
+onTypesInErrorMessageM :: Applicative m => (SourceType -> m SourceType) -> ErrorMessage -> m ErrorMessage
onTypesInErrorMessageM f (ErrorMessage hints simple) = ErrorMessage <$> traverse gHint hints <*> gSimple simple
where
gSimple (InfiniteType t) = InfiniteType <$> f t
@@ -286,7 +296,7 @@ onTypesInErrorMessageM f (ErrorMessage hints simple) = ErrorMessage <$> traverse
gSimple (ExpectedType ty k) = ExpectedType <$> f ty <*> pure k
gSimple (OrphanInstance nm cl noms ts) = OrphanInstance nm cl noms <$> traverse f ts
gSimple (WildcardInferredType ty ctx) = WildcardInferredType <$> f ty <*> traverse (sndM f) ctx
- gSimple (HoleInferredType name ty ctx env) = HoleInferredType name <$> f ty <*> traverse (sndM f) ctx <*> onTypeSearchTypesM f env
+ gSimple (HoleInferredType name ty ctx env) = HoleInferredType name <$> f ty <*> traverse (sndM f) ctx <*> traverse (onTypeSearchTypesM f) env
gSimple (MissingTypeDeclaration nm ty) = MissingTypeDeclaration nm <$> f ty
gSimple (CannotGeneralizeRecursiveFunction nm ty) = CannotGeneralizeRecursiveFunction nm <$> f ty
gSimple other = pure other
@@ -585,17 +595,19 @@ prettyPrintSingleError (PPEOptions codeColor full level showDocs relPath) e = fl
renderSimpleErrorMessage (TypesDoNotUnify u1 u2)
= let (sorted1, sorted2) = sortRows u1 u2
- sortRows :: Type -> Type -> (Type, Type)
+ sortRows :: Ord a => Type a -> Type a -> (Type a, Type a)
sortRows r1@RCons{} r2@RCons{} = sortRows' (rowToList r1) (rowToList r2)
sortRows t1 t2 = (t1, t2)
-- Put the common labels last
- sortRows' :: ([(Label, Type)], Type) -> ([(Label, Type)], Type) -> (Type, Type)
+ sortRows' :: Ord a => ([RowListItem a], Type a) -> ([RowListItem a], Type a) -> (Type a, Type a)
sortRows' (s1, r1) (s2, r2) =
- let (common1, unique1) = partition (flip elem s2) s1
- (common2, unique2) = partition (flip elem s1) s2
- in ( rowFromList (sort unique1 ++ sort common1, r1)
- , rowFromList (sort unique2 ++ sort common2, r2)
+ let elem' s (RowListItem _ name ty) = any (\(RowListItem _ name' ty') -> name == name' && eqType ty ty') s
+ sort' = sortBy (comparing $ \(RowListItem _ name ty) -> (name, ty))
+ (common1, unique1) = partition (elem' s2) s1
+ (common2, unique2) = partition (elem' s1) s2
+ in ( rowFromList (sort' unique1 ++ sort' common1, r1)
+ , rowFromList (sort' unique2 ++ sort' common2, r2)
)
in paras [ line "Could not match type"
, markCodeBox $ indent $ typeAsBox sorted1
@@ -630,11 +642,11 @@ prettyPrintSingleError (PPEOptions codeColor full level showDocs relPath) e = fl
, markCodeBox $ indent $ line (showQualified runProperName nm)
, line "because the class was not in scope. Perhaps it was not exported."
]
- renderSimpleErrorMessage (NoInstanceFound (Constraint C.Fail [ ty ] _)) | Just box <- toTypelevelString ty =
+ renderSimpleErrorMessage (NoInstanceFound (Constraint _ C.Fail [ ty ] _)) | Just box <- toTypelevelString ty =
paras [ line "A custom type error occurred while solving type class constraints:"
, indent box
]
- renderSimpleErrorMessage (NoInstanceFound (Constraint C.Partial
+ renderSimpleErrorMessage (NoInstanceFound (Constraint _ C.Partial
_
(Just (PartialConstraintData bs b)))) =
paras [ line "A case expression could not be determined to cover all inputs."
@@ -645,13 +657,13 @@ prettyPrintSingleError (PPEOptions codeColor full level showDocs relPath) e = fl
: [line "..." | not b]
, line "Alternatively, add a Partial constraint to the type of the enclosing value."
]
- renderSimpleErrorMessage (NoInstanceFound (Constraint C.Discard [ty] _)) =
+ renderSimpleErrorMessage (NoInstanceFound (Constraint _ C.Discard [ty] _)) =
paras [ line "A result of type"
, markCodeBox $ indent $ typeAsBox ty
, line "was implicitly discarded in a do notation block."
, line ("You can use " <> markCode "_ <- ..." <> " to explicitly discard the result.")
]
- renderSimpleErrorMessage (NoInstanceFound (Constraint nm ts _)) =
+ renderSimpleErrorMessage (NoInstanceFound (Constraint _ nm ts _)) =
paras [ line "No type class instance was found for"
, markCodeBox $ indent $ Box.hsep 1 Box.left
[ line (showQualified runProperName nm)
@@ -662,7 +674,7 @@ prettyPrintSingleError (PPEOptions codeColor full level showDocs relPath) e = fl
]
]
where
- containsUnknowns :: Type -> Bool
+ containsUnknowns :: Type a -> Bool
containsUnknowns = everythingOnTypes (||) go
where
go TUnknown{} = True
@@ -840,7 +852,7 @@ prettyPrintSingleError (PPEOptions codeColor full level showDocs relPath) e = fl
let
maxTSResults = 15
tsResult = case ts of
- (TSAfter{tsAfterIdentifiers=idents}) | not (null idents) ->
+ Just (TSAfter{tsAfterIdentifiers=idents}) | not (null idents) ->
let
formatTS (names, types) =
let
@@ -1142,7 +1154,7 @@ prettyPrintSingleError (PPEOptions codeColor full level showDocs relPath) e = fl
paras [ detail
, line $ "in foreign import " <> markCode (showIdent nm)
]
- renderHint (ErrorSolvingConstraint (Constraint nm ts _)) detail =
+ renderHint (ErrorSolvingConstraint (Constraint _ nm ts _)) detail =
paras [ detail
, line "while solving type class constraint"
, markCodeBox $ indent $ Box.hsep 1 Box.left
@@ -1402,19 +1414,19 @@ renderBox = unlines
where
whiteSpace = all isSpace
-toTypelevelString :: Type -> Maybe Box.Box
-toTypelevelString (TypeLevelString s) =
+toTypelevelString :: Type a -> Maybe Box.Box
+toTypelevelString (TypeLevelString _ s) =
Just . Box.text $ decodeStringWithReplacement s
-toTypelevelString (TypeApp (TypeConstructor f) x)
+toTypelevelString (TypeApp _ (TypeConstructor _ f) x)
| f == primSubName C.typeError "Text" = toTypelevelString x
-toTypelevelString (TypeApp (TypeConstructor f) x)
+toTypelevelString (TypeApp _ (TypeConstructor _ f) x)
| f == primSubName C.typeError "Quote" = Just (typeAsBox x)
-toTypelevelString (TypeApp (TypeConstructor f) (TypeLevelString x))
+toTypelevelString (TypeApp _ (TypeConstructor _ f) (TypeLevelString _ x))
| f == primSubName C.typeError "QuoteLabel" = Just . line . prettyPrintLabel . Label $ x
-toTypelevelString (TypeApp (TypeApp (TypeConstructor f) x) ret)
+toTypelevelString (TypeApp _ (TypeApp _ (TypeConstructor _ f) x) ret)
| f == primSubName C.typeError "Beside" =
(Box.<>) <$> toTypelevelString x <*> toTypelevelString ret
-toTypelevelString (TypeApp (TypeApp (TypeConstructor f) x) ret)
+toTypelevelString (TypeApp _ (TypeApp _ (TypeConstructor _ f) x) ret)
| f == primSubName C.typeError "Above" =
(Box.//) <$> toTypelevelString x <*> toTypelevelString ret
toTypelevelString _ = Nothing
@@ -1443,11 +1455,15 @@ warnAndRethrowWithPosition :: (MonadError MultipleErrors m, MonadWriter Multiple
warnAndRethrowWithPosition pos = rethrowWithPosition pos . warnWithPosition pos
withPosition :: SourceSpan -> ErrorMessage -> ErrorMessage
+withPosition NullSourceSpan err = err
withPosition pos (ErrorMessage hints se) = ErrorMessage (positionedError pos : hints) se
positionedError :: SourceSpan -> ErrorMessageHint
positionedError = PositionedError . pure
+filterErrors :: (ErrorMessage -> Bool) -> MultipleErrors -> MultipleErrors
+filterErrors f = MultipleErrors . filter f . runMultipleErrors
+
-- | Runs a computation listening for warnings and then escalating any warnings
-- that match the predicate to error status.
escalateWarningWhen
diff --git a/src/Language/PureScript/Externs.hs b/src/Language/PureScript/Externs.hs
index e76e000..7de9287 100644
--- a/src/Language/PureScript/Externs.hs
+++ b/src/Language/PureScript/Externs.hs
@@ -25,6 +25,7 @@ import qualified Data.Text as T
import Data.Version (showVersion)
import qualified Data.Map as M
import qualified Data.Set as S
+import qualified Data.List.NonEmpty as NEL
import Language.PureScript.AST
import Language.PureScript.Crash
@@ -98,42 +99,42 @@ data ExternsDeclaration =
-- | A type declaration
EDType
{ edTypeName :: ProperName 'TypeName
- , edTypeKind :: Kind
+ , edTypeKind :: SourceKind
, edTypeDeclarationKind :: TypeKind
}
-- | A type synonym
| EDTypeSynonym
{ edTypeSynonymName :: ProperName 'TypeName
- , edTypeSynonymArguments :: [(Text, Maybe Kind)]
- , edTypeSynonymType :: Type
+ , edTypeSynonymArguments :: [(Text, Maybe SourceKind)]
+ , edTypeSynonymType :: SourceType
}
-- | A data construtor
| EDDataConstructor
{ edDataCtorName :: ProperName 'ConstructorName
, edDataCtorOrigin :: DataDeclType
, edDataCtorTypeCtor :: ProperName 'TypeName
- , edDataCtorType :: Type
+ , edDataCtorType :: SourceType
, edDataCtorFields :: [Ident]
}
-- | A value declaration
| EDValue
{ edValueName :: Ident
- , edValueType :: Type
+ , edValueType :: SourceType
}
-- | A type class declaration
| EDClass
{ edClassName :: ProperName 'ClassName
- , edClassTypeArguments :: [(Text, Maybe Kind)]
- , edClassMembers :: [(Ident, Type)]
- , edClassConstraints :: [Constraint]
+ , edClassTypeArguments :: [(Text, Maybe SourceKind)]
+ , edClassMembers :: [(Ident, SourceType)]
+ , edClassConstraints :: [SourceConstraint]
, edFunctionalDependencies :: [FunctionalDependency]
}
-- | An instance declaration
| EDInstance
{ edInstanceClassName :: Qualified (ProperName 'ClassName)
, edInstanceName :: Ident
- , edInstanceTypes :: [Type]
- , edInstanceConstraints :: Maybe [Constraint]
+ , edInstanceTypes :: [SourceType]
+ , edInstanceConstraints :: Maybe [SourceConstraint]
, edInstanceChain :: [Qualified Ident]
, edInstanceChainIndex :: Integer
}
@@ -154,7 +155,11 @@ applyExternsFileToEnvironment ExternsFile{..} = flip (foldl' applyDecl) efDeclar
applyDecl env (EDValue ident ty) = env { names = M.insert (Qualified (Just efModuleName) ident) (ty, External, Defined) (names env) }
applyDecl env (EDClass pn args members cs deps) = env { typeClasses = M.insert (qual pn) (makeTypeClassData args members cs deps) (typeClasses env) }
applyDecl env (EDKind pn) = env { kinds = S.insert (qual pn) (kinds env) }
- applyDecl env (EDInstance className ident tys cs ch idx) = env { typeClassDictionaries = updateMap (updateMap (M.insert (qual ident) dict) className) (Just efModuleName) (typeClassDictionaries env) }
+ applyDecl env (EDInstance className ident tys cs ch idx) =
+ env { typeClassDictionaries =
+ updateMap
+ (updateMap (M.insertWith (<>) (qual ident) (pure dict)) className)
+ (Just efModuleName) (typeClassDictionaries env) }
where
dict :: NamedDict
dict = TypeClassDictionaryInScope ch idx (qual ident) [] className tys cs
@@ -224,7 +229,8 @@ moduleToExternsFile (Module ss _ mn ds (Just exps)) env = ExternsFile{..}
= [ EDInstance tcdClassName ident tcdInstanceTypes tcdDependencies tcdChain tcdIndex
| m1 <- maybeToList (M.lookup (Just mn) (typeClassDictionaries env))
, m2 <- M.elems m1
- , TypeClassDictionaryInScope{..} <- maybeToList (M.lookup (Qualified (Just mn) ident) m2)
+ , nel <- maybeToList (M.lookup (Qualified (Just mn) ident) m2)
+ , TypeClassDictionaryInScope{..} <- NEL.toList nel
]
toExternsDeclaration (KindRef _ pn)
| Qualified (Just mn) pn `S.member` kinds env
diff --git a/src/Language/PureScript/Hierarchy.hs b/src/Language/PureScript/Hierarchy.hs
index db6b9b1..0bbe765 100644
--- a/src/Language/PureScript/Hierarchy.hs
+++ b/src/Language/PureScript/Hierarchy.hs
@@ -80,6 +80,6 @@ typeClassEpilogue = "\n}"
superClasses :: P.Declaration -> [SuperMap]
superClasses (P.TypeClassDeclaration _ sub _ supers@(_:_) _ _) =
- fmap (\(P.Constraint (P.Qualified _ super) _ _) -> SuperMap (Right (super, sub))) supers
+ fmap (\(P.Constraint _ (P.Qualified _ super) _ _) -> SuperMap (Right (super, sub))) supers
superClasses (P.TypeClassDeclaration _ sub _ _ _ _) = [SuperMap (Left sub)]
superClasses _ = []
diff --git a/src/Language/PureScript/Ide/CaseSplit.hs b/src/Language/PureScript/Ide/CaseSplit.hs
index 2493374..90f1da0 100644
--- a/src/Language/PureScript/Ide/CaseSplit.hs
+++ b/src/Language/PureScript/Ide/CaseSplit.hs
@@ -35,7 +35,7 @@ import Language.PureScript.Ide.Types
import Text.Parsec as Parsec
import qualified Text.PrettyPrint.Boxes as Box
-type Constructor = (P.ProperName 'P.ConstructorName, [P.Type])
+type Constructor = (P.ProperName 'P.ConstructorName, [P.SourceType])
newtype WildcardAnnotations = WildcardAnnotations Bool
@@ -75,11 +75,11 @@ findTypeDeclaration' t ExternsFile{..} =
_ -> False) efDeclarations
splitTypeConstructor :: (MonadError IdeError m) =>
- P.Type -> m (P.ProperName 'P.TypeName, [P.Type])
+ P.Type a -> m (P.ProperName 'P.TypeName, [P.Type a])
splitTypeConstructor = go []
where
- go acc (P.TypeApp ty arg) = go (arg : acc) ty
- go acc (P.TypeConstructor tc) = pure (P.disqualify tc, acc)
+ go acc (P.TypeApp _ ty arg) = go (arg : acc) ty
+ go acc (P.TypeConstructor _ tc) = pure (P.disqualify tc, acc)
go _ _ = throwError (GeneralError "Failed to read TypeConstructor")
prettyCtor :: WildcardAnnotations -> Constructor -> Text
@@ -88,11 +88,11 @@ prettyCtor wsa (ctorName, ctorArgs) =
"("<> P.runProperName ctorName <> " "
<> T.unwords (map (prettyPrintWildcard wsa) ctorArgs) <>")"
-prettyPrintWildcard :: WildcardAnnotations -> P.Type -> Text
+prettyPrintWildcard :: WildcardAnnotations -> P.Type a -> Text
prettyPrintWildcard (WildcardAnnotations True) = prettyWildcard
prettyPrintWildcard (WildcardAnnotations False) = const "_"
-prettyWildcard :: P.Type -> Text
+prettyWildcard :: P.Type a -> Text
prettyWildcard t = "( _ :: " <> T.strip (T.pack (P.prettyPrintTypeAtom t)) <> ")"
-- | Constructs Patterns to insert into a sourcefile
@@ -116,7 +116,7 @@ addClause s wca = do
pure [s, template]
parseType' :: (MonadError IdeError m) =>
- Text -> m P.Type
+ Text -> m P.SourceType
parseType' s =
case P.lex "<psc-ide>" (toS s) >>= P.runTokenParser "<psc-ide>" (P.parseType <* Parsec.eof) of
Right type' -> pure type'
@@ -124,7 +124,7 @@ parseType' s =
throwError (GeneralError ("Parsing the splittype failed with:"
<> show err))
-parseTypeDeclaration' :: (MonadError IdeError m) => Text -> m (P.Ident, P.Type)
+parseTypeDeclaration' :: (MonadError IdeError m) => Text -> m (P.Ident, P.SourceType)
parseTypeDeclaration' s =
let x = do
ts <- P.lex "" (toS s)
@@ -137,13 +137,13 @@ parseTypeDeclaration' s =
throwError (GeneralError ("Parsing the type signature failed with: "
<> toS (Box.render (P.prettyPrintParseError err))))
-splitFunctionType :: P.Type -> [P.Type]
+splitFunctionType :: P.Type a -> [P.Type a]
splitFunctionType t = fromMaybe [] arguments
where
arguments = initMay splitted
splitted = splitType' t
- splitType' (P.ForAll _ t' _) = splitType' t'
- splitType' (P.ConstrainedType _ t') = splitType' t'
- splitType' (P.TypeApp (P.TypeApp t' lhs) rhs)
- | t' == P.tyFunction = lhs : splitType' rhs
+ splitType' (P.ForAll _ _ t' _) = splitType' t'
+ splitType' (P.ConstrainedType _ _ t') = splitType' t'
+ splitType' (P.TypeApp _ (P.TypeApp _ t' lhs) rhs)
+ | P.eqType t' P.tyFunction = lhs : splitType' rhs
splitType' t' = [t']
diff --git a/src/Language/PureScript/Ide/Error.hs b/src/Language/PureScript/Ide/Error.hs
index 4f1a453..93d8be9 100644
--- a/src/Language/PureScript/Ide/Error.hs
+++ b/src/Language/PureScript/Ide/Error.hs
@@ -52,7 +52,7 @@ encodeRebuildErrors = toJSON . map encodeRebuildError . P.runMultipleErrors
encodeRebuildError err = case err of
(P.ErrorMessage _
((P.HoleInferredType name _ _
- (P.TSAfter{tsAfterIdentifiers=idents, tsAfterRecordFields=fields})))) ->
+ (Just (P.TSAfter{tsAfterIdentifiers=idents, tsAfterRecordFields=fields}))))) ->
insertTSCompletions name idents (fromMaybe [] fields) (toJSON (toJSONError False P.Error err))
_ ->
(toJSON . toJSONError False P.Error) err
@@ -82,5 +82,5 @@ textError (ParseError parseError msg) = let escape = show
in msg <> ": " <> escape parseError
textError (RebuildError err) = show err
-prettyPrintTypeSingleLine :: P.Type -> Text
+prettyPrintTypeSingleLine :: P.Type a -> Text
prettyPrintTypeSingleLine = T.unwords . map T.strip . T.lines . T.pack . P.prettyPrintTypeWithUnicode
diff --git a/src/Language/PureScript/Ide/Externs.hs b/src/Language/PureScript/Ide/Externs.hs
index df65a9a..0b1c39a 100644
--- a/src/Language/PureScript/Ide/Externs.hs
+++ b/src/Language/PureScript/Ide/Externs.hs
@@ -116,7 +116,7 @@ findSynonym :: P.ProperName 'P.TypeName -> [IdeDeclaration] -> Maybe IdeTypeSyno
-- involved. We collect these and resolve them at the end of the conversion process.
data ToResolve
= TypeClassToResolve (P.ProperName 'P.ClassName)
- | SynonymToResolve (P.ProperName 'P.TypeName) P.Type
+ | SynonymToResolve (P.ProperName 'P.TypeName) P.SourceType
convertExport :: P.DeclarationRef -> Maybe (P.ModuleName, P.DeclarationRef)
convertExport (P.ReExportRef _ m r) = Just (m, r)
diff --git a/src/Language/PureScript/Ide/Prim.hs b/src/Language/PureScript/Ide/Prim.hs
index 1a14b8b..4430a12 100644
--- a/src/Language/PureScript/Ide/Prim.hs
+++ b/src/Language/PureScript/Ide/Prim.hs
@@ -13,6 +13,9 @@ idePrimDeclarations =
[ ( C.Prim
, mconcat [primTypes, primKinds, primClasses]
)
+ , ( C.PrimBoolean
+ , mconcat [primBooleanTypes, primBooleanKinds]
+ )
, ( C.PrimOrdering
, mconcat [primOrderingTypes, primOrderingKinds]
)
@@ -42,6 +45,7 @@ idePrimDeclarations =
Map.difference types (Map.mapKeys (map P.coerceProperName) classes)
primTypes = annType (removeClasses PEnv.primTypes PEnv.primClasses)
+ primBooleanTypes = annType PEnv.primBooleanTypes
primOrderingTypes = annType PEnv.primOrderingTypes
primRowTypes = annType (removeClasses PEnv.primRowTypes PEnv.primRowClasses)
primRowListTypes = annType (removeClasses PEnv.primRowListTypes PEnv.primRowListClasses)
@@ -57,6 +61,9 @@ idePrimDeclarations =
primKinds = foreach (Set.toList PEnv.primKinds) $ \kn ->
IdeDeclarationAnn emptyAnn (IdeDeclKind (P.disqualify kn))
+ primBooleanKinds = foreach (Set.toList PEnv.primBooleanKinds) $ \kn ->
+ IdeDeclarationAnn emptyAnn (IdeDeclKind (P.disqualify kn))
+
primOrderingKinds = foreach (Set.toList PEnv.primOrderingKinds) $ \kn ->
IdeDeclarationAnn emptyAnn (IdeDeclKind (P.disqualify kn))
diff --git a/src/Language/PureScript/Ide/SourceFile.hs b/src/Language/PureScript/Ide/SourceFile.hs
index c62e26b..37868eb 100644
--- a/src/Language/PureScript/Ide/SourceFile.hs
+++ b/src/Language/PureScript/Ide/SourceFile.hs
@@ -65,7 +65,7 @@ extractAstInformation (P.Module _ _ _ decls _) =
in (definitions, typeAnnotations)
-- | Extracts type annotations for functions from a given Module
-extractTypeAnnotations :: [P.Declaration] -> [(P.Ident, P.Type)]
+extractTypeAnnotations :: [P.Declaration] -> [(P.Ident, P.SourceType)]
extractTypeAnnotations = mapMaybe (map P.unwrapTypeDeclaration . P.getTypeDeclaration)
-- | Given a surrounding Sourcespan and a Declaration from the PS AST, extracts
diff --git a/src/Language/PureScript/Ide/Types.hs b/src/Language/PureScript/Ide/Types.hs
index f096769..cb72e17 100644
--- a/src/Language/PureScript/Ide/Types.hs
+++ b/src/Language/PureScript/Ide/Types.hs
@@ -44,38 +44,38 @@ data IdeDeclaration
data IdeValue = IdeValue
{ _ideValueIdent :: P.Ident
- , _ideValueType :: P.Type
+ , _ideValueType :: P.SourceType
} deriving (Show, Eq, Ord, Generic, NFData)
data IdeType = IdeType
{ _ideTypeName :: P.ProperName 'P.TypeName
- , _ideTypeKind :: P.Kind
- , _ideTypeDtors :: [(P.ProperName 'P.ConstructorName, P.Type)]
+ , _ideTypeKind :: P.SourceKind
+ , _ideTypeDtors :: [(P.ProperName 'P.ConstructorName, P.SourceType)]
} deriving (Show, Eq, Ord, Generic, NFData)
data IdeTypeSynonym = IdeTypeSynonym
{ _ideSynonymName :: P.ProperName 'P.TypeName
- , _ideSynonymType :: P.Type
- , _ideSynonymKind :: P.Kind
+ , _ideSynonymType :: P.SourceType
+ , _ideSynonymKind :: P.SourceKind
} deriving (Show, Eq, Ord, Generic, NFData)
data IdeDataConstructor = IdeDataConstructor
{ _ideDtorName :: P.ProperName 'P.ConstructorName
, _ideDtorTypeName :: P.ProperName 'P.TypeName
- , _ideDtorType :: P.Type
+ , _ideDtorType :: P.SourceType
} deriving (Show, Eq, Ord, Generic, NFData)
data IdeTypeClass = IdeTypeClass
{ _ideTCName :: P.ProperName 'P.ClassName
- , _ideTCKind :: P.Kind
+ , _ideTCKind :: P.SourceKind
, _ideTCInstances :: [IdeInstance]
} deriving (Show, Eq, Ord, Generic, NFData)
data IdeInstance = IdeInstance
{ _ideInstanceModule :: P.ModuleName
, _ideInstanceName :: P.Ident
- , _ideInstanceTypes :: [P.Type]
- , _ideInstanceConstraints :: Maybe [P.Constraint]
+ , _ideInstanceTypes :: [P.SourceType]
+ , _ideInstanceConstraints :: Maybe [P.SourceConstraint]
} deriving (Show, Eq, Ord, Generic, NFData)
data IdeValueOperator = IdeValueOperator
@@ -83,7 +83,7 @@ data IdeValueOperator = IdeValueOperator
, _ideValueOpAlias :: P.Qualified (Either P.Ident (P.ProperName 'P.ConstructorName))
, _ideValueOpPrecedence :: P.Precedence
, _ideValueOpAssociativity :: P.Associativity
- , _ideValueOpType :: Maybe P.Type
+ , _ideValueOpType :: Maybe P.SourceType
} deriving (Show, Eq, Ord, Generic, NFData)
data IdeTypeOperator = IdeTypeOperator
@@ -91,7 +91,7 @@ data IdeTypeOperator = IdeTypeOperator
, _ideTypeOpAlias :: P.Qualified (P.ProperName 'P.TypeName)
, _ideTypeOpPrecedence :: P.Precedence
, _ideTypeOpAssociativity :: P.Associativity
- , _ideTypeOpKind :: Maybe P.Kind
+ , _ideTypeOpKind :: Maybe P.SourceKind
} deriving (Show, Eq, Ord, Generic, NFData)
_IdeDeclValue :: Traversal' IdeDeclaration IdeValue
@@ -147,7 +147,7 @@ data Annotation
= Annotation
{ _annLocation :: Maybe P.SourceSpan
, _annExportedFrom :: Maybe P.ModuleName
- , _annTypeAnnotation :: Maybe P.Type
+ , _annTypeAnnotation :: Maybe P.SourceType
, _annDocumentation :: Maybe Text
} deriving (Show, Eq, Ord, Generic, NFData)
@@ -158,7 +158,7 @@ emptyAnn :: Annotation
emptyAnn = Annotation Nothing Nothing Nothing Nothing
type DefinitionSites a = Map IdeNamespaced a
-type TypeAnnotations = Map P.Ident P.Type
+type TypeAnnotations = Map P.Ident P.SourceType
newtype AstData a = AstData (ModuleMap (DefinitionSites a, TypeAnnotations))
-- ^ SourceSpans for the definition sites of values and types as well as type
-- annotations found in a module
diff --git a/src/Language/PureScript/Interactive.hs b/src/Language/PureScript/Interactive.hs
index 3205316..856f028 100644
--- a/src/Language/PureScript/Interactive.hs
+++ b/src/Language/PureScript/Interactive.hs
@@ -111,7 +111,9 @@ handleCommand _ _ p (KindOf typ) = handleKindOf p typ
handleCommand _ _ p (BrowseModule moduleName) = handleBrowse p moduleName
handleCommand _ _ p (ShowInfo QueryLoaded) = handleShowLoadedModules p
handleCommand _ _ p (ShowInfo QueryImport) = handleShowImportedModules p
+handleCommand _ _ p (ShowInfo QueryPrint) = handleShowPrint p
handleCommand _ _ p (CompleteStr prefix) = handleComplete p prefix
+handleCommand _ _ p (SetInteractivePrint ip) = handleSetInteractivePrint p ip
handleCommand _ _ _ _ = P.internalError "handleCommand: unexpected command"
-- | Reload the application state
@@ -227,6 +229,24 @@ handleShowImportedModules print' = do
commaList :: [Text] -> Text
commaList = T.intercalate ", "
+handleShowPrint
+ :: (MonadState PSCiState m, MonadIO m)
+ => (String -> m ())
+ -> m ()
+handleShowPrint print' = do
+ current <- psciInteractivePrint <$> get
+ if current == initialInteractivePrint
+ then
+ print' $
+ "The interactive print function is currently set to the default (`" ++ showPrint current ++ "`)"
+ else
+ print' $
+ "The interactive print function is currently set to `" ++ showPrint current ++ "`\n" ++
+ "The default can be restored with `:print " ++ showPrint initialInteractivePrint ++ "`"
+
+ where
+ showPrint (mn, ident) = T.unpack (N.runModuleName mn <> "." <> N.runIdent ident)
+
-- | Imports a module, preserving the initial state on failure.
handleImport
:: (MonadReader PSCiConfig m, MonadState PSCiState m, MonadIO m)
@@ -261,7 +281,7 @@ handleTypeOf print' val = do
handleKindOf
:: (MonadReader PSCiConfig m, MonadState PSCiState m, MonadIO m)
=> (String -> m ())
- -> P.Type
+ -> P.SourceType
-> m ()
handleKindOf print' typ = do
st <- get
@@ -318,3 +338,26 @@ handleComplete print' prefix = do
let act = liftCompletionM (completion' (reverse prefix, ""))
results <- evalStateT act st
print' $ unlines (formatCompletions results)
+
+-- | Attempt to set the interactive print function. Note that the state will
+-- only be updated if the interactive print function exists and appears to
+-- work; we test it by attempting to evaluate '0'.
+handleSetInteractivePrint
+ :: (MonadState PSCiState m, MonadIO m)
+ => (String -> m ())
+ -> (P.ModuleName, P.Ident)
+ -> m ()
+handleSetInteractivePrint print' new = do
+ current <- gets psciInteractivePrint
+ modify (setInteractivePrint new)
+ st <- get
+ let expr = P.Literal internalSpan (P.NumericLiteral (Left 0))
+ let m = createTemporaryModule True st expr
+ e <- liftIO . runMake $ rebuild (map snd (psciLoadedExterns st)) m
+ case e of
+ Left errs -> do
+ modify (setInteractivePrint current)
+ print' "Unable to set the repl's printing function:"
+ printErrors errs
+ Right _ ->
+ pure ()
diff --git a/src/Language/PureScript/Interactive/Directive.hs b/src/Language/PureScript/Interactive/Directive.hs
index c996488..5538315 100644
--- a/src/Language/PureScript/Interactive/Directive.hs
+++ b/src/Language/PureScript/Interactive/Directive.hs
@@ -33,6 +33,7 @@ directiveStrings =
, (Show , ["show"])
, (Paste , ["paste"])
, (Complete , ["complete"])
+ , (Print , ["print"])
]
-- |
@@ -80,16 +81,6 @@ parseDirective :: String -> Maybe Directive
parseDirective = listToMaybe . directivesFor
-- |
--- True if the given directive takes an argument, false otherwise.
-hasArgument :: Directive -> Bool
-hasArgument Help = False
-hasArgument Quit = False
-hasArgument Reload = False
-hasArgument Clear = False
-hasArgument Paste = False
-hasArgument _ = True
-
--- |
-- The help menu.
--
help :: [(Directive, String, String)]
@@ -103,7 +94,9 @@ help =
, (Kind, "<type>", "Show the kind of <type>")
, (Show, "import", "Show all imported modules")
, (Show, "loaded", "Show all loaded modules")
+ , (Show, "print", "Show the repl's current printing function")
, (Paste, "paste", "Enter multiple lines, terminated by ^D")
, (Complete, "<prefix>", "Show completions for <prefix> as if pressing tab")
+ , (Print, "<fn>", "Set the repl's printing function to <fn> (which must be fully qualified)")
]
diff --git a/src/Language/PureScript/Interactive/Module.hs b/src/Language/PureScript/Interactive/Module.hs
index 289ed4c..0633fea 100644
--- a/src/Language/PureScript/Interactive/Module.hs
+++ b/src/Language/PureScript/Interactive/Module.hs
@@ -13,7 +13,7 @@ import System.IO.UTF8 (readUTF8FileT)
-- | The name of the PSCI support module
supportModuleName :: P.ModuleName
-supportModuleName = P.moduleNameFromString "PSCI.Support"
+supportModuleName = fst initialInteractivePrint
-- | Checks if the Console module is defined
supportModuleIsDefined :: [P.Module] -> Bool
@@ -50,16 +50,16 @@ createTemporaryModule exec st val =
moduleName = P.ModuleName [P.ProperName "$PSCI"]
effModuleName = P.moduleNameFromString "Effect"
effImport = (effModuleName, P.Implicit, Just (P.ModuleName [P.ProperName "$Effect"]))
- supportImport = (supportModuleName, P.Implicit, Just (P.ModuleName [P.ProperName "$Support"]))
- eval = P.Var internalSpan (P.Qualified (Just (P.ModuleName [P.ProperName "$Support"])) (P.Ident "eval"))
+ supportImport = (fst (psciInteractivePrint st), P.Implicit, Just (P.ModuleName [P.ProperName "$Support"]))
+ eval = P.Var internalSpan (P.Qualified (Just (P.ModuleName [P.ProperName "$Support"])) (snd (psciInteractivePrint st)))
mainValue = P.App eval (P.Var internalSpan (P.Qualified Nothing (P.Ident "it")))
itDecl = P.ValueDecl (internalSpan, []) (P.Ident "it") P.Public [] [P.MkUnguarded val]
typeDecl = P.TypeDeclaration
(P.TypeDeclarationData (internalSpan, []) (P.Ident "$main")
- (P.TypeApp
- (P.TypeConstructor
+ (P.srcTypeApp
+ (P.srcTypeConstructor
(P.Qualified (Just (P.ModuleName [P.ProperName "$Effect"])) (P.ProperName "Effect")))
- (P.TypeWildcard internalSpan)))
+ P.srcTypeWildcard))
mainDecl = P.ValueDecl (internalSpan, []) (P.Ident "$main") P.Public [] [P.MkUnguarded mainValue]
decls = if exec then [itDecl, typeDecl, mainDecl] else [itDecl]
in
@@ -72,7 +72,7 @@ createTemporaryModule exec st val =
-- |
-- Makes a volatile module to hold a non-qualified type synonym for a fully-qualified data type declaration.
--
-createTemporaryModuleForKind :: PSCiState -> P.Type -> P.Module
+createTemporaryModuleForKind :: PSCiState -> P.SourceType -> P.Module
createTemporaryModuleForKind st typ =
let
imports = psciImportedModules st
diff --git a/src/Language/PureScript/Interactive/Parser.hs b/src/Language/PureScript/Interactive/Parser.hs
index 9d6df35..cefec9f 100644
--- a/src/Language/PureScript/Interactive/Parser.hs
+++ b/src/Language/PureScript/Interactive/Parser.hs
@@ -33,11 +33,11 @@ parseDotFile filePath s = first show $ do
-- |
-- Parses PSCI metacommands or expressions input from the user.
--
-parseCommand :: String -> Either String Command
+parseCommand :: String -> Either String [Command]
parseCommand cmdString =
case cmdString of
- (':' : cmd) -> parseDirective cmd
- _ -> parseRest psciCommand cmdString
+ (':' : cmd) -> pure <$> parseDirective cmd
+ _ -> parseRest (many1 psciCommand) cmdString
parseRest :: P.TokenParser a -> String -> Either String a
parseRest p s = first show $ do
@@ -84,6 +84,10 @@ parseDirective cmd =
Type -> TypeOf <$> parseRest P.parseValue arg
Kind -> KindOf <$> parseRest P.parseType arg
Complete -> return (CompleteStr arg)
+ Print -> parseRest
+ ((eof *> return (ShowInfo QueryPrint))
+ <|> (SetInteractivePrint <$> parseFullyQualifiedIdent))
+ arg
-- |
-- Parses expressions entered at the PSCI repl.
@@ -136,3 +140,12 @@ psciDeprecatedLet = do
_ <- mark (many1 (same *> P.parseLocalDeclaration))
notFollowedBy $ P.reserved "in"
fail "Declarations in PSCi no longer require \"let\", as of version 0.11.0"
+
+parseFullyQualifiedIdent :: P.TokenParser (P.ModuleName, P.Ident)
+parseFullyQualifiedIdent = do
+ qname <- P.parseQualified P.parseIdent
+ case qname of
+ P.Qualified (Just mn) ident ->
+ pure (mn, ident)
+ P.Qualified Nothing _ ->
+ fail "Expected a fully-qualified name (eg: PSCI.Support.eval)"
diff --git a/src/Language/PureScript/Interactive/Printer.hs b/src/Language/PureScript/Interactive/Printer.hs
index 6081294..7d35b08 100644
--- a/src/Language/PureScript/Interactive/Printer.hs
+++ b/src/Language/PureScript/Interactive/Printer.hs
@@ -37,12 +37,12 @@ printModuleSignatures moduleName P.Environment{..} =
where printModule's showF = Box.vsep 1 Box.left . showF
- findNameType :: M.Map (P.Qualified P.Ident) (P.Type, P.NameKind, P.NameVisibility)
+ findNameType :: M.Map (P.Qualified P.Ident) (P.SourceType, P.NameKind, P.NameVisibility)
-> P.Qualified P.Ident
- -> (P.Ident, Maybe (P.Type, P.NameKind, P.NameVisibility))
+ -> (P.Ident, Maybe (P.SourceType, P.NameKind, P.NameVisibility))
findNameType envNames m = (P.disqualify m, M.lookup m envNames)
- showNameType :: (P.Ident, Maybe (P.Type, P.NameKind, P.NameVisibility)) -> Box.Box
+ showNameType :: (P.Ident, Maybe (P.SourceType, P.NameKind, P.NameVisibility)) -> Box.Box
showNameType (mIdent, Just (mType, _, _)) = textT (P.showIdent mIdent <> " :: ") Box.<> P.typeAsBox mType
showNameType _ = P.internalError "The impossible happened in printModuleSignatures."
@@ -61,7 +61,7 @@ printModuleSignatures moduleName P.Environment{..} =
if null typeClassSuperclasses
then Box.text ""
else Box.text "("
- Box.<> Box.hcat Box.left (intersperse (Box.text ", ") $ map (\(P.Constraint (P.Qualified _ pn) lt _) -> textT (P.runProperName pn) Box.<+> Box.hcat Box.left (map P.typeAtomAsBox lt)) typeClassSuperclasses)
+ Box.<> Box.hcat Box.left (intersperse (Box.text ", ") $ map (\(P.Constraint _ (P.Qualified _ pn) lt _) -> textT (P.runProperName pn) Box.<+> Box.hcat Box.left (map P.typeAtomAsBox lt)) typeClassSuperclasses)
Box.<> Box.text ") <= "
className =
textT (P.runProperName name)
@@ -79,16 +79,16 @@ printModuleSignatures moduleName P.Environment{..} =
findType
- :: M.Map (P.Qualified (P.ProperName 'P.TypeName)) (P.Kind, P.TypeKind)
+ :: M.Map (P.Qualified (P.ProperName 'P.TypeName)) (P.SourceKind, P.TypeKind)
-> P.Qualified (P.ProperName 'P.TypeName)
- -> (P.Qualified (P.ProperName 'P.TypeName), Maybe (P.Kind, P.TypeKind))
+ -> (P.Qualified (P.ProperName 'P.TypeName), Maybe (P.SourceKind, P.TypeKind))
findType envTypes name = (name, M.lookup name envTypes)
showType
:: M.Map (P.Qualified (P.ProperName 'P.ClassName)) P.TypeClassData
- -> M.Map (P.Qualified (P.ProperName 'P.ConstructorName)) (P.DataDeclType, P.ProperName 'P.TypeName, P.Type, [P.Ident])
- -> M.Map (P.Qualified (P.ProperName 'P.TypeName)) ([(Text, Maybe P.Kind)], P.Type)
- -> (P.Qualified (P.ProperName 'P.TypeName), Maybe (P.Kind, P.TypeKind))
+ -> M.Map (P.Qualified (P.ProperName 'P.ConstructorName)) (P.DataDeclType, P.ProperName 'P.TypeName, P.SourceType, [P.Ident])
+ -> M.Map (P.Qualified (P.ProperName 'P.TypeName)) ([(Text, Maybe P.SourceKind)], P.SourceType)
+ -> (P.Qualified (P.ProperName 'P.TypeName), Maybe (P.SourceKind, P.TypeKind))
-> Maybe Box.Box
showType typeClassesEnv dataConstructorsEnv typeSynonymsEnv (n@(P.Qualified modul name), typ) =
case (typ, M.lookup n typeSynonymsEnv) of
diff --git a/src/Language/PureScript/Interactive/Types.hs b/src/Language/PureScript/Interactive/Types.hs
index 521b61d..84e926b 100644
--- a/src/Language/PureScript/Interactive/Types.hs
+++ b/src/Language/PureScript/Interactive/Types.hs
@@ -10,13 +10,16 @@ module Language.PureScript.Interactive.Types
, psciExports
, psciImports
, psciLoadedExterns
+ , psciInteractivePrint
, psciImportedModules
, psciLetBindings
, initialPSCiState
+ , initialInteractivePrint
, psciImportedModuleNames
, updateImportedModules
, updateLoadedExterns
, updateLets
+ , setInteractivePrint
, Command(..)
, ReplQuery(..)
, replQueries
@@ -46,7 +49,9 @@ newtype PSCiConfig = PSCiConfig
-- | The PSCI state.
--
--- Holds a list of imported modules, loaded files, and partial let bindings.
+-- Holds a list of imported modules, loaded files, and partial let bindings,
+-- plus the currently configured interactive printing function.
+--
-- The let bindings are partial, because it makes more sense to apply the
-- binding to the final evaluated expression.
--
@@ -57,27 +62,35 @@ data PSCiState = PSCiState
[ImportedModule]
[P.Declaration]
[(P.Module, P.ExternsFile)]
+ (P.ModuleName, P.Ident)
P.Imports
P.Exports
deriving Show
psciImportedModules :: PSCiState -> [ImportedModule]
-psciImportedModules (PSCiState x _ _ _ _) = x
+psciImportedModules (PSCiState x _ _ _ _ _) = x
psciLetBindings :: PSCiState -> [P.Declaration]
-psciLetBindings (PSCiState _ x _ _ _) = x
+psciLetBindings (PSCiState _ x _ _ _ _) = x
psciLoadedExterns :: PSCiState -> [(P.Module, P.ExternsFile)]
-psciLoadedExterns (PSCiState _ _ x _ _) = x
+psciLoadedExterns (PSCiState _ _ x _ _ _) = x
+
+psciInteractivePrint :: PSCiState -> (P.ModuleName, P.Ident)
+psciInteractivePrint (PSCiState _ _ _ x _ _) = x
psciImports :: PSCiState -> P.Imports
-psciImports (PSCiState _ _ _ x _) = x
+psciImports (PSCiState _ _ _ _ x _) = x
psciExports :: PSCiState -> P.Exports
-psciExports (PSCiState _ _ _ _ x) = x
+psciExports (PSCiState _ _ _ _ _ x) = x
initialPSCiState :: PSCiState
-initialPSCiState = PSCiState [] [] [] nullImports primExports
+initialPSCiState = PSCiState [] [] [] initialInteractivePrint nullImports primExports
+
+-- | The default interactive print function.
+initialInteractivePrint :: (P.ModuleName, P.Ident)
+initialInteractivePrint = (P.moduleNameFromString "PSCI.Support", P.Ident "eval")
psciEnvironment :: PSCiState -> P.Environment
psciEnvironment st = foldl' (flip P.applyExternsFileToEnvironment) P.initEnvironment externs
@@ -104,12 +117,12 @@ psciImportedModuleNames st =
-- handling completions. This function must be called whenever the PSCiState is modified to
-- ensure that completions remain accurate.
updateImportExports :: PSCiState -> PSCiState
-updateImportExports st@(PSCiState modules lets externs _ _) =
+updateImportExports st@(PSCiState modules lets externs iprint _ _) =
case desugarModule [temporaryModule] of
Left _ -> st -- TODO: can this fail and what should we do?
Right (env, _) ->
case M.lookup temporaryName env of
- Just (_, is, es) -> PSCiState modules lets externs is es
+ Just (_, is, es) -> PSCiState modules lets externs iprint is es
_ -> st -- impossible
where
@@ -136,18 +149,24 @@ updateImportExports st@(PSCiState modules lets externs _ _) =
-- | Updates the imported modules in the state record.
updateImportedModules :: ([ImportedModule] -> [ImportedModule]) -> PSCiState -> PSCiState
-updateImportedModules f (PSCiState x a b c d) =
- updateImportExports (PSCiState (f x) a b c d)
+updateImportedModules f (PSCiState x a b c d e) =
+ updateImportExports (PSCiState (f x) a b c d e)
-- | Updates the loaded externs files in the state record.
updateLoadedExterns :: ([(P.Module, P.ExternsFile)] -> [(P.Module, P.ExternsFile)]) -> PSCiState -> PSCiState
-updateLoadedExterns f (PSCiState a b x c d) =
- updateImportExports (PSCiState a b (f x) c d)
+updateLoadedExterns f (PSCiState a b x c d e) =
+ updateImportExports (PSCiState a b (f x) c d e)
-- | Updates the let bindings in the state record.
updateLets :: ([P.Declaration] -> [P.Declaration]) -> PSCiState -> PSCiState
-updateLets f (PSCiState a x b c d) =
- updateImportExports (PSCiState a (f x) b c d)
+updateLets f (PSCiState a x b c d e) =
+ updateImportExports (PSCiState a (f x) b c d e)
+
+-- | Replaces the interactive printing function in the state record with a new
+-- one.
+setInteractivePrint :: (P.ModuleName, P.Ident) -> PSCiState -> PSCiState
+setInteractivePrint iprint (PSCiState a b c _ d e) =
+ PSCiState a b c iprint d e
-- * Commands
@@ -174,23 +193,26 @@ data Command
-- | Find the type of an expression
| TypeOf P.Expr
-- | Find the kind of an expression
- | KindOf P.Type
+ | KindOf P.SourceType
-- | Shows information about the current state of the REPL
| ShowInfo ReplQuery
-- | Paste multiple lines
| PasteLines
-- | Return auto-completion output as if pressing <tab>
| CompleteStr String
+ -- | Set the interactive printing function
+ | SetInteractivePrint (P.ModuleName, P.Ident)
deriving Show
data ReplQuery
= QueryLoaded
| QueryImport
+ | QueryPrint
deriving (Eq, Show)
-- | A list of all ReplQuery values.
replQueries :: [ReplQuery]
-replQueries = [QueryLoaded, QueryImport]
+replQueries = [QueryLoaded, QueryImport, QueryPrint]
replQueryStrings :: [String]
replQueryStrings = map showReplQuery replQueries
@@ -198,10 +220,12 @@ replQueryStrings = map showReplQuery replQueries
showReplQuery :: ReplQuery -> String
showReplQuery QueryLoaded = "loaded"
showReplQuery QueryImport = "import"
+showReplQuery QueryPrint = "print"
parseReplQuery :: String -> Maybe ReplQuery
parseReplQuery "loaded" = Just QueryLoaded
parseReplQuery "import" = Just QueryImport
+parseReplQuery "print" = Just QueryPrint
parseReplQuery _ = Nothing
data Directive
@@ -215,4 +239,5 @@ data Directive
| Show
| Paste
| Complete
+ | Print
deriving (Eq, Show)
diff --git a/src/Language/PureScript/Kinds.hs b/src/Language/PureScript/Kinds.hs
index 01df9dc..f58ccee 100644
--- a/src/Language/PureScript/Kinds.hs
+++ b/src/Language/PureScript/Kinds.hs
@@ -1,109 +1,171 @@
+{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DeriveFoldable #-}
+{-# LANGUAGE DeriveTraversable #-}
+{-# LANGUAGE ScopedTypeVariables #-}
module Language.PureScript.Kinds where
import Prelude.Compat
import GHC.Generics (Generic)
+import Control.Applicative ((<|>))
import Control.DeepSeq (NFData)
import Data.Text (Text)
-import qualified Data.Text as T
-import Data.Aeson.BetterErrors (Parse, key, asText, asIntegral, nth, fromAesonParser, toAesonParser, throwCustomError)
-import Data.Aeson ((.=))
+import Data.Aeson (Value, toJSON, (.=), (.:))
+import Data.Aeson.Types (Parser)
import qualified Data.Aeson as A
+import Language.PureScript.AST.SourcePos
import Language.PureScript.Names
-import qualified Language.PureScript.Constants as C
+
+import Lens.Micro.Platform (Lens', (^.), set)
+
+type SourceKind = Kind SourceAnn
-- | The data type of kinds
-data Kind
+data Kind a
-- | Unification variable of type Kind
- = KUnknown Int
+ = KUnknown a Int
-- | Kinds for labelled, unordered rows without duplicates
- | Row Kind
+ | Row a (Kind a)
-- | Function kinds
- | FunKind Kind Kind
+ | FunKind a (Kind a) (Kind a)
-- | A named kind
- | NamedKind (Qualified (ProperName 'KindName))
- deriving (Show, Eq, Ord, Generic)
-
-instance NFData Kind
-
--- This is equivalent to the derived Aeson ToJSON instance, except that we
--- write it out manually so that we can define a parser which is
--- backwards-compatible.
-instance A.ToJSON Kind where
- toJSON kind = case kind of
- KUnknown i ->
- obj "KUnknown" i
- Row k ->
- obj "Row" k
- FunKind k1 k2 ->
- obj "FunKind" [k1, k2]
- NamedKind n ->
- obj "NamedKind" n
- where
- obj :: A.ToJSON a => Text -> a -> A.Value
- obj tag contents =
- A.object [ "tag" .= tag, "contents" .= contents ]
-
--- This is equivalent to the derived Aeson FromJSON instance, except that it
--- also handles JSON generated by compilers up to 0.10.3 and maps them to the
--- new representations (i.e. NamedKinds which are defined in the Prim module).
-kindFromJSON :: Parse Text Kind
-kindFromJSON = do
- t <- key "tag" asText
- case t of
+ | NamedKind a (Qualified (ProperName 'KindName))
+ deriving (Show, Generic, Functor, Foldable, Traversable)
+
+instance NFData a => NFData (Kind a)
+
+srcKUnknown :: Int -> SourceKind
+srcKUnknown = KUnknown NullSourceAnn
+
+srcRow :: SourceKind -> SourceKind
+srcRow = Row NullSourceAnn
+
+srcFunKind :: SourceKind -> SourceKind -> SourceKind
+srcFunKind = FunKind NullSourceAnn
+
+srcNamedKind :: Qualified (ProperName 'KindName) -> SourceKind
+srcNamedKind = NamedKind NullSourceAnn
+
+kindToJSON :: forall a. (a -> Value) -> Kind a -> Value
+kindToJSON annToJSON kind =
+ case kind of
+ KUnknown a i ->
+ variant "KUnknown" a i
+ Row a k ->
+ variant "Row" a (go k)
+ FunKind a k1 k2 ->
+ variant "FunKind" a (go k1, go k2)
+ NamedKind a n ->
+ variant "NamedKind" a n
+ where
+ go :: Kind a -> Value
+ go = kindToJSON annToJSON
+
+ variant :: A.ToJSON b => Text -> a -> b -> A.Value
+ variant tag ann contents =
+ A.object
+ [ "tag" .= tag
+ , "annotation" .= annToJSON ann
+ , "contents" .= contents
+ ]
+
+instance A.ToJSON a => A.ToJSON (Kind a) where
+ toJSON = kindToJSON toJSON
+
+kindFromJSON :: forall a. Parser a -> (Value -> Parser a) -> Value -> Parser (Kind a)
+kindFromJSON defaultAnn annFromJSON = A.withObject "Kind" $ \o -> do
+ tag <- o .: "tag"
+ a <- (o .: "annotation" >>= annFromJSON) <|> defaultAnn
+ let
+ contents :: A.FromJSON b => Parser b
+ contents = o .: "contents"
+ case tag of
"KUnknown" ->
- KUnknown <$> key "contents" (nth 0 asIntegral)
- "Star" ->
- pure kindType
+ KUnknown a <$> contents
"Row" ->
- Row <$> key "contents" kindFromJSON
- "FunKind" ->
- let
- kindAt n = key "contents" (nth n kindFromJSON)
- in
- FunKind <$> kindAt 0 <*> kindAt 1
- "Symbol" ->
- pure kindSymbol
+ Row a <$> (go =<< contents)
+ "FunKind" -> do
+ (b, c) <- contents
+ FunKind a <$> go b <*> go c
"NamedKind" ->
- NamedKind <$> key "contents" fromAesonParser
+ NamedKind a <$> contents
other ->
- throwCustomError (T.append "Unrecognised tag: " other)
-
+ fail $ "Unrecognised tag: " ++ other
where
- -- The following are copied from Environment and reimplemented to avoid
- -- circular dependencies.
- primName :: Text -> Qualified (ProperName a)
- primName = Qualified (Just $ ModuleName [ProperName C.prim]) . ProperName
+ go :: Value -> Parser (Kind a)
+ go = kindFromJSON defaultAnn annFromJSON
- primKind :: Text -> Kind
- primKind = NamedKind . primName
+-- These overlapping instances exist to preserve compatability for common
+-- instances which have a sensible default for missing annotations.
+instance {-# OVERLAPPING #-} A.FromJSON (Kind SourceAnn) where
+ parseJSON = kindFromJSON (pure NullSourceAnn) A.parseJSON
- kindType = primKind C.typ
- kindSymbol = primKind C.symbol
+instance {-# OVERLAPPING #-} A.FromJSON (Kind ()) where
+ parseJSON = kindFromJSON (pure ()) A.parseJSON
-instance A.FromJSON Kind where
- parseJSON = toAesonParser id kindFromJSON
+instance {-# OVERLAPPING #-} A.FromJSON a => A.FromJSON (Kind a) where
+ parseJSON = kindFromJSON (fail "Invalid annotation") A.parseJSON
-everywhereOnKinds :: (Kind -> Kind) -> Kind -> Kind
+everywhereOnKinds :: (Kind a -> Kind a) -> Kind a -> Kind a
everywhereOnKinds f = go
where
- go (Row k1) = f (Row (go k1))
- go (FunKind k1 k2) = f (FunKind (go k1) (go k2))
+ go (Row ann k1) = f (Row ann (go k1))
+ go (FunKind ann k1 k2) = f (FunKind ann (go k1) (go k2))
go other = f other
-everywhereOnKindsM :: Monad m => (Kind -> m Kind) -> Kind -> m Kind
+everywhereOnKindsM :: Monad m => (Kind a -> m (Kind a)) -> Kind a -> m (Kind a)
everywhereOnKindsM f = go
where
- go (Row k1) = (Row <$> go k1) >>= f
- go (FunKind k1 k2) = (FunKind <$> go k1 <*> go k2) >>= f
+ go (Row ann k1) = (Row ann <$> go k1) >>= f
+ go (FunKind ann k1 k2) = (FunKind ann <$> go k1 <*> go k2) >>= f
go other = f other
-everythingOnKinds :: (r -> r -> r) -> (Kind -> r) -> Kind -> r
+everythingOnKinds :: (r -> r -> r) -> (Kind a -> r) -> Kind a -> r
everythingOnKinds (<>.) f = go
where
- go k@(Row k1) = f k <>. go k1
- go k@(FunKind k1 k2) = f k <>. go k1 <>. go k2
+ go k@(Row _ k1) = f k <>. go k1
+ go k@(FunKind _ k1 k2) = f k <>. go k1 <>. go k2
go other = f other
+
+annForKind :: Lens' (Kind a) a
+annForKind k (KUnknown a b) = (\z -> KUnknown z b) <$> k a
+annForKind k (Row a b) = (\z -> Row z b) <$> k a
+annForKind k (FunKind a b c) = (\z -> FunKind z b c) <$> k a
+annForKind k (NamedKind a b) = (\z -> NamedKind z b) <$> k a
+
+getAnnForKind :: Kind a -> a
+getAnnForKind = (^. annForKind)
+
+setAnnForKind :: a -> Kind a -> Kind a
+setAnnForKind = set annForKind
+
+instance Eq (Kind a) where
+ (==) = eqKind
+
+instance Ord (Kind a) where
+ compare = compareKind
+
+eqKind :: Kind a -> Kind b -> Bool
+eqKind (KUnknown _ a) (KUnknown _ a') = a == a'
+eqKind (Row _ a) (Row _ a') = eqKind a a'
+eqKind (FunKind _ a b) (FunKind _ a' b') = eqKind a a' && eqKind b b'
+eqKind (NamedKind _ a) (NamedKind _ a') = a == a'
+eqKind _ _ = False
+
+compareKind :: Kind a -> Kind b -> Ordering
+compareKind (KUnknown _ a) (KUnknown _ a') = compare a a'
+compareKind (KUnknown {}) _ = LT
+
+compareKind (Row _ a) (Row _ a') = compareKind a a'
+compareKind (Row {}) _ = LT
+compareKind _ (Row {}) = GT
+
+compareKind (FunKind _ a b) (FunKind _ a' b') = compareKind a b <> compareKind a' b'
+compareKind (FunKind {}) _ = LT
+compareKind _ (FunKind {}) = GT
+
+compareKind (NamedKind _ a) (NamedKind _ a') = compare a a'
+compareKind (NamedKind {}) _ = GT
diff --git a/src/Language/PureScript/Linter.hs b/src/Language/PureScript/Linter.hs
index 49ede59..96c11b8 100644
--- a/src/Language/PureScript/Linter.hs
+++ b/src/Language/PureScript/Linter.hs
@@ -4,11 +4,9 @@
module Language.PureScript.Linter (lint, module L) where
import Prelude.Compat
-import Protolude (ordNub)
import Control.Monad.Writer.Class
-import Data.List ((\\))
import Data.Maybe (mapMaybe)
import qualified Data.Set as S
import Data.Text (Text)
@@ -82,26 +80,49 @@ lint (Module _ _ mn ds _) = censor (addHint (ErrorInModule mn)) $ mapM_ lintDecl
checkTypeVarsInDecl :: S.Set Text -> Declaration -> MultipleErrors
checkTypeVarsInDecl s d = let (f, _, _, _, _) = accumTypes (checkTypeVars (declSourceSpan d) s) in f d
- checkTypeVars :: SourceSpan -> S.Set Text -> Type -> MultipleErrors
- checkTypeVars ss set ty = everythingWithContextOnTypes set mempty mappend step ty <> findUnused ty
+ checkTypeVars :: SourceSpan -> S.Set Text -> SourceType -> MultipleErrors
+ checkTypeVars ss set ty = everythingWithContextOnTypes set mempty mappend step ty <> snd (findUnused ty)
where
- step :: S.Set Text -> Type -> (S.Set Text, MultipleErrors)
- step s (ForAll tv _ _) = bindVar s tv
+
+ step :: S.Set Text -> SourceType -> (S.Set Text, MultipleErrors)
+ step s (ForAll _ tv _ _) = bindVar s tv
step s _ = (s, mempty)
+
bindVar :: S.Set Text -> Text -> (S.Set Text, MultipleErrors)
bindVar = bind ss ShadowedTypeVar
- findUnused :: Type -> MultipleErrors
- findUnused ty' =
- let used = usedTypeVariables ty'
- declared = everythingOnTypes (++) go ty'
- unused = ordNub declared \\ ordNub used
- in foldl (<>) mempty $ map (errorMessage' ss . UnusedTypeVar) unused
- where
- go :: Type -> [Text]
- go (ForAll tv _ _) = [tv]
- go _ = []
+
+ findUnused :: SourceType -> (S.Set Text, MultipleErrors)
+ findUnused = go set where
+ -- Recursively walk the type and prune used variables from `unused`
+ go :: S.Set Text -> SourceType -> (S.Set Text, MultipleErrors)
+ go unused (TypeVar _ v) = (S.delete v unused, mempty)
+ go unused (ForAll _ tv t1 _) =
+ let (nowUnused, errors) = go (S.insert tv unused) t1
+ restoredUnused = if S.member tv unused then S.insert tv nowUnused else nowUnused
+ combinedErrors = if S.member tv nowUnused then errors <> errorMessage' ss (UnusedTypeVar tv) else errors
+ in (restoredUnused, combinedErrors)
+ go unused (TypeApp _ f x) = go unused f `combine` go unused x
+ go unused (ConstrainedType _ c t1) = foldl combine (unused, mempty) $ map (go unused) (constraintArgs c <> [t1])
+ go unused (RCons _ _ t1 rest) = go unused t1 `combine` go unused rest
+ go unused (KindedType _ t1 _) = go unused t1
+ go unused (ParensInType _ t1) = go unused t1
+ go unused (BinaryNoParensType _ t1 t2 t3) = go unused t1 `combine` go unused t2 `combine` go unused t3
+ go unused TUnknown{} = (unused, mempty)
+ go unused TypeLevelString{} = (unused, mempty)
+ go unused TypeWildcard{} = (unused, mempty)
+ go unused TypeConstructor{} = (unused, mempty)
+ go unused TypeOp{} = (unused, mempty)
+ go unused Skolem{} = (unused, mempty)
+ go unused REmpty{} = (unused, mempty)
+
+ combine ::
+ (S.Set Text, MultipleErrors) ->
+ (S.Set Text, MultipleErrors) ->
+ (S.Set Text, MultipleErrors)
+ combine (a, b) (c, d) = (S.intersection a c, b <> d)
bind :: (Ord a) => SourceSpan -> (a -> SimpleErrorMessage) -> S.Set a -> a -> (S.Set a, MultipleErrors)
bind ss mkError s name
| name `S.member` s = (s, errorMessage' ss (mkError name))
| otherwise = (S.insert name s, mempty)
+
diff --git a/src/Language/PureScript/Linter/Exhaustive.hs b/src/Language/PureScript/Linter/Exhaustive.hs
index 4278f50..ff64b44 100644
--- a/src/Language/PureScript/Linter/Exhaustive.hs
+++ b/src/Language/PureScript/Linter/Exhaustive.hs
@@ -63,15 +63,15 @@ qualifyName n defmn qn = Qualified (Just mn) n
-- where: - ProperName is the name of the constructor (for example, "Nothing" in Maybe)
-- - [Type] is the list of arguments, if it has (for example, "Just" has [TypeVar "a"])
--
-getConstructors :: Environment -> ModuleName -> Qualified (ProperName 'ConstructorName) -> [(ProperName 'ConstructorName, [Type])]
+getConstructors :: Environment -> ModuleName -> Qualified (ProperName 'ConstructorName) -> [(ProperName 'ConstructorName, [SourceType])]
getConstructors env defmn n = extractConstructors lnte
where
- extractConstructors :: Maybe (Kind, TypeKind) -> [(ProperName 'ConstructorName, [Type])]
+ extractConstructors :: Maybe (SourceKind, TypeKind) -> [(ProperName 'ConstructorName, [SourceType])]
extractConstructors (Just (_, DataType _ pt)) = pt
extractConstructors _ = internalError "Data name not in the scope of the current environment in extractConstructors"
- lnte :: Maybe (Kind, TypeKind)
+ lnte :: Maybe (SourceKind, TypeKind)
lnte = M.lookup qpn (types env)
qpn :: Qualified (ProperName 'TypeName)
@@ -83,7 +83,7 @@ getConstructors env defmn n = extractConstructors lnte
Nothing -> internalError $ "Constructor " ++ T.unpack (showQualified runProperName con) ++ " not in the scope of the current environment in getConsDataName."
Just (_, pm, _, _) -> qualifyName pm defmn con
- getConsInfo :: Qualified (ProperName 'ConstructorName) -> Maybe (DataDeclType, ProperName 'TypeName, Type, [Ident])
+ getConsInfo :: Qualified (ProperName 'ConstructorName) -> Maybe (DataDeclType, ProperName 'TypeName, SourceType, [Ident])
getConsInfo con = M.lookup con (dataConstructors env)
-- |
@@ -303,12 +303,12 @@ checkExhaustive ss env mn numArgs cas expr = makeResult . first ordNub $ foldl'
(ty tyVar))
]
- ty :: Text -> Type
+ ty :: Text -> SourceType
ty tyVar =
- ForAll tyVar
- ( ConstrainedType
- (Constraint C.Partial [] (Just constraintData))
- $ TypeApp (TypeApp tyFunction (TypeVar tyVar)) (TypeVar tyVar)
+ srcForAll tyVar
+ ( srcConstrainedType
+ (srcConstraint C.Partial [] (Just constraintData))
+ $ srcTypeApp (srcTypeApp tyFunction (srcTypeVar tyVar)) (srcTypeVar tyVar)
)
Nothing
diff --git a/src/Language/PureScript/Parser/Declarations.hs b/src/Language/PureScript/Parser/Declarations.hs
index bfc7701..c7b1408 100644
--- a/src/Language/PureScript/Parser/Declarations.hs
+++ b/src/Language/PureScript/Parser/Declarations.hs
@@ -41,7 +41,7 @@ import Language.PureScript.Types
import qualified Text.Parsec as P
import qualified Text.Parsec.Expr as P
-kindedIdent :: TokenParser (Text, Maybe Kind)
+kindedIdent :: TokenParser (Text, Maybe SourceKind)
kindedIdent = (, Nothing) <$> identifier
<|> parens ((,) <$> identifier <*> (Just <$> (indented *> doubleColon *> indented *> parseKind)))
@@ -204,10 +204,11 @@ parseTypeClassDeclaration = withSourceAnnF $ do
indented *> mark (P.many (same *> parseTypeDeclaration))
return $ \sa -> TypeClassDeclaration sa className idents implies dependencies members
-parseConstraint :: TokenParser Constraint
-parseConstraint = Constraint <$> parseQualified properName
- <*> P.many (noWildcards $ noForAll parseTypeAtom)
- <*> pure Nothing
+parseConstraint :: TokenParser SourceConstraint
+parseConstraint = withSourceAnnF $ do
+ name <- parseQualified properName
+ args <- P.many (noWildcards $ noForAll parseTypeAtom)
+ return $ \ann -> Constraint ann name args Nothing
parseInstanceDeclaration :: TokenParser (TypeInstanceBody -> Declaration)
parseInstanceDeclaration = withSourceAnnF $ do
@@ -483,17 +484,17 @@ parseAccessor obj = P.try $ Accessor <$> (indented *> dot *> indented *> parseLa
parseDo :: TokenParser Expr
parseDo = do
- reserved "do"
+ m <- P.try (getQual <$> parseQualified (reserved "do")) <|> (reserved "do" *> pure Nothing)
indented
- Do <$> mark (P.many1 (same *> mark parseDoNotationElement))
+ Do m <$> mark (P.many1 (same *> mark parseDoNotationElement))
parseAdo :: TokenParser Expr
parseAdo = do
- reserved "ado"
+ m <- P.try (getQual <$> parseQualified (reserved "ado")) <|> (reserved "ado" *> pure Nothing)
indented
elements <- mark (P.many (same *> mark parseDoNotationElement))
yield <- mark (reserved "in" *> parseValue)
- pure $ Ado elements yield
+ pure $ Ado m elements yield
parseDoNotationLet :: TokenParser DoNotationElement
parseDoNotationLet = DoNotationLet <$> (reserved "let" *> indented *> mark (P.many1 (same *> parseLocalDeclaration)))
diff --git a/src/Language/PureScript/Parser/Kinds.hs b/src/Language/PureScript/Parser/Kinds.hs
index 06c29f5..abdc810 100644
--- a/src/Language/PureScript/Parser/Kinds.hs
+++ b/src/Language/PureScript/Parser/Kinds.hs
@@ -12,31 +12,23 @@ import Language.PureScript.Parser.Lexer
import qualified Text.Parsec as P
import qualified Text.Parsec.Expr as P
-parseStar :: TokenParser Kind
-parseStar = symbol' "*" *>
- P.parserFail "The `*` symbol is no longer used for the kind of types.\n The new equivalent is the named kind `Type`."
+parseNamedKind :: TokenParser SourceKind
+parseNamedKind = withSourceAnnF $ do
+ name <- parseQualified kindName
+ return $ \ann -> NamedKind ann name
-parseBang :: TokenParser Kind
-parseBang = symbol' "!" *>
- P.parserFail "The `!` symbol is no longer used for the kind of effects.\n The new equivalent is the named kind `Effect`, defined in `Control.Monad.Eff` in the `purescript-eff` library."
-
-parseNamedKind :: TokenParser Kind
-parseNamedKind = NamedKind <$> parseQualified kindName
-
-parseKindAtom :: TokenParser Kind
+parseKindAtom :: TokenParser SourceKind
parseKindAtom =
indented *> P.choice
- [ parseStar
- , parseBang
- , parseNamedKind
+ [ parseNamedKind
, parens parseKind
]
-- |
-- Parse a kind
--
-parseKind :: TokenParser Kind
+parseKind :: TokenParser SourceKind
parseKind = P.buildExpressionParser operators parseKindAtom P.<?> "kind"
where
- operators = [ [ P.Prefix (symbol' "#" >> return Row) ]
- , [ P.Infix (rarrow >> return FunKind) P.AssocRight ] ]
+ operators = [ [ P.Prefix (withSourceAnnF $ symbol' "#" >> return Row) ]
+ , [ P.Infix (withSourceAnnF $ rarrow >> return FunKind) P.AssocRight ] ]
diff --git a/src/Language/PureScript/Parser/Lexer.hs b/src/Language/PureScript/Parser/Lexer.hs
index 377d9b1..cc615ff 100644
--- a/src/Language/PureScript/Parser/Lexer.hs
+++ b/src/Language/PureScript/Parser/Lexer.hs
@@ -69,7 +69,7 @@ import Prelude.Compat hiding (lex)
import Control.Applicative ((<|>))
import Control.Monad (void, guard)
import Control.Monad.Identity (Identity)
-import Data.Char (isSpace, isAscii, isSymbol, isAlphaNum)
+import Data.Char (isSpace, isAscii, isSymbol, isAlphaNum, isAlpha, isLower)
import Data.String (fromString)
import Data.Text (Text)
import qualified Data.Text as T
@@ -591,7 +591,7 @@ isSymbolChar c = (c `elem` (":!#$%&*+./<=>?@\\^|-~" :: [Char])) || (not (isAscii
-- The characters allowed in the head of an unquoted record key
--
isUnquotedKeyHeadChar :: Char -> Bool
-isUnquotedKeyHeadChar c = (c == '_') || isAlphaNum c
+isUnquotedKeyHeadChar c = (c == '_') || (isAlpha c && isLower c)
-- |
-- The characters allowed in the tail of an unquoted record key
@@ -603,7 +603,8 @@ isUnquotedKeyTailChar c = (c `elem` ("_'" :: [Char])) || isAlphaNum c
-- Strings allowed to be left unquoted in a record key
--
isUnquotedKey :: Text -> Bool
-isUnquotedKey t = case T.uncons t of
- Nothing -> False
- Just (hd, tl) -> isUnquotedKeyHeadChar hd &&
- T.all isUnquotedKeyTailChar tl
+isUnquotedKey t =
+ case T.uncons t of
+ Nothing -> False
+ Just (hd, tl) -> isUnquotedKeyHeadChar hd &&
+ T.all isUnquotedKeyTailChar tl
diff --git a/src/Language/PureScript/Parser/Types.hs b/src/Language/PureScript/Parser/Types.hs
index 3a9803c..2bd34f6 100644
--- a/src/Language/PureScript/Parser/Types.hs
+++ b/src/Language/PureScript/Parser/Types.hs
@@ -15,6 +15,7 @@ import qualified Data.Text as T
import Language.PureScript.AST.SourcePos
import Language.PureScript.Environment
+import Language.PureScript.Kinds
import Language.PureScript.Parser.Common
import Language.PureScript.Parser.Kinds
import Language.PureScript.Parser.Lexer
@@ -24,40 +25,44 @@ import Language.PureScript.Label (Label(..))
import qualified Text.Parsec as P
import qualified Text.Parsec.Expr as P
-parseFunction :: TokenParser Type
+parseFunction :: TokenParser SourceType
parseFunction = parens rarrow *> return tyFunction
-parseObject :: TokenParser Type
-parseObject = braces $ TypeApp tyRecord <$> parseRow
+parseObject :: TokenParser SourceType
+parseObject = withSourceAnnF $ braces $ do
+ rows <- parseRow
+ return $ \ann -> TypeApp ann tyRecord rows
-parseTypeLevelString :: TokenParser Type
-parseTypeLevelString = TypeLevelString <$> stringLiteral
+parseTypeLevelString :: TokenParser SourceType
+parseTypeLevelString = withSourceAnnF $ flip TypeLevelString <$> stringLiteral
-parseTypeWildcard :: TokenParser Type
-parseTypeWildcard = do
- start <- P.getPosition
- let end = P.incSourceColumn start 1
- underscore
- return $ TypeWildcard (SourceSpan (P.sourceName start) (toSourcePos start) (toSourcePos end))
+parseTypeWildcard :: TokenParser SourceType
+parseTypeWildcard = withSourceAnnF $ do
+ name <- Just <$> holeLit
+ <|> Nothing <$ underscore
+ return $ flip TypeWildcard name
-parseTypeVariable :: TokenParser Type
-parseTypeVariable = do
+parseTypeVariable :: TokenParser SourceType
+parseTypeVariable = withSourceAnnF $ do
ident <- identifier
when (ident `elem` reservedTypeNames) $ P.unexpected (T.unpack ident)
- return $ TypeVar ident
+ return $ \ann -> TypeVar ann ident
-parseTypeConstructor :: TokenParser Type
-parseTypeConstructor = TypeConstructor <$> parseQualified typeName
-
-parseForAll :: TokenParser Type
-parseForAll = mkForAll <$> ((reserved "forall" <|> reserved "∀") *> P.many1 (indented *> identifier) <* indented <* dot)
- <*> parseType
+parseTypeConstructor :: TokenParser SourceType
+parseTypeConstructor = withSourceAnnF $ flip TypeConstructor <$> parseQualified typeName
+parseForAll :: TokenParser SourceType
+parseForAll =
+ mkForAll
+ <$> ((reserved "forall" <|> reserved "∀")
+ *> (P.many1 $ indented *> (withSourceAnnF $ flip (,) <$> identifier))
+ <* indented <* dot)
+ <*> parseType
-- |
-- Parse an atomic type with no `forall`
--
-noForAll :: TokenParser Type -> TokenParser Type
+noForAll :: TokenParser SourceType -> TokenParser SourceType
noForAll p = do
ty <- p
when (containsForAll ty) $ P.unexpected "forall"
@@ -66,7 +71,7 @@ noForAll p = do
-- |
-- Parse a type as it appears in e.g. a data constructor
--
-parseTypeAtom :: TokenParser Type
+parseTypeAtom :: TokenParser SourceType
parseTypeAtom = indented *> P.choice
[ P.try parseFunction
, parseTypeLevelString
@@ -77,31 +82,34 @@ parseTypeAtom = indented *> P.choice
, parseTypeConstructor
-- This try is needed due to some unfortunate ambiguities between rows and kinded types
, P.try (parens parseRow)
- , ParensInType <$> parens parsePolyType
+ , parseParensInType
]
-parseConstrainedType :: TokenParser ([Constraint], Type)
-parseConstrainedType = do
+parseParensInType :: TokenParser SourceType
+parseParensInType = withSourceAnnF $ flip ParensInType <$> parens parsePolyType
+
+parseConstrainedType :: TokenParser (SourceAnn, [SourceConstraint], SourceType)
+parseConstrainedType = withSourceAnnF $ do
constraints <- parens (commaSep1 parseConstraint) <|> pure <$> parseConstraint
_ <- rfatArrow
indented
ty <- parseType
- return (constraints, ty)
+ return (, constraints, ty)
where
- parseConstraint = do
+ parseConstraint = withSourceAnnF $ do
className <- parseQualified properName
indented
ty <- P.many parseTypeAtom
- return (Constraint className ty Nothing)
+ return $ \ann -> Constraint ann className ty Nothing
-- This is here to improve the error message when the user
-- tries to use the old style constraint contexts.
-- TODO: Remove this before 1.0
-typeOrConstrainedType :: TokenParser Type
+typeOrConstrainedType :: TokenParser SourceType
typeOrConstrainedType = do
e <- P.try (Left <$> parseConstrainedType) <|> Right <$> parseTypeAtom
case e of
- Left ([c], ty) -> pure (ConstrainedType c ty)
+ Left (ann, [c], ty) -> pure (ConstrainedType ann c ty)
Left _ ->
P.unexpected $
unlines [ "comma in constraints."
@@ -114,22 +122,34 @@ typeOrConstrainedType = do
]
Right ty -> pure ty
-parseAnyType :: TokenParser Type
+parseAnyType :: TokenParser SourceType
parseAnyType = P.buildExpressionParser operators (buildPostfixParser postfixTable typeOrConstrainedType) P.<?> "type"
where
- operators = [ [ P.Infix (return TypeApp) P.AssocLeft ]
- , [ P.Infix (P.try (parseQualified parseOperator) >>= \ident ->
- return (BinaryNoParensType (TypeOp ident))) P.AssocRight
+ operators = [ [ P.Infix (return mkTypeApp) P.AssocLeft ]
+ , [ P.Infix parseTypeOp P.AssocRight
]
, [ P.Infix (rarrow $> function) P.AssocRight ]
]
- postfixTable = [ \t -> KindedType t <$> (indented *> doubleColon *> parseKind)
+ postfixTable = [ parseKindedType
]
+ mkTypeApp lhs rhs =
+ TypeApp (widenSourceAnn (getAnnForType lhs) (getAnnForType rhs)) lhs rhs
+
+ parseTypeOp = withSourceAnnF $ do
+ ident <- P.try (parseQualified parseOperator)
+ return $ \ann lhs rhs ->
+ BinaryNoParensType (widenSourceAnn (getAnnForType lhs) (getAnnForType rhs)) (TypeOp ann ident) lhs rhs
+
+ parseKindedType ty = do
+ kind <- indented *> doubleColon *> parseKind
+ return $ KindedType (widenSourceAnn (getAnnForType ty) (getAnnForKind kind)) ty kind
+
+
-- |
-- Parse a monotype
--
-parseType :: TokenParser Type
+parseType :: TokenParser SourceType
parseType = do
ty <- parseAnyType
unless (isMonoType ty) $ P.unexpected "polymorphic type"
@@ -138,23 +158,27 @@ parseType = do
-- |
-- Parse a polytype
--
-parsePolyType :: TokenParser Type
+parsePolyType :: TokenParser SourceType
parsePolyType = parseAnyType
-- |
-- Parse an atomic type with no wildcards
--
-noWildcards :: TokenParser Type -> TokenParser Type
+noWildcards :: TokenParser SourceType -> TokenParser SourceType
noWildcards p = do
ty <- p
when (containsWildcards ty) $ P.unexpected "type wildcard"
return ty
-parseNameAndType :: TokenParser t -> TokenParser (Label, t)
-parseNameAndType p = (,) <$> (indented *> (Label <$> parseLabel) <* indented <* doubleColon) <*> p
+parseRowListItem :: TokenParser SourceType -> TokenParser (RowListItem SourceAnn)
+parseRowListItem p = withSourceAnnF $
+ (\name ty ann -> RowListItem ann name ty)
+ <$> (indented *> (Label <$> parseLabel) <* indented <* doubleColon) <*> p
-parseRowEnding :: TokenParser Type
-parseRowEnding = P.option REmpty $ indented *> pipe *> indented *> parseType
+parseRowEnding :: TokenParser SourceType
+parseRowEnding =
+ (indented *> pipe *> indented *> parseType)
+ <|> withSourceAnnF (return REmpty)
-parseRow :: TokenParser Type
-parseRow = (curry rowFromList <$> commaSep (parseNameAndType parsePolyType) <*> parseRowEnding) P.<?> "row"
+parseRow :: TokenParser SourceType
+parseRow = (curry rowFromList <$> commaSep (parseRowListItem parsePolyType) <*> parseRowEnding) P.<?> "row"
diff --git a/src/Language/PureScript/Pretty/Common.hs b/src/Language/PureScript/Pretty/Common.hs
index e26fa2a..d284597 100644
--- a/src/Language/PureScript/Pretty/Common.hs
+++ b/src/Language/PureScript/Pretty/Common.hs
@@ -12,10 +12,9 @@ import Control.Monad.State (StateT, modify, get)
import Data.List (elemIndices, intersperse)
import Data.Text (Text)
import qualified Data.Text as T
-import Data.Char (isUpper)
import Language.PureScript.AST (SourcePos(..), SourceSpan(..))
-import Language.PureScript.Parser.Lexer (isUnquotedKey, reservedPsNames)
+import Language.PureScript.Parser.Lexer (isUnquotedKey)
import Text.PrettyPrint.Boxes hiding ((<>))
import qualified Text.PrettyPrint.Boxes as Box
@@ -148,11 +147,7 @@ prettyPrintMany f xs = do
return $ intercalate (emit "\n") $ map (mappend indentString) ss
objectKeyRequiresQuoting :: Text -> Bool
-objectKeyRequiresQuoting s =
- s `elem` reservedPsNames || not (isUnquotedKey s) || startsUppercase s where
- startsUppercase label = case T.uncons label of
- Just (c, _) -> isUpper c
- _ -> False
+objectKeyRequiresQuoting = not . isUnquotedKey
-- | 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/Kinds.hs b/src/Language/PureScript/Pretty/Kinds.hs
index 9f950af..275f5e3 100644
--- a/src/Language/PureScript/Pretty/Kinds.hs
+++ b/src/Language/PureScript/Pretty/Kinds.hs
@@ -19,39 +19,39 @@ import Language.PureScript.Kinds
import Language.PureScript.Names
import Language.PureScript.Pretty.Common
-typeLiterals :: Pattern () Kind Text
+typeLiterals :: Pattern () (Kind a) Text
typeLiterals = mkPattern match
where
- match (KUnknown u) =
+ match (KUnknown _ u) =
Just $ T.cons 'k' (T.pack (show u))
- match (NamedKind name) =
+ match (NamedKind _ name) =
Just $ if isQualifiedWith (moduleNameFromString "Prim") name
then runProperName (disqualify name)
else showQualified runProperName name
match _ = Nothing
-matchRow :: Pattern () Kind ((), Kind)
+matchRow :: Pattern () (Kind a) ((), Kind a)
matchRow = mkPattern match
where
- match (Row k) = Just ((), k)
+ match (Row _ k) = Just ((), k)
match _ = Nothing
-funKind :: Pattern () Kind (Kind, Kind)
+funKind :: Pattern () (Kind a) (Kind a, Kind a)
funKind = mkPattern match
where
- match (FunKind arg ret) = Just (arg, ret)
+ match (FunKind _ arg ret) = Just (arg, ret)
match _ = Nothing
-- | Generate a pretty-printed string representing a Kind
-prettyPrintKind :: Kind -> Text
+prettyPrintKind :: Kind a -> Text
prettyPrintKind
= fromMaybe (internalError "Incomplete pattern")
. PA.pattern matchKind ()
where
- matchKind :: Pattern () Kind Text
+ matchKind :: Pattern () (Kind a) Text
matchKind = buildPrettyPrinter operators (typeLiterals <+> fmap parensT matchKind)
- operators :: OperatorTable () Kind Text
+ operators :: OperatorTable () (Kind a) Text
operators =
OperatorTable [ [ Wrap matchRow $ \_ k -> "# " <> k]
, [ AssocR funKind $ \arg ret -> arg <> " -> " <> ret ] ]
diff --git a/src/Language/PureScript/Pretty/Types.hs b/src/Language/PureScript/Pretty/Types.hs
index 40c2956..531bffd 100644
--- a/src/Language/PureScript/Pretty/Types.hs
+++ b/src/Language/PureScript/Pretty/Types.hs
@@ -2,12 +2,17 @@
-- Pretty printer for Types
--
module Language.PureScript.Pretty.Types
- ( typeAsBox
+ ( PrettyPrintType(..)
+ , PrettyPrintConstraint
+ , convertPrettyPrintType
+ , typeAsBox
+ , typeAsBox'
, suggestedTypeAsBox
, prettyPrintType
, prettyPrintTypeWithUnicode
, prettyPrintSuggestedType
, typeAtomAsBox
+ , typeAtomAsBox'
, prettyPrintTypeAtom
, prettyPrintRow
, prettyPrintLabel
@@ -19,6 +24,7 @@ import Prelude.Compat hiding ((<>))
import Control.Arrow ((<+>))
import Control.PatternArrows as PA
+import Data.Functor (($>))
import Data.Maybe (fromMaybe)
import Data.Text (Text)
import qualified Data.Text as T
@@ -35,114 +41,147 @@ import Language.PureScript.Label (Label(..))
import Text.PrettyPrint.Boxes hiding ((<+>))
+data PrettyPrintType
+ = PPTUnknown Int
+ | PPTypeVar Text
+ | PPTypeLevelString PSString
+ | PPTypeWildcard (Maybe Text)
+ | PPTypeConstructor (Qualified (ProperName 'TypeName))
+ | PPTypeOp (Qualified (OpName 'TypeOpName))
+ | PPSkolem Text Int
+ | PPTypeApp PrettyPrintType PrettyPrintType
+ | PPConstrainedType PrettyPrintConstraint PrettyPrintType
+ | PPKindedType PrettyPrintType (Kind ())
+ | PPBinaryNoParensType PrettyPrintType PrettyPrintType PrettyPrintType
+ | PPParensInType PrettyPrintType
+ | PPForAll [Text] PrettyPrintType
+ | PPFunction PrettyPrintType PrettyPrintType
+ | PPRecord PrettyPrintType
+ | PPRCons Label PrettyPrintType PrettyPrintType
+ | PPREmpty
+
+type PrettyPrintConstraint = (Qualified (ProperName 'ClassName), [PrettyPrintType])
+
+convertPrettyPrintType :: Type a -> PrettyPrintType
+convertPrettyPrintType = go
+ where
+ go (TUnknown _ n) = PPTUnknown n
+ go (TypeVar _ t) = PPTypeVar t
+ go (TypeLevelString _ s) = PPTypeLevelString s
+ go (TypeWildcard _ n) = PPTypeWildcard n
+ go (TypeConstructor _ c) = PPTypeConstructor c
+ go (TypeOp _ o) = PPTypeOp o
+ go (Skolem _ t n _) = PPSkolem t n
+ go (ConstrainedType _ (Constraint _ cls args _) ty) = PPConstrainedType (cls, go <$> args) (go ty)
+ go (KindedType _ ty k) = PPKindedType (go ty) (k $> ())
+ go (BinaryNoParensType _ ty1 ty2 ty3) = PPBinaryNoParensType (go ty1) (go ty2) (go ty3)
+ go (ParensInType _ ty) = PPParensInType (go ty)
+ go (REmpty _) = PPREmpty
+ go (RCons _ l ty1 ty2) = PPRCons l (go ty1) (go ty2)
+ go (ForAll _ v ty _) = goForAll [v] ty
+ go (TypeApp _ (TypeApp _ f arg) ret) | eqType f tyFunction = PPFunction (go arg) (go ret)
+ go (TypeApp _ o r) | eqType o tyRecord = PPRecord (go r)
+ go (TypeApp _ a b) = PPTypeApp (go a) (go b)
+
+ goForAll vs (ForAll _ v ty _) = goForAll (v : vs) ty
+ goForAll vs ty = PPForAll vs (go ty)
+
-- TODO(Christoph): get rid of T.unpack s
-constraintsAsBox :: TypeRenderOptions -> Constraint -> Box -> Box
+constraintsAsBox :: TypeRenderOptions -> PrettyPrintConstraint -> Box -> Box
constraintsAsBox tro con ty =
constraintAsBox con `before` (" " <> text doubleRightArrow <> " " <> ty)
where
doubleRightArrow = if troUnicode tro then "⇒" else "=>"
-constraintAsBox :: Constraint -> Box
-constraintAsBox (Constraint pn tys _) = typeAsBox (foldl TypeApp (TypeConstructor (fmap coerceProperName pn)) tys)
+constraintAsBox :: PrettyPrintConstraint -> Box
+constraintAsBox (pn, tys) = typeAsBox' (foldl PPTypeApp (PPTypeConstructor (fmap coerceProperName pn)) tys)
-- |
-- Generate a pretty-printed string representing a Row
--
-prettyPrintRowWith :: TypeRenderOptions -> Char -> Char -> Type -> Box
+prettyPrintRowWith :: TypeRenderOptions -> Char -> Char -> PrettyPrintType -> Box
prettyPrintRowWith tro open close = uncurry listToBox . toList []
where
- nameAndTypeToPs :: Char -> Label -> Type -> Box
- nameAndTypeToPs start name ty = text (start : ' ' : T.unpack (prettyPrintLabel name) ++ " " ++ doubleColon ++ " ") <> typeAsBox ty
+ nameAndTypeToPs :: Char -> Label -> PrettyPrintType -> Box
+ nameAndTypeToPs start name ty = text (start : ' ' : T.unpack (prettyPrintLabel name) ++ " " ++ doubleColon ++ " ") <> typeAsBox' ty
doubleColon = if troUnicode tro then "∷" else "::"
- tailToPs :: Type -> Box
- tailToPs REmpty = nullBox
- tailToPs other = text "| " <> typeAsBox other
+ tailToPs :: PrettyPrintType -> Box
+ tailToPs PPREmpty = nullBox
+ tailToPs other = text "| " <> typeAsBox' other
- listToBox :: [(Label, Type)] -> Type -> Box
- listToBox [] REmpty = text [open, close]
+ listToBox :: [(Label, PrettyPrintType)] -> PrettyPrintType -> Box
+ listToBox [] PPREmpty = text [open, close]
listToBox [] rest = text [ open, ' ' ] <> tailToPs rest <> text [ ' ', close ]
listToBox ts rest = vcat left $
zipWith (\(nm, ty) i -> nameAndTypeToPs (if i == 0 then open else ',') nm ty) ts [0 :: Int ..] ++
[ tailToPs rest, text [close] ]
- toList :: [(Label, Type)] -> Type -> ([(Label, Type)], Type)
- toList tys (RCons name ty row) = toList ((name, ty):tys) row
+ toList :: [(Label, PrettyPrintType)] -> PrettyPrintType -> ([(Label, PrettyPrintType)], PrettyPrintType)
+ toList tys (PPRCons name ty row) = toList ((name, ty):tys) row
toList tys r = (reverse tys, r)
-prettyPrintRow :: Type -> String
+prettyPrintRow :: PrettyPrintType -> String
prettyPrintRow = render . prettyPrintRowWith defaultOptions '(' ')'
-typeApp :: Pattern () Type (Type, Type)
+typeApp :: Pattern () PrettyPrintType (PrettyPrintType, PrettyPrintType)
typeApp = mkPattern match
where
- match (TypeApp f x) = Just (f, x)
+ match (PPTypeApp f x) = Just (f, x)
match _ = Nothing
-appliedFunction :: Pattern () Type (Type, Type)
+appliedFunction :: Pattern () PrettyPrintType (PrettyPrintType, PrettyPrintType)
appliedFunction = mkPattern match
where
- match (PrettyPrintFunction arg ret) = Just (arg, ret)
+ match (PPFunction arg ret) = Just (arg, ret)
match _ = Nothing
-kinded :: Pattern () Type (Kind, Type)
+kinded :: Pattern () PrettyPrintType (Kind (), PrettyPrintType)
kinded = mkPattern match
where
- match (KindedType t k) = Just (k, t)
+ match (PPKindedType t k) = Just (k, t)
match _ = Nothing
-insertPlaceholders :: Type -> Type
-insertPlaceholders = everywhereOnTypesTopDown convertForAlls . everywhereOnTypes convert
- where
- convert (TypeApp (TypeApp f arg) ret) | f == tyFunction = PrettyPrintFunction arg ret
- convert (TypeApp o r) | o == tyRecord = PrettyPrintObject r
- convert other = other
- convertForAlls (ForAll ident ty _) = go [ident] ty
- where
- go idents (ForAll ident' ty' _) = go (ident' : idents) ty'
- go idents other = PrettyPrintForAll idents other
- convertForAlls other = other
-
-constrained :: Pattern () Type (Constraint, Type)
+constrained :: Pattern () PrettyPrintType (PrettyPrintConstraint, PrettyPrintType)
constrained = mkPattern match
where
- match (ConstrainedType deps ty) = Just (deps, ty)
+ match (PPConstrainedType deps ty) = Just (deps, ty)
match _ = Nothing
-explicitParens :: Pattern () Type ((), Type)
+explicitParens :: Pattern () PrettyPrintType ((), PrettyPrintType)
explicitParens = mkPattern match
where
- match (ParensInType ty) = Just ((), ty)
+ match (PPParensInType ty) = Just ((), ty)
match _ = Nothing
-matchTypeAtom :: TypeRenderOptions -> Pattern () Type Box
+matchTypeAtom :: TypeRenderOptions -> Pattern () PrettyPrintType Box
matchTypeAtom tro@TypeRenderOptions{troSuggesting = suggesting} =
typeLiterals <+> fmap ((`before` (text ")")) . (text "(" <>)) (matchType tro)
where
- typeLiterals :: Pattern () Type Box
+ typeLiterals :: Pattern () PrettyPrintType Box
typeLiterals = mkPattern match where
- match TypeWildcard{} = Just $ text "_"
- match (TypeVar var) = Just $ text $ T.unpack var
- match (TypeLevelString s) = Just $ text $ T.unpack $ prettyPrintString s
- match (PrettyPrintObject row) = Just $ prettyPrintRowWith tro '{' '}' row
- match (TypeConstructor ctor) = Just $ text $ T.unpack $ runProperName $ disqualify ctor
- match (TUnknown u)
+ match (PPTypeWildcard name) = Just $ maybe (text "_") (text . ('?' :) . T.unpack) name
+ match (PPTypeVar var) = Just $ text $ T.unpack var
+ match (PPTypeLevelString s) = Just $ text $ T.unpack $ prettyPrintString s
+ match (PPRecord row) = Just $ prettyPrintRowWith tro '{' '}' row
+ match (PPTypeConstructor ctor) = Just $ text $ T.unpack $ runProperName $ disqualify ctor
+ match (PPTUnknown u)
| suggesting = Just $ text "_"
| otherwise = Just $ text $ 't' : show u
- match (Skolem name s _ _)
+ match (PPSkolem name s)
| suggesting = Just $ text $ T.unpack name
| otherwise = Just $ text $ T.unpack name ++ show s
- match REmpty = Just $ text "()"
- match row@RCons{} = Just $ prettyPrintRowWith tro '(' ')' row
- match (BinaryNoParensType op l r) =
- Just $ typeAsBox l <> text " " <> typeAsBox op <> text " " <> typeAsBox r
- match (TypeOp op) = Just $ text $ T.unpack $ showQualified runOpName op
+ match PPREmpty = Just $ text "()"
+ match row@PPRCons{} = Just $ prettyPrintRowWith tro '(' ')' row
+ match (PPBinaryNoParensType op l r) =
+ Just $ typeAsBox' l <> text " " <> typeAsBox' op <> text " " <> typeAsBox' r
+ match (PPTypeOp op) = Just $ text $ T.unpack $ showQualified runOpName op
match _ = Nothing
-matchType :: TypeRenderOptions -> Pattern () Type Box
+matchType :: TypeRenderOptions -> Pattern () PrettyPrintType Box
matchType tro = buildPrettyPrinter operators (matchTypeAtom tro) where
- operators :: OperatorTable () Type Box
+ operators :: OperatorTable () PrettyPrintType Box
operators =
OperatorTable [ [ AssocL typeApp $ \f x -> keepSingleLinesOr (moveRight 2) f x ]
, [ AssocR appliedFunction $ \arg ret -> keepSingleLinesOr id arg (text rightArrow <> " " <> ret) ]
@@ -163,26 +202,31 @@ matchType tro = buildPrettyPrinter operators (matchTypeAtom tro) where
| rows b1 > 1 || rows b2 > 1 = vcat left [ b1, f b2 ]
| otherwise = hcat top [ b1, text " ", b2]
-forall_ :: Pattern () Type ([String], Type)
+forall_ :: Pattern () PrettyPrintType ([String], PrettyPrintType)
forall_ = mkPattern match
where
- match (PrettyPrintForAll idents ty) = Just (map T.unpack idents, ty)
+ match (PPForAll idents ty) = Just (map T.unpack idents, ty)
match _ = Nothing
-typeAtomAsBox :: Type -> Box
-typeAtomAsBox
+typeAtomAsBox' :: PrettyPrintType -> Box
+typeAtomAsBox'
= fromMaybe (internalError "Incomplete pattern")
. PA.pattern (matchTypeAtom defaultOptions) ()
- . insertPlaceholders
+
+typeAtomAsBox :: Type a -> Box
+typeAtomAsBox = typeAtomAsBox' . convertPrettyPrintType
-- | Generate a pretty-printed string representing a Type, as it should appear inside parentheses
-prettyPrintTypeAtom :: Type -> String
+prettyPrintTypeAtom :: Type a -> String
prettyPrintTypeAtom = render . typeAtomAsBox
-typeAsBox :: Type -> Box
-typeAsBox = typeAsBoxImpl defaultOptions
+typeAsBox' :: PrettyPrintType -> Box
+typeAsBox' = typeAsBoxImpl defaultOptions
+
+typeAsBox :: Type a -> Box
+typeAsBox = typeAsBox' . convertPrettyPrintType
-suggestedTypeAsBox :: Type -> Box
+suggestedTypeAsBox :: PrettyPrintType -> Box
suggestedTypeAsBox = typeAsBoxImpl suggestingOptions
data TypeRenderOptions = TypeRenderOptions
@@ -199,27 +243,26 @@ defaultOptions = TypeRenderOptions False False
unicodeOptions :: TypeRenderOptions
unicodeOptions = TypeRenderOptions False True
-typeAsBoxImpl :: TypeRenderOptions -> Type -> Box
+typeAsBoxImpl :: TypeRenderOptions -> PrettyPrintType -> Box
typeAsBoxImpl tro
= fromMaybe (internalError "Incomplete pattern")
. PA.pattern (matchType tro) ()
- . insertPlaceholders
-- | Generate a pretty-printed string representing a 'Type'
-prettyPrintType :: Type -> String
+prettyPrintType :: Type a -> String
prettyPrintType = prettyPrintType' defaultOptions
-- | Generate a pretty-printed string representing a 'Type' using unicode
-- symbols where applicable
-prettyPrintTypeWithUnicode :: Type -> String
+prettyPrintTypeWithUnicode :: Type a -> String
prettyPrintTypeWithUnicode = prettyPrintType' unicodeOptions
-- | Generate a pretty-printed string representing a suggested 'Type'
-prettyPrintSuggestedType :: Type -> String
+prettyPrintSuggestedType :: Type a -> String
prettyPrintSuggestedType = prettyPrintType' suggestingOptions
-prettyPrintType' :: TypeRenderOptions -> Type -> String
-prettyPrintType' tro = render . typeAsBoxImpl tro
+prettyPrintType' :: TypeRenderOptions -> Type a -> String
+prettyPrintType' tro = render . typeAsBoxImpl tro . convertPrettyPrintType
prettyPrintLabel :: Label -> Text
prettyPrintLabel (Label s) =
diff --git a/src/Language/PureScript/Pretty/Values.hs b/src/Language/PureScript/Pretty/Values.hs
index 7902526..104fca9 100644
--- a/src/Language/PureScript/Pretty/Values.hs
+++ b/src/Language/PureScript/Pretty/Values.hs
@@ -11,6 +11,7 @@ import Prelude.Compat hiding ((<>))
import Control.Arrow (second)
+import Data.Maybe (maybe)
import Data.Text (Text)
import qualified Data.List.NonEmpty as NEL
import qualified Data.Monoid as Monoid ((<>))
@@ -80,12 +81,12 @@ prettyPrintValue d (Let FromLet ds val) =
text "let" //
moveRight 2 (vcat left (map (prettyPrintDeclaration (d - 1)) ds)) //
(text "in " <> prettyPrintValue (d - 1) val)
-prettyPrintValue d (Do els) =
- text "do " <> vcat left (map (prettyPrintDoNotationElement (d - 1)) els)
-prettyPrintValue d (Ado els yield) =
- text "ado " <> vcat left (map (prettyPrintDoNotationElement (d - 1)) els) //
+prettyPrintValue d (Do m els) =
+ textT (maybe "" ((Monoid.<> ".") . runModuleName) m) <> text "do " <> vcat left (map (prettyPrintDoNotationElement (d - 1)) els)
+prettyPrintValue d (Ado m els yield) =
+ textT (maybe "" ((Monoid.<> ".") . runModuleName) m) <> text "ado " <> vcat left (map (prettyPrintDoNotationElement (d - 1)) els) //
(text "in " <> prettyPrintValue (d - 1) yield)
-prettyPrintValue _ (TypeClassDictionary (Constraint name tys _) _ _) = foldl1 beforeWithSpace $ text ("#dict " ++ T.unpack (runProperName (disqualify name))) : map typeAtomAsBox tys
+prettyPrintValue _ (TypeClassDictionary (Constraint _ name tys _) _ _) = foldl1 beforeWithSpace $ text ("#dict " ++ T.unpack (runProperName (disqualify name))) : map typeAtomAsBox tys
prettyPrintValue _ (DeferredDictionary name _) = text $ "#dict " ++ T.unpack (runProperName (disqualify name))
prettyPrintValue _ (TypeClassDictionaryAccessor className ident) =
text "#dict-accessor " <> text (T.unpack (runProperName (disqualify className))) <> text "." <> text (T.unpack (showIdent ident)) <> text ">"
diff --git a/src/Language/PureScript/Sugar/AdoNotation.hs b/src/Language/PureScript/Sugar/AdoNotation.hs
index c881fc3..f7e84bc 100644
--- a/src/Language/PureScript/Sugar/AdoNotation.hs
+++ b/src/Language/PureScript/Sugar/AdoNotation.hs
@@ -28,21 +28,21 @@ desugarAdo d =
let (f, _, _) = everywhereOnValuesM return replace return
in f d
where
- pure' :: Expr
- pure' = Var nullSourceSpan (Qualified Nothing (Ident C.pure'))
+ pure' :: Maybe ModuleName -> Expr
+ pure' m = Var nullSourceSpan (Qualified m (Ident C.pure'))
- map' :: Expr
- map' = Var nullSourceSpan (Qualified Nothing (Ident C.map))
+ map' :: Maybe ModuleName -> Expr
+ map' m = Var nullSourceSpan (Qualified m (Ident C.map))
- apply :: Expr
- apply = Var nullSourceSpan (Qualified Nothing (Ident C.apply))
+ apply :: Maybe ModuleName -> Expr
+ apply m = Var nullSourceSpan (Qualified m (Ident C.apply))
replace :: Expr -> m Expr
- replace (Ado els yield) = do
+ replace (Ado m els yield) = do
(func, args) <- foldM go (yield, []) (reverse els)
return $ case args of
- [] -> App pure' func
- hd : tl -> foldl' (\a b -> App (App apply a) b) (App (App map' func) hd) tl
+ [] -> App (pure' m) func
+ hd : tl -> foldl' (\a b -> App (App (apply m) a) b) (App (App (map' m) func) hd) tl
replace (PositionedValue pos com v) = PositionedValue pos com <$> rethrowWithPosition pos (replace v)
replace other = return other
diff --git a/src/Language/PureScript/Sugar/BindingGroups.hs b/src/Language/PureScript/Sugar/BindingGroups.hs
index f78c9dd..a4efc20 100644
--- a/src/Language/PureScript/Sugar/BindingGroups.hs
+++ b/src/Language/PureScript/Sugar/BindingGroups.hs
@@ -138,13 +138,13 @@ usedTypeNames moduleName =
let (f, _, _, _, _) = accumTypes (everythingOnTypes (++) usedNames)
in ordNub . f
where
- usedNames :: Type -> [ProperName 'TypeName]
- usedNames (ConstrainedType con _) =
+ usedNames :: SourceType -> [ProperName 'TypeName]
+ usedNames (ConstrainedType _ con _) =
case con of
- (Constraint (Qualified (Just moduleName') name) _ _)
+ (Constraint _ (Qualified (Just moduleName') name) _ _)
| moduleName == moduleName' -> [coerceProperName name]
_ -> []
- usedNames (TypeConstructor (Qualified (Just moduleName') name))
+ usedNames (TypeConstructor _ (Qualified (Just moduleName') name))
| moduleName == moduleName' = [name]
usedNames _ = []
diff --git a/src/Language/PureScript/Sugar/DoNotation.hs b/src/Language/PureScript/Sugar/DoNotation.hs
index a3d46bf..003580c 100644
--- a/src/Language/PureScript/Sugar/DoNotation.hs
+++ b/src/Language/PureScript/Sugar/DoNotation.hs
@@ -29,43 +29,43 @@ desugarDo d =
(f, _, _) = everywhereOnValuesM return (replace ss) return
in rethrowWithPosition ss $ f d
where
- bind :: SourceSpan -> Expr
- bind = flip Var (Qualified Nothing (Ident C.bind))
+ bind :: SourceSpan -> Maybe ModuleName -> Expr
+ bind ss m = Var ss (Qualified m (Ident C.bind))
- discard :: SourceSpan -> Expr
- discard = flip Var (Qualified Nothing (Ident C.discard))
+ discard :: SourceSpan -> Maybe ModuleName -> Expr
+ discard ss m = Var ss (Qualified m (Ident C.discard))
replace :: SourceSpan -> Expr -> m Expr
- replace pos (Do els) = go pos els
+ replace pos (Do m els) = go pos m els
replace _ (PositionedValue pos com v) = PositionedValue pos com <$> rethrowWithPosition pos (replace pos v)
replace _ other = return other
- go :: SourceSpan -> [DoNotationElement] -> m Expr
- go _ [] = internalError "The impossible happened in desugarDo"
- go _ [DoNotationValue val] = return val
- go pos (DoNotationValue val : rest) = do
- rest' <- go pos rest
- return $ App (App (discard pos) val) (Abs (VarBinder pos UnusedIdent) rest')
- go _ [DoNotationBind _ _] = throwError . errorMessage $ InvalidDoBind
- go _ (DoNotationBind b _ : _) | First (Just ident) <- foldMap fromIdent (binderNames b) =
+ go :: SourceSpan -> Maybe ModuleName -> [DoNotationElement] -> m Expr
+ go _ _ [] = internalError "The impossible happened in desugarDo"
+ go _ _ [DoNotationValue val] = return val
+ go pos m (DoNotationValue val : rest) = do
+ rest' <- go pos m rest
+ return $ App (App (discard pos m) val) (Abs (VarBinder pos UnusedIdent) rest')
+ go _ _ [DoNotationBind _ _] = throwError . errorMessage $ InvalidDoBind
+ go _ _ (DoNotationBind b _ : _) | First (Just ident) <- foldMap fromIdent (binderNames b) =
throwError . errorMessage $ CannotUseBindWithDo (Ident ident)
where
fromIdent (Ident i) | i `elem` [ C.bind, C.discard ] = First (Just i)
fromIdent _ = mempty
- go pos (DoNotationBind (VarBinder ss ident) val : rest) = do
- rest' <- go pos rest
- return $ App (App (bind pos) val) (Abs (VarBinder ss ident) rest')
- go pos (DoNotationBind binder val : rest) = do
- rest' <- go pos rest
+ go pos m (DoNotationBind (VarBinder ss ident) val : rest) = do
+ rest' <- go pos m rest
+ return $ App (App (bind pos m) val) (Abs (VarBinder ss ident) rest')
+ go pos m (DoNotationBind binder val : rest) = do
+ rest' <- go pos m rest
ident <- freshIdent'
- return $ App (App (bind pos) val) (Abs (VarBinder pos ident) (Case [Var pos (Qualified Nothing ident)] [CaseAlternative [binder] [MkUnguarded rest']]))
- go _ [DoNotationLet _] = throwError . errorMessage $ InvalidDoLet
- go pos (DoNotationLet ds : rest) = do
+ return $ App (App (bind pos m) val) (Abs (VarBinder pos ident) (Case [Var pos (Qualified Nothing ident)] [CaseAlternative [binder] [MkUnguarded rest']]))
+ go _ _ [DoNotationLet _] = throwError . errorMessage $ InvalidDoLet
+ go pos m (DoNotationLet ds : rest) = do
let checkBind :: Declaration -> m ()
checkBind (ValueDecl (ss, _) i@(Ident name) _ _ _)
| name `elem` [ C.bind, C.discard ] = throwError . errorMessage' ss $ CannotUseBindWithDo i
checkBind _ = pure ()
mapM_ checkBind ds
- rest' <- go pos rest
+ rest' <- go pos m rest
return $ Let FromLet ds rest'
- go _ (PositionedDoNotationElement pos com el : rest) = rethrowWithPosition pos $ PositionedValue pos com <$> go pos (el : rest)
+ go _ m (PositionedDoNotationElement pos com el : rest) = rethrowWithPosition pos $ PositionedValue pos com <$> go pos m (el : rest)
diff --git a/src/Language/PureScript/Sugar/Names.hs b/src/Language/PureScript/Sugar/Names.hs
index afa770f..2296139 100644
--- a/src/Language/PureScript/Sugar/Names.hs
+++ b/src/Language/PureScript/Sugar/Names.hs
@@ -306,35 +306,35 @@ renameInModule imports (Module modSS coms mn decls exps) =
letBoundVariable :: Declaration -> Maybe Ident
letBoundVariable = fmap valdeclIdent . getValueDeclaration
- updateKindsEverywhere :: SourceSpan -> Kind -> m Kind
+ updateKindsEverywhere :: SourceSpan -> Kind a -> m (Kind a)
updateKindsEverywhere pos = everywhereOnKindsM updateKind
where
- updateKind :: Kind -> m Kind
- updateKind (NamedKind name) = NamedKind <$> updateKindName name pos
+ updateKind :: Kind a -> m (Kind a)
+ updateKind (NamedKind ann name) = NamedKind ann <$> updateKindName name pos
updateKind k = return k
updateTypeArguments
:: (Traversable f, Traversable g)
=> SourceSpan
- -> f (a, g Kind) -> m (f (a, g Kind))
+ -> f (a, g (Kind ann)) -> m (f (a, g (Kind ann)))
updateTypeArguments pos = traverse (sndM (traverse (updateKindsEverywhere pos)))
- updateTypesEverywhere :: SourceSpan -> Type -> m Type
+ updateTypesEverywhere :: SourceSpan -> Type a -> m (Type a)
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 c t) = ConstrainedType <$> updateInConstraint c <*> pure t
- updateType (KindedType t k) = KindedType t <$> updateKindsEverywhere pos k
+ updateType :: Type a -> m (Type a)
+ updateType (TypeOp ann name) = TypeOp ann <$> updateTypeOpName name pos
+ updateType (TypeConstructor ann name) = TypeConstructor ann <$> updateTypeName name pos
+ updateType (ConstrainedType ann c t) = ConstrainedType ann <$> updateInConstraint c <*> pure t
+ updateType (KindedType ann t k) = KindedType ann t <$> updateKindsEverywhere pos k
updateType t = return t
- updateInConstraint :: Constraint -> m Constraint
- updateInConstraint (Constraint name ts info) =
- Constraint <$> updateClassName name pos <*> pure ts <*> pure info
+ updateInConstraint :: Constraint a -> m (Constraint a)
+ updateInConstraint (Constraint ann name ts info) =
+ Constraint ann <$> updateClassName name pos <*> pure ts <*> pure info
- updateConstraints :: SourceSpan -> [Constraint] -> m [Constraint]
- updateConstraints pos = traverse $ \(Constraint name ts info) ->
- Constraint
+ updateConstraints :: SourceSpan -> [Constraint a] -> m [Constraint a]
+ updateConstraints pos = traverse $ \(Constraint ann name ts info) ->
+ Constraint ann
<$> updateClassName name pos
<*> traverse (updateTypesEverywhere pos) ts
<*> pure info
diff --git a/src/Language/PureScript/Sugar/Names/Env.hs b/src/Language/PureScript/Sugar/Names/Env.hs
index d939336..a378000 100644
--- a/src/Language/PureScript/Sugar/Names/Env.hs
+++ b/src/Language/PureScript/Sugar/Names/Env.hs
@@ -189,6 +189,12 @@ primExports :: Exports
primExports = mkPrimExports primTypes primClasses primKinds
-- |
+-- The exported types from the @Prim.Boolean@ module
+--
+primBooleanExports :: Exports
+primBooleanExports = mkPrimExports primBooleanTypes mempty primBooleanKinds
+
+-- |
-- The exported types from the @Prim.Ordering@ module
--
primOrderingExports :: Exports
@@ -243,6 +249,9 @@ primEnv = M.fromList
[ ( C.Prim
, (internalModuleSourceSpan "<Prim>", nullImports, primExports)
)
+ , ( C.PrimBoolean
+ , (internalModuleSourceSpan "<Prim.Boolean>", nullImports, primBooleanExports)
+ )
, ( C.PrimOrdering
, (internalModuleSourceSpan "<Prim.Ordering>", nullImports, primOrderingExports)
)
diff --git a/src/Language/PureScript/Sugar/Operators.hs b/src/Language/PureScript/Sugar/Operators.hs
index 2ca1b1f..9a2868f 100644
--- a/src/Language/PureScript/Sugar/Operators.hs
+++ b/src/Language/PureScript/Sugar/Operators.hs
@@ -166,11 +166,11 @@ rebracketFiltered pred_ externs modules = do
internalError "BinaryNoParensBinder has no OpBinder"
goBinder pos other = return (pos, other)
- goType :: SourceSpan -> Type -> m Type
- goType pos (BinaryNoParensType (TypeOp op) lhs rhs) =
+ goType :: SourceSpan -> SourceType -> m SourceType
+ goType pos (BinaryNoParensType ann (TypeOp ann2 op) lhs rhs) =
case op `M.lookup` typeAliased of
Just alias ->
- return $ TypeApp (TypeApp (TypeConstructor alias) lhs) rhs
+ return $ TypeApp ann (TypeApp ann (TypeConstructor ann2 alias) lhs) rhs
Nothing ->
throwError . errorMessage' pos $ UnknownName $ fmap TyOpName op
goType _ other = return other
@@ -202,7 +202,7 @@ rebracketModule pred_ valueOpTable typeOpTable (Module ss coms mn ds exts) =
(goDecl, goExpr', goBinder') = updateTypes goType
- goType :: SourceSpan -> Type -> m Type
+ goType :: SourceSpan -> SourceType -> m SourceType
goType = flip matchTypeOperators typeOpTable
wrap :: (a -> m a) -> (SourceSpan, a) -> m (SourceSpan, a)
@@ -227,8 +227,8 @@ removeParens = f
goBinder (ParensInBinder b) = goBinder b
goBinder b = b
- goType :: Type -> Type
- goType (ParensInType t) = goType t
+ goType :: Type a -> Type a
+ goType (ParensInType _ t) = goType t
goType t = t
decontextify
@@ -302,7 +302,7 @@ customOperatorTable fixities =
updateTypes
:: forall m
. Monad m
- => (SourceSpan -> Type -> m Type)
+ => (SourceSpan -> SourceType -> m SourceType)
-> ( Declaration -> m Declaration
, SourceSpan -> Expr -> m (SourceSpan, Expr)
, SourceSpan -> Binder -> m (SourceSpan, Binder)
@@ -310,7 +310,7 @@ updateTypes
updateTypes goType = (goDecl, goExpr, goBinder)
where
- goType' :: SourceSpan -> Type -> m Type
+ goType' :: SourceSpan -> SourceType -> m SourceType
goType' = everywhereOnTypesTopDownM . goType
goDecl :: Declaration -> m Declaration
@@ -334,9 +334,9 @@ updateTypes goType = (goDecl, goExpr, goBinder)
goExpr :: SourceSpan -> Expr -> m (SourceSpan, Expr)
goExpr _ e@(PositionedValue pos _ _) = return (pos, e)
- goExpr pos (TypeClassDictionary (Constraint name tys info) dicts hints) = do
+ goExpr pos (TypeClassDictionary (Constraint ann name tys info) dicts hints) = do
tys' <- traverse (goType' pos) tys
- return (pos, TypeClassDictionary (Constraint name tys' info) dicts hints)
+ return (pos, TypeClassDictionary (Constraint ann name tys' info) dicts hints)
goExpr pos (DeferredDictionary cls tys) = do
tys' <- traverse (goType' pos) tys
return (pos, DeferredDictionary cls tys')
diff --git a/src/Language/PureScript/Sugar/Operators/Types.hs b/src/Language/PureScript/Sugar/Operators/Types.hs
index 5022a13..fd2e1a1 100644
--- a/src/Language/PureScript/Sugar/Operators/Types.hs
+++ b/src/Language/PureScript/Sugar/Operators/Types.hs
@@ -13,22 +13,22 @@ matchTypeOperators
:: MonadError MultipleErrors m
=> SourceSpan
-> [[(Qualified (OpName 'TypeOpName), Associativity)]]
- -> Type
- -> m Type
+ -> SourceType
+ -> m SourceType
matchTypeOperators ss = matchOperators isBinOp extractOp fromOp reapply id
where
- isBinOp :: Type -> Bool
+ isBinOp :: SourceType -> Bool
isBinOp BinaryNoParensType{} = True
isBinOp _ = False
- extractOp :: Type -> Maybe (Type, Type, Type)
- extractOp (BinaryNoParensType op l r) = Just (op, l, r)
+ extractOp :: SourceType -> Maybe (SourceType, SourceType, SourceType)
+ extractOp (BinaryNoParensType _ op l r) = Just (op, l, r)
extractOp _ = Nothing
- fromOp :: Type -> Maybe (SourceSpan, Qualified (OpName 'TypeOpName))
- fromOp (TypeOp q@(Qualified _ (OpName _))) = Just (ss, q)
+ fromOp :: SourceType -> Maybe (SourceSpan, Qualified (OpName 'TypeOpName))
+ fromOp (TypeOp _ q@(Qualified _ (OpName _))) = Just (ss, q)
fromOp _ = Nothing
- reapply :: a -> Qualified (OpName 'TypeOpName) -> Type -> Type -> Type
- reapply _ = BinaryNoParensType . TypeOp
+ reapply :: a -> Qualified (OpName 'TypeOpName) -> SourceType -> SourceType -> SourceType
+ reapply _ = srcBinaryNoParensType . srcTypeOp
diff --git a/src/Language/PureScript/Sugar/TypeClasses.hs b/src/Language/PureScript/Sugar/TypeClasses.hs
index 0645bcd..08e4af2 100644
--- a/src/Language/PureScript/Sugar/TypeClasses.hs
+++ b/src/Language/PureScript/Sugar/TypeClasses.hs
@@ -193,12 +193,12 @@ desugarDecl mn exps = go
dictDecl <- typeInstanceDictionaryDeclaration sa name mn deps className tys desugared
return (expRef name className tys, [d, dictDecl])
go d@(TypeInstanceDeclaration sa _ _ name deps className tys (NewtypeInstanceWithDictionary dict)) = do
- let dictTy = foldl TypeApp (TypeConstructor (fmap coerceProperName className)) tys
- constrainedTy = quantify (foldr ConstrainedType dictTy deps)
+ let dictTy = foldl srcTypeApp (srcTypeConstructor (fmap coerceProperName className)) tys
+ constrainedTy = quantify (foldr (srcConstrainedType) dictTy deps)
return (expRef name className tys, [d, ValueDecl sa name Private [] [MkUnguarded (TypedValue True dict constrainedTy)]])
go other = return (Nothing, [other])
- expRef :: Ident -> Qualified (ProperName 'ClassName) -> [Type] -> Maybe DeclarationRef
+ expRef :: Ident -> Qualified (ProperName 'ClassName) -> [SourceType] -> Maybe DeclarationRef
expRef name className tys
| isExportedClass className && all isExportedType (getConstructors `concatMap` tys) = Just $ TypeInstanceRef genSpan name
| otherwise = Nothing
@@ -220,39 +220,40 @@ desugarDecl mn exps = go
matchesTypeRef pn (TypeRef _ pn' _) = pn == pn'
matchesTypeRef _ _ = False
- getConstructors :: Type -> [Qualified (ProperName 'TypeName)]
+ getConstructors :: SourceType -> [Qualified (ProperName 'TypeName)]
getConstructors = everythingOnTypes (++) getConstructor
where
- getConstructor (TypeConstructor tcname) = [tcname]
+ getConstructor (TypeConstructor _ tcname) = [tcname]
getConstructor _ = []
genSpan :: SourceSpan
genSpan = internalModuleSourceSpan "<generated>"
-memberToNameAndType :: Declaration -> (Ident, Type)
+memberToNameAndType :: Declaration -> (Ident, SourceType)
memberToNameAndType (TypeDeclaration td) = unwrapTypeDeclaration td
memberToNameAndType _ = internalError "Invalid declaration in type class definition"
typeClassDictionaryDeclaration
:: SourceAnn
-> ProperName 'ClassName
- -> [(Text, Maybe Kind)]
- -> [Constraint]
+ -> [(Text, Maybe SourceKind)]
+ -> [SourceConstraint]
-> [Declaration]
-> Declaration
typeClassDictionaryDeclaration sa name args implies members =
let superclassTypes = superClassDictionaryNames implies `zip`
- [ function unit (foldl TypeApp (TypeConstructor (fmap coerceProperName superclass)) tyArgs)
- | (Constraint superclass tyArgs _) <- implies
+ [ function unit (foldl srcTypeApp (srcTypeConstructor (fmap coerceProperName superclass)) tyArgs)
+ | (Constraint _ superclass tyArgs _) <- implies
]
members' = map (first runIdent . memberToNameAndType) members
mtys = members' ++ superclassTypes
- in TypeSynonymDeclaration sa (coerceProperName name) args (TypeApp tyRecord $ rowFromList (map (first (Label . mkString)) mtys, REmpty))
+ toRowListItem (l, t) = srcRowListItem (Label $ mkString l) t
+ in TypeSynonymDeclaration sa (coerceProperName name) args (srcTypeApp tyRecord $ rowFromList (map toRowListItem mtys, srcREmpty))
typeClassMemberToDictionaryAccessor
:: ModuleName
-> ProperName 'ClassName
- -> [(Text, Maybe Kind)]
+ -> [(Text, Maybe SourceKind)]
-> Declaration
-> Declaration
typeClassMemberToDictionaryAccessor mn name args (TypeDeclaration (TypeDeclarationData sa ident ty)) =
@@ -260,12 +261,12 @@ typeClassMemberToDictionaryAccessor mn name args (TypeDeclaration (TypeDeclarati
in ValueDecl sa ident Private [] $
[MkUnguarded (
TypedValue False (TypeClassDictionaryAccessor className ident) $
- moveQuantifiersToFront (quantify (ConstrainedType (Constraint className (map (TypeVar . fst) args) Nothing) ty))
+ moveQuantifiersToFront (quantify (srcConstrainedType (srcConstraint className (map (srcTypeVar . fst) args) Nothing) ty))
)]
typeClassMemberToDictionaryAccessor _ _ _ _ = internalError "Invalid declaration in type class definition"
-unit :: Type
-unit = TypeApp tyRecord REmpty
+unit :: SourceType
+unit = srcTypeApp tyRecord srcREmpty
typeInstanceDictionaryDeclaration
:: forall m
@@ -273,9 +274,9 @@ typeInstanceDictionaryDeclaration
=> SourceAnn
-> Ident
-> ModuleName
- -> [Constraint]
+ -> [SourceConstraint]
-> Qualified (ProperName 'ClassName)
- -> [Type]
+ -> [SourceType]
-> [Declaration]
-> Desugar m Declaration
typeInstanceDictionaryDeclaration sa@(ss, _) name mn deps className tys decls =
@@ -303,20 +304,20 @@ typeInstanceDictionaryDeclaration sa@(ss, _) name mn deps className tys decls =
-- The dictionary itself is a record literal.
let superclasses = superClassDictionaryNames typeClassSuperclasses `zip`
[ Abs (VarBinder ss UnusedIdent) (DeferredDictionary superclass tyArgs)
- | (Constraint superclass suTyArgs _) <- typeClassSuperclasses
+ | (Constraint _ superclass suTyArgs _) <- typeClassSuperclasses
, let tyArgs = map (replaceAllTypeVars (zip (map fst typeClassArguments) tys)) suTyArgs
]
let props = Literal ss $ ObjectLiteral $ map (first mkString) (members ++ superclasses)
- dictTy = foldl TypeApp (TypeConstructor (fmap coerceProperName className)) tys
- constrainedTy = quantify (foldr ConstrainedType dictTy deps)
+ dictTy = foldl srcTypeApp (srcTypeConstructor (fmap coerceProperName className)) tys
+ constrainedTy = quantify (foldr srcConstrainedType dictTy deps)
dict = TypeClassDictionaryConstructorApp className props
result = ValueDecl sa name Private [] [MkUnguarded (TypedValue True dict constrainedTy)]
return result
where
- memberToValue :: [(Ident, Type)] -> Declaration -> Desugar m Expr
+ memberToValue :: [(Ident, SourceType)] -> Declaration -> Desugar m Expr
memberToValue tys' (ValueDecl (ss', _) ident _ [] [MkUnguarded val]) = do
_ <- maybe (throwError . errorMessage' ss' $ ExtraneousClassMember ident className) return $ lookup ident tys'
return val
@@ -330,8 +331,8 @@ declIdent _ = Nothing
typeClassMemberName :: Declaration -> Text
typeClassMemberName = fromMaybe (internalError "typeClassMemberName: Invalid declaration in type class definition") . fmap runIdent . declIdent
-superClassDictionaryNames :: [Constraint] -> [Text]
+superClassDictionaryNames :: [Constraint a] -> [Text]
superClassDictionaryNames supers =
[ superclassName pn index
- | (index, Constraint pn _ _) <- zip [0..] supers
+ | (index, Constraint _ pn _ _) <- zip [0..] supers
]
diff --git a/src/Language/PureScript/Sugar/TypeClasses/Deriving.hs b/src/Language/PureScript/Sugar/TypeClasses/Deriving.hs
index 32398ad..8851d9d 100644
--- a/src/Language/PureScript/Sugar/TypeClasses/Deriving.hs
+++ b/src/Language/PureScript/Sugar/TypeClasses/Deriving.hs
@@ -34,7 +34,7 @@ import Language.PureScript.TypeChecker.Synonyms (SynonymMap, replaceAl
-- instances were derived in the same way. This data structure is used to ensure
-- this property.
data NewtypeDerivedInstances = NewtypeDerivedInstances
- { ndiClasses :: M.Map (ModuleName, ProperName 'ClassName) ([Text], [Constraint], [FunctionalDependency])
+ { ndiClasses :: M.Map (ModuleName, ProperName 'ClassName) ([Text], [SourceConstraint], [FunctionalDependency])
-- ^ A list of superclass constraints for each type class. Since type classes
-- have not been desugared here, we need to track this.
, ndiDerivedInstances :: S.Set ((ModuleName, ProperName 'ClassName), (ModuleName, ProperName 'TypeName))
@@ -57,11 +57,11 @@ instance Monoid NewtypeDerivedInstances where
-- (no flexible instances allowed), we don't need to bother with unification when
-- looking for matching superclass instances, which saves us a lot of work. Instead,
-- we just match the newtype name.
-extractNewtypeName :: ModuleName -> [Type] -> Maybe (ModuleName, ProperName 'TypeName)
+extractNewtypeName :: ModuleName -> [SourceType] -> Maybe (ModuleName, ProperName 'TypeName)
extractNewtypeName _ [] = Nothing
extractNewtypeName mn xs = go (last xs) where
- go (TypeApp ty (TypeVar _)) = go ty
- go (TypeConstructor name) = Just (qualify mn name)
+ go (TypeApp _ ty (TypeVar _ _)) = go ty
+ go (TypeConstructor _ name) = Just (qualify mn name)
go _ = Nothing
-- | Elaborates deriving instance declarations by code generation.
@@ -178,11 +178,11 @@ deriveInstance mn syns ndis ds (TypeInstanceDeclaration sa@(ss, _) ch idx nm dep
_ -> throwError . errorMessage' ss $ InvalidNewtypeInstance className tys
deriveInstance _ _ _ _ e = return e
-unwrapTypeConstructor :: Type -> Maybe (Qualified (ProperName 'TypeName), [Type])
+unwrapTypeConstructor :: SourceType -> Maybe (Qualified (ProperName 'TypeName), [SourceType])
unwrapTypeConstructor = fmap (second reverse) . go
where
- go (TypeConstructor tyCon) = Just (tyCon, [])
- go (TypeApp ty arg) = do
+ go (TypeConstructor _ tyCon) = Just (tyCon, [])
+ go (TypeApp _ ty arg) = do
(tyCon, args) <- go ty
return (tyCon, arg : args)
go _ = Nothing
@@ -196,9 +196,9 @@ deriveNewtypeInstance
-> NewtypeDerivedInstances
-> Qualified (ProperName 'ClassName)
-> [Declaration]
- -> [Type]
+ -> [SourceType]
-> ProperName 'TypeName
- -> [Type]
+ -> [SourceType]
-> m Expr
deriveNewtypeInstance ss mn syns ndis className ds tys tyConNm dargs = do
verifySuperclasses
@@ -226,9 +226,9 @@ deriveNewtypeInstance ss mn syns ndis className ds tys tyConNm dargs = do
takeReverse :: Int -> [a] -> [a]
takeReverse n = take n . reverse
- stripRight :: [(Text, Maybe kind)] -> Type -> Maybe Type
+ stripRight :: [(Text, Maybe kind)] -> SourceType -> Maybe SourceType
stripRight [] ty = Just ty
- stripRight ((arg, _) : args) (TypeApp t (TypeVar arg'))
+ stripRight ((arg, _) : args) (TypeApp _ t (TypeVar _ arg'))
| arg == arg' = stripRight args t
stripRight _ _ = Nothing
@@ -246,8 +246,8 @@ deriveNewtypeInstance ss mn syns ndis className ds tys tyConNm dargs = do
-- Everything else raises a UnverifiableSuperclassInstance warning.
-- This covers pretty much all cases we're interested in, but later we might want to do
-- more work to extend this to other superclass relationships.
- let determined = map (TypeVar . (args !!)) . ordNub . concatMap fdDetermined . filter ((== [length args - 1]) . fdDeterminers) $ deps
- if last constraintArgs == TypeVar (last args) && all (`elem` determined) (init constraintArgs)
+ let determined = map (srcTypeVar . (args !!)) . ordNub . concatMap fdDetermined . filter ((== [length args - 1]) . fdDeterminers) $ deps
+ if eqType (last constraintArgs) (srcTypeVar (last args)) && all (`elem` determined) (init constraintArgs)
then do
-- Now make sure that a superclass instance was derived. Again, this is not a complete
-- check, since the superclass might have multiple type arguments, so overlaps might still
@@ -283,14 +283,14 @@ deriveGenericRep
-> SynonymMap
-> [Declaration]
-> ProperName 'TypeName
- -> [Type]
- -> Type
- -> m ([Declaration], Type)
+ -> [SourceType]
+ -> SourceType
+ -> m ([Declaration], SourceType)
deriveGenericRep ss mn syns ds tyConNm tyConArgs repTy = do
checkIsWildcard ss tyConNm repTy
go =<< findTypeDecl ss tyConNm ds
where
- go :: Declaration -> m ([Declaration], Type)
+ go :: Declaration -> m ([Declaration], SourceType)
go (DataDeclaration (ss', _) _ _ args dctors) = do
x <- freshIdent "x"
(reps, to, from) <- unzip3 <$> traverse makeInst dctors
@@ -337,13 +337,13 @@ deriveGenericRep ss mn syns ds tyConNm tyConArgs repTy = do
compN n f = f . compN (n - 1) f
makeInst
- :: (ProperName 'ConstructorName, [Type])
- -> m (Type, CaseAlternative, CaseAlternative)
+ :: (ProperName 'ConstructorName, [SourceType])
+ -> m (SourceType, CaseAlternative, CaseAlternative)
makeInst (ctorName, args) = do
args' <- mapM (replaceAllTypeSynonymsM syns) args
(ctorTy, matchProduct, ctorArgs, matchCtor, mkProduct) <- makeProduct args'
- return ( TypeApp (TypeApp (TypeConstructor constructor)
- (TypeLevelString $ mkString (runProperName ctorName)))
+ return ( srcTypeApp (srcTypeApp (srcTypeConstructor constructor)
+ (srcTypeLevelString $ mkString (runProperName ctorName)))
ctorTy
, CaseAlternative [ ConstructorBinder ss constructor [matchProduct] ]
(unguarded (foldl' App (Constructor ss (Qualified (Just mn) ctorName)) ctorArgs))
@@ -352,23 +352,23 @@ deriveGenericRep ss mn syns ds tyConNm tyConArgs repTy = do
)
makeProduct
- :: [Type]
- -> m (Type, Binder, [Expr], [Binder], Expr)
+ :: [SourceType]
+ -> m (SourceType, Binder, [Expr], [Binder], Expr)
makeProduct [] =
pure (noArgs, NullBinder, [], [], noArgs')
makeProduct args = do
(tys, bs1, es1, bs2, es2) <- unzip5 <$> traverse makeArg args
- pure ( foldr1 (\f -> TypeApp (TypeApp (TypeConstructor productName) f)) tys
+ pure ( foldr1 (\f -> srcTypeApp (srcTypeApp (srcTypeConstructor productName) f)) tys
, foldr1 (\b1 b2 -> ConstructorBinder ss productName [b1, b2]) bs1
, es1
, bs2
, foldr1 (\e1 -> App (App (Constructor ss productName) e1)) es2
)
- makeArg :: Type -> m (Type, Binder, Expr, Binder, Expr)
+ makeArg :: SourceType -> m (SourceType, Binder, Expr, Binder, Expr)
makeArg arg = do
argName <- freshIdent "arg"
- pure ( TypeApp (TypeConstructor argument) arg
+ pure ( srcTypeApp (srcTypeConstructor argument) arg
, ConstructorBinder ss argument [ VarBinder ss argName ]
, Var ss (Qualified Nothing argName)
, VarBinder ss argName
@@ -382,10 +382,10 @@ deriveGenericRep ss mn syns ds tyConNm tyConArgs repTy = do
underExpr f (CaseAlternative b [MkUnguarded e]) = CaseAlternative b (unguarded (f e))
underExpr _ _ = internalError "underExpr: expected unguarded alternative"
- toRepTy :: [Type] -> Type
+ toRepTy :: [SourceType] -> SourceType
toRepTy [] = noCtors
toRepTy [only] = only
- toRepTy ctors = foldr1 (\f -> TypeApp (TypeApp sumCtor f)) ctors
+ toRepTy ctors = foldr1 (\f -> srcTypeApp (srcTypeApp sumCtor f)) ctors
toName :: Expr
toName = Var ss (Qualified (Just dataGenericRep) (Ident "to"))
@@ -393,17 +393,17 @@ deriveGenericRep ss mn syns ds tyConNm tyConArgs repTy = do
fromName :: Expr
fromName = Var ss (Qualified (Just dataGenericRep) (Ident "from"))
- noCtors :: Type
- noCtors = TypeConstructor (Qualified (Just dataGenericRep) (ProperName "NoConstructors"))
+ noCtors :: SourceType
+ noCtors = srcTypeConstructor (Qualified (Just dataGenericRep) (ProperName "NoConstructors"))
- noArgs :: Type
- noArgs = TypeConstructor (Qualified (Just dataGenericRep) (ProperName "NoArguments"))
+ noArgs :: SourceType
+ noArgs = srcTypeConstructor (Qualified (Just dataGenericRep) (ProperName "NoArguments"))
noArgs' :: Expr
noArgs' = Constructor ss (Qualified (Just dataGenericRep) (ProperName "NoArguments"))
- sumCtor :: Type
- sumCtor = TypeConstructor (Qualified (Just dataGenericRep) (ProperName "Sum"))
+ sumCtor :: SourceType
+ sumCtor = srcTypeConstructor (Qualified (Just dataGenericRep) (ProperName "Sum"))
inl :: Qualified (ProperName 'ConstructorName)
inl = Qualified (Just dataGenericRep) (ProperName "Inl")
@@ -426,8 +426,8 @@ deriveGenericRep ss mn syns ds tyConNm tyConArgs repTy = do
argument' :: Expr -> Expr
argument' = App (Constructor ss argument)
-checkIsWildcard :: MonadError MultipleErrors m => SourceSpan -> ProperName 'TypeName -> Type -> m ()
-checkIsWildcard _ _ (TypeWildcard _) = return ()
+checkIsWildcard :: MonadError MultipleErrors m => SourceSpan -> ProperName 'TypeName -> SourceType -> m ()
+checkIsWildcard _ _ (TypeWildcard _ Nothing) = return ()
checkIsWildcard ss tyConNm _ =
throwError . errorMessage' ss $ ExpectedWildcard tyConNm
@@ -468,7 +468,7 @@ deriveEq ss mn syns ds tyConNm = do
where
catchAll = CaseAlternative [NullBinder, NullBinder] (unguarded (Literal ss (BooleanLiteral False)))
- mkCtorClause :: (ProperName 'ConstructorName, [Type]) -> m CaseAlternative
+ mkCtorClause :: (ProperName 'ConstructorName, [SourceType]) -> m CaseAlternative
mkCtorClause (ctorName, tys) = do
identsL <- replicateM (length tys) (freshIdent "l")
identsR <- replicateM (length tys) (freshIdent "r")
@@ -482,7 +482,7 @@ deriveEq ss mn syns ds tyConNm = do
conjAll [] = Literal ss (BooleanLiteral True)
conjAll xs = foldl1 preludeConj xs
- toEqTest :: Expr -> Expr -> Type -> Expr
+ toEqTest :: Expr -> Expr -> SourceType -> Expr
toEqTest l r ty
| Just rec <- objectType ty
, Just fields <- decomposeRec rec =
@@ -547,7 +547,7 @@ deriveOrd ss mn syns ds tyConNm = do
ordCompare1 :: Expr -> Expr -> Expr
ordCompare1 = App . App (Var ss (Qualified (Just dataOrd) (Ident C.compare1)))
- mkCtorClauses :: ((ProperName 'ConstructorName, [Type]), Bool) -> m [CaseAlternative]
+ mkCtorClauses :: ((ProperName 'ConstructorName, [SourceType]), Bool) -> m [CaseAlternative]
mkCtorClauses ((ctorName, tys), isLast) = do
identsL <- replicateM (length tys) (freshIdent "l")
identsR <- replicateM (length tys) (freshIdent "r")
@@ -583,7 +583,7 @@ deriveOrd ss mn syns ds tyConNm = do
(unguarded (appendAll xs))
]
- toOrdering :: Expr -> Expr -> Type -> Expr
+ toOrdering :: Expr -> Expr -> SourceType -> Expr
toOrdering l r ty
| Just rec <- objectType ty
, Just fields <- decomposeRec rec =
@@ -608,14 +608,14 @@ deriveNewtype
-> SynonymMap
-> [Declaration]
-> ProperName 'TypeName
- -> [Type]
- -> Type
- -> m ([Declaration], Type)
+ -> [SourceType]
+ -> SourceType
+ -> m ([Declaration], SourceType)
deriveNewtype ss mn syns ds tyConNm tyConArgs unwrappedTy = do
checkIsWildcard ss tyConNm unwrappedTy
go =<< findTypeDecl ss tyConNm ds
where
- go :: Declaration -> m ([Declaration], Type)
+ go :: Declaration -> m ([Declaration], SourceType)
go (DataDeclaration (ss', _) Data name _ _) =
throwError . errorMessage' ss' $ CannotDeriveNewtypeForData name
go (DataDeclaration (ss', _) Newtype name args dctors) = do
@@ -665,23 +665,23 @@ mkVarMn ss mn = Var ss . Qualified mn
mkVar :: SourceSpan -> Ident -> Expr
mkVar ss = mkVarMn ss Nothing
-isAppliedVar :: Type -> Bool
-isAppliedVar (TypeApp (TypeVar _) _) = True
+isAppliedVar :: Type a -> Bool
+isAppliedVar (TypeApp _ (TypeVar _ _) _) = True
isAppliedVar _ = False
-objectType :: Type -> Maybe Type
-objectType (TypeApp (TypeConstructor C.Record) rec) = Just rec
+objectType :: Type a -> Maybe (Type a)
+objectType (TypeApp _ (TypeConstructor _ C.Record) rec) = Just rec
objectType _ = Nothing
-decomposeRec :: Type -> Maybe [(Label, Type)]
+decomposeRec :: SourceType -> Maybe [(Label, SourceType)]
decomposeRec = fmap (sortBy (comparing fst)) . go
- where go (RCons str typ typs) = fmap ((str, typ) :) (go typs)
- go REmpty = Just []
+ where go (RCons _ str typ typs) = fmap ((str, typ) :) (go typs)
+ go (REmpty _) = Just []
go _ = Nothing
-decomposeRec' :: Type -> [(Label, Type)]
+decomposeRec' :: SourceType -> [(Label, SourceType)]
decomposeRec' = sortBy (comparing fst) . go
- where go (RCons str typ typs) = (str, typ) : go typs
+ where go (RCons _ str typ typs) = (str, typ) : go typs
go _ = []
deriveFunctor
@@ -700,14 +700,14 @@ deriveFunctor ss mn syns ds tyConNm = do
where
mkMapFunction :: Declaration -> m Expr
mkMapFunction (DataDeclaration (ss', _) _ _ tys ctors) = case reverse tys of
- [] -> throwError . errorMessage' ss' $ KindsDoNotUnify (FunKind kindType kindType) kindType
+ [] -> throwError . errorMessage' ss' $ KindsDoNotUnify (FunKind nullSourceAnn kindType kindType) kindType
((iTy, _) : _) -> do
f <- freshIdent "f"
m <- freshIdent "m"
lam ss' f . lamCase ss' m <$> mapM (mkCtorClause iTy f) ctors
mkMapFunction _ = internalError "mkMapFunction: expected DataDeclaration"
- mkCtorClause :: Text -> Ident -> (ProperName 'ConstructorName, [Type]) -> m CaseAlternative
+ mkCtorClause :: Text -> Ident -> (ProperName 'ConstructorName, [SourceType]) -> m CaseAlternative
mkCtorClause iTyName f (ctorName, ctorTys) = do
idents <- replicateM (length ctorTys) (freshIdent "v")
ctorTys' <- mapM (replaceAllTypeSynonymsM syns) ctorTys
@@ -721,12 +721,12 @@ deriveFunctor ss mn syns ds tyConNm = do
mapVar = mkVarMn ss (Just dataFunctor) (Ident C.map)
-- TODO: deal with type synonyms, ala https://github.com/purescript/purescript/pull/2516
- transformArg :: Ident -> Type -> m Expr
+ transformArg :: Ident -> SourceType -> m Expr
transformArg ident = fmap (foldr App (mkVar ss ident)) . goType where
- goType :: Type -> m (Maybe Expr)
+ goType :: SourceType -> m (Maybe Expr)
-- argument matches the index type
- goType (TypeVar t) | t == iTyName = return (Just fVar)
+ goType (TypeVar _ t) | t == iTyName = return (Just fVar)
-- records
goType recTy | Just row <- objectType recTy =
@@ -735,7 +735,7 @@ deriveFunctor ss mn syns ds tyConNm = do
justUpdates :: [Maybe (Label, Expr)] -> Maybe [(Label, Expr)]
justUpdates = foldMap (fmap return)
- buildUpdate :: (Label, Type) -> m (Maybe (Label, Expr))
+ buildUpdate :: (Label, SourceType) -> m (Maybe (Label, Expr))
buildUpdate (lbl, ty) = do upd <- goType ty
return ((lbl,) <$> upd)
@@ -747,13 +747,13 @@ deriveFunctor ss mn syns ds tyConNm = do
return (lam ss arg (ObjectUpdate argVar (mkAssignment <$> updates)))
-- quantifiers
- goType (ForAll scopedVar t _) | scopedVar /= iTyName = goType t
+ goType (ForAll _ scopedVar t _) | scopedVar /= iTyName = goType t
-- constraints
- goType (ConstrainedType _ t) = goType t
+ goType (ConstrainedType _ _ t) = goType t
-- under a `* -> *`, just assume functor for now
- goType (TypeApp _ t) = fmap (App mapVar) <$> goType t
+ goType (TypeApp _ _ t) = fmap (App mapVar) <$> goType t
-- otherwise do nothing - will fail type checking if type does actually contain index
goType _ = return Nothing
diff --git a/src/Language/PureScript/TypeChecker.hs b/src/Language/PureScript/TypeChecker.hs
index 3a490e3..58a05a4 100644
--- a/src/Language/PureScript/TypeChecker.hs
+++ b/src/Language/PureScript/TypeChecker.hs
@@ -16,10 +16,10 @@ import Control.Monad (when, unless, void, forM)
import Control.Monad.Error.Class (MonadError(..))
import Control.Monad.State.Class (MonadState(..), modify, gets)
import Control.Monad.Supply.Class (MonadSupply)
-import Control.Monad.Writer.Class (MonadWriter(..))
+import Control.Monad.Writer.Class (MonadWriter(..), censor)
import Data.Foldable (for_, traverse_, toList)
-import Data.List (nub, nubBy, (\\), sort, group)
+import Data.List (nub, nubBy, (\\), sort, group, intersect)
import Data.Maybe
import Data.Text (Text)
import qualified Data.List.NonEmpty as NEL
@@ -41,16 +41,16 @@ import Language.PureScript.TypeChecker.Types as T
import Language.PureScript.TypeClassDictionaries
import Language.PureScript.Types
-import Lens.Micro.Platform ((^..), _1, _2)
+import Lens.Micro.Platform ((^..), _2, _3)
addDataType
:: (MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m)
=> ModuleName
-> DataDeclType
-> ProperName 'TypeName
- -> [(Text, Maybe Kind)]
- -> [(ProperName 'ConstructorName, [Type])]
- -> Kind
+ -> [(Text, Maybe SourceKind)]
+ -> [(ProperName 'ConstructorName, [SourceType])]
+ -> SourceKind
-> m ()
addDataType moduleName dtype name args dctors ctorKind = do
env <- getEnv
@@ -66,14 +66,14 @@ addDataConstructor
-> ProperName 'TypeName
-> [Text]
-> ProperName 'ConstructorName
- -> [Type]
+ -> [SourceType]
-> m ()
addDataConstructor moduleName dtype name args dctor tys = do
env <- getEnv
traverse_ checkTypeSynonyms tys
- let retTy = foldl TypeApp (TypeConstructor (Qualified (Just moduleName) name)) (map TypeVar args)
+ let retTy = foldl srcTypeApp (srcTypeConstructor (Qualified (Just moduleName) name)) (map srcTypeVar args)
let dctorTy = foldr function retTy tys
- let polyType = mkForAll args dctorTy
+ let polyType = mkForAll (map (NullSourceAnn,) args) dctorTy
let fields = [Ident ("value" <> T.pack (show n)) | n <- [0..(length tys - 1)]]
putEnv $ env { dataConstructors = M.insert (Qualified (Just moduleName) dctor) (dtype, name, polyType, fields) (dataConstructors env) }
@@ -81,9 +81,9 @@ addTypeSynonym
:: (MonadState CheckState m, MonadError MultipleErrors m)
=> ModuleName
-> ProperName 'TypeName
- -> [(Text, Maybe Kind)]
- -> Type
- -> Kind
+ -> [(Text, Maybe SourceKind)]
+ -> SourceType
+ -> SourceKind
-> m ()
addTypeSynonym moduleName name args ty kind = do
env <- getEnv
@@ -106,7 +106,7 @@ addValue
:: (MonadState CheckState m)
=> ModuleName
-> Ident
- -> Type
+ -> SourceType
-> NameKind
-> m ()
addValue moduleName name ty nameKind = do
@@ -117,8 +117,8 @@ addTypeClass
:: forall m
. (MonadState CheckState m, MonadError MultipleErrors m)
=> Qualified (ProperName 'ClassName)
- -> [(Text, Maybe Kind)]
- -> [Constraint]
+ -> [(Text, Maybe SourceKind)]
+ -> [SourceConstraint]
-> [FunctionalDependency]
-> [Declaration]
-> m ()
@@ -127,7 +127,7 @@ addTypeClass qualifiedClassName args implies dependencies ds = do
traverse_ (checkMemberIsUsable (typeSynonyms env)) classMembers
modify $ \st -> st { checkEnv = (checkEnv st) { typeClasses = M.insert qualifiedClassName newClass (typeClasses . checkEnv $ st) } }
where
- classMembers :: [(Ident, Type)]
+ classMembers :: [(Ident, SourceType)]
classMembers = map toPair ds
newClass :: TypeClassData
@@ -145,7 +145,7 @@ addTypeClass qualifiedClassName args implies dependencies ds = do
-- Currently we are only checking usability based on the type class currently
-- being defined. If the mentioned arguments don't include a covering set,
-- then we won't be able to find a instance.
- checkMemberIsUsable :: T.SynonymMap -> (Ident, Type) -> m ()
+ checkMemberIsUsable :: T.SynonymMap -> (Ident, SourceType) -> m ()
checkMemberIsUsable syns (ident, memberTy) = do
memberTy' <- T.replaceAllTypeSynonymsM syns memberTy
let mentionedArgIndexes = S.fromList (mapMaybe argToIndex (freeTypeVariables memberTy'))
@@ -160,11 +160,11 @@ addTypeClass qualifiedClassName args implies dependencies ds = do
addTypeClassDictionaries
:: (MonadState CheckState m)
=> Maybe ModuleName
- -> M.Map (Qualified (ProperName 'ClassName)) (M.Map (Qualified Ident) NamedDict)
+ -> M.Map (Qualified (ProperName 'ClassName)) (M.Map (Qualified Ident) (NEL.NonEmpty NamedDict))
-> m ()
addTypeClassDictionaries mn entries =
modify $ \st -> st { checkEnv = (checkEnv st) { typeClassDictionaries = insertState st } }
- where insertState st = M.insertWith (M.unionWith M.union) mn entries (typeClassDictionaries . checkEnv $ st)
+ where insertState st = M.insertWith (M.unionWith (M.unionWith (<>))) mn entries (typeClassDictionaries . checkEnv $ st)
checkDuplicateTypeArguments
:: (MonadState CheckState m, MonadError MultipleErrors m)
@@ -180,7 +180,7 @@ checkTypeClassInstance
:: (MonadState CheckState m, MonadError MultipleErrors m)
=> TypeClassData
-> Int -- ^ index of type class argument
- -> Type
+ -> SourceType
-> m ()
checkTypeClassInstance cls i = check where
-- If the argument is determined via fundeps then we are less restrictive in
@@ -189,15 +189,15 @@ checkTypeClassInstance cls i = check where
-- row types are allowed in determined type class arguments.
isFunDepDetermined = S.member i (typeClassDeterminedArguments cls)
check = \case
- TypeVar _ -> return ()
- TypeLevelString _ -> return ()
- TypeConstructor ctor -> do
+ TypeVar _ _ -> return ()
+ TypeLevelString _ _ -> return ()
+ TypeConstructor _ ctor -> do
env <- getEnv
when (ctor `M.member` typeSynonyms env) . throwError . errorMessage $ TypeSynonymInstance
return ()
- TypeApp t1 t2 -> check t1 >> check t2
- REmpty | isFunDepDetermined -> return ()
- RCons _ hd tl | isFunDepDetermined -> check hd >> check tl
+ TypeApp _ t1 t2 -> check t1 >> check t2
+ REmpty _ | isFunDepDetermined -> return ()
+ RCons _ _ hd tl | isFunDepDetermined -> check hd >> check tl
ty -> throwError . errorMessage $ InvalidInstanceHead ty
-- |
@@ -205,7 +205,7 @@ checkTypeClassInstance cls i = check where
--
checkTypeSynonyms
:: (MonadState CheckState m, MonadError MultipleErrors m)
- => Type
+ => SourceType
-> m ()
checkTypeSynonyms = void . replaceAllTypeSynonyms
@@ -244,24 +244,24 @@ typeCheckAll moduleName _ = traverse go
let tysList = NEL.toList tys
syns = mapMaybe toTypeSynonym tysList
dataDecls = mapMaybe toDataDecl tysList
- bindingGroupNames = ordNub ((syns^..traverse._1) ++ (dataDecls^..traverse._2))
+ bindingGroupNames = ordNub ((syns^..traverse._2) ++ (dataDecls^..traverse._3))
sss = fmap declSourceSpan tys
warnAndRethrow (addHint (ErrorInDataBindingGroup bindingGroupNames) . addHint (PositionedError sss)) $ do
- (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
+ (syn_ks, data_ks) <- kindsOfAll moduleName syns (map (\(sa, _, name, args, dctors) -> (sa, 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
- for_ (zip syns syn_ks) $ \((name, args, ty), kind) -> do
+ for_ (zip syns syn_ks) $ \((_, name, args, ty), kind) -> do
checkDuplicateTypeArguments $ map fst args
let args' = args `withKinds` kind
addTypeSynonym moduleName name args' ty kind
return d
where
- toTypeSynonym (TypeSynonymDeclaration _ nm args ty) = Just (nm, args, ty)
+ toTypeSynonym (TypeSynonymDeclaration sa nm args ty) = Just (sa, nm, args, ty)
toTypeSynonym _ = Nothing
- toDataDecl (DataDeclaration _ dtype nm args dctors) = Just (dtype, nm, args, dctors)
+ toDataDecl (DataDeclaration sa dtype nm args dctors) = Just (sa, dtype, nm, args, dctors)
toDataDecl _ = Nothing
go (TypeSynonymDeclaration sa@(ss, _) name args ty) = do
warnAndRethrow (addHint (ErrorInTypeSynonym name) . addHint (positionedError ss) ) $ do
@@ -274,12 +274,13 @@ typeCheckAll moduleName _ = traverse go
internalError "Type declarations should have been removed before typeCheckAlld"
go (ValueDecl sa@(ss, _) name nameKind [] [MkUnguarded val]) = do
env <- getEnv
- warnAndRethrow (addHint (ErrorInValueDeclaration name) . addHint (positionedError ss)) $ do
+ warnAndRethrow (addHint (ErrorInValueDeclaration name) . addHint (positionedError ss)) . censorLocalUnnamedWildcards val $ do
val' <- checkExhaustiveExpr ss env moduleName val
valueIsNotDefined moduleName name
[(_, (val'', ty))] <- typesOf NonRecursiveBindingGroup moduleName [((sa, name), val')]
addValue moduleName name ty nameKind
return $ ValueDecl sa name nameKind [] [MkUnguarded val'']
+ where
go ValueDeclaration{} = internalError "Binders were not desugared"
go BoundValueDeclaration{} = internalError "BoundValueDeclaration should be desugared"
go (BindingGroupDeclaration vals) = do
@@ -343,10 +344,10 @@ typeCheckAll moduleName _ = traverse go
_ <- traverseTypeInstanceBody checkInstanceMembers body
deps' <- (traverse . overConstraintArgs . traverse) replaceAllTypeSynonyms deps
let dict = TypeClassDictionaryInScope qualifiedChain idx qualifiedDictName [] className tys (Just deps')
- addTypeClassDictionaries (Just moduleName) . M.singleton className $ M.singleton (tcdValue dict) dict
+ addTypeClassDictionaries (Just moduleName) . M.singleton className $ M.singleton (tcdValue dict) (pure dict)
return d
- checkInstanceArity :: Ident -> Qualified (ProperName 'ClassName) -> TypeClassData -> [Type] -> m ()
+ checkInstanceArity :: Ident -> Qualified (ProperName 'ClassName) -> TypeClassData -> [SourceType] -> m ()
checkInstanceArity dictName className typeClass tys = do
let typeClassArity = length (typeClassArguments typeClass)
instanceArity = length tys
@@ -373,19 +374,19 @@ typeCheckAll moduleName _ = traverse go
findNonOrphanModules
:: Qualified (ProperName 'ClassName)
-> TypeClassData
- -> [Type]
+ -> [SourceType]
-> S.Set ModuleName
findNonOrphanModules (Qualified (Just mn') _) typeClass tys' = nonOrphanModules
where
nonOrphanModules :: S.Set ModuleName
nonOrphanModules = S.insert mn' nonOrphanModules'
- typeModule :: Type -> Maybe ModuleName
- typeModule (TypeVar _) = Nothing
- typeModule (TypeLevelString _) = Nothing
- typeModule (TypeConstructor (Qualified (Just mn'') _)) = Just mn''
- typeModule (TypeConstructor (Qualified Nothing _)) = internalError "Unqualified type name in findNonOrphanModules"
- typeModule (TypeApp t1 _) = typeModule t1
+ typeModule :: SourceType -> Maybe ModuleName
+ typeModule (TypeVar _ _) = Nothing
+ typeModule (TypeLevelString _ _) = Nothing
+ typeModule (TypeConstructor _ (Qualified (Just mn'') _)) = Just mn''
+ typeModule (TypeConstructor _ (Qualified Nothing _)) = internalError "Unqualified type name in findNonOrphanModules"
+ typeModule (TypeApp _ t1 _) = typeModule t1
typeModule _ = internalError "Invalid type in instance in findNonOrphanModules"
modulesByTypeIndex :: M.Map Int (Maybe ModuleName)
@@ -415,27 +416,28 @@ typeCheckAll moduleName _ = traverse go
-> Ident
-> Qualified (ProperName 'ClassName)
-> TypeClassData
- -> [Type]
+ -> [SourceType]
-> S.Set ModuleName
-> m ()
checkOverlappingInstance ch dictName className typeClass tys' nonOrphanModules = do
for_ nonOrphanModules $ \m -> do
dicts <- M.toList <$> lookupTypeClassDictionariesForClass (Just m) className
- for_ dicts $ \(ident, dict) -> do
- -- ignore instances in the same instance chain
- if ch == tcdChain dict ||
- instancesAreApart (typeClassCoveringSets typeClass) tys' (tcdInstanceTypes dict)
- then return ()
- else throwError . errorMessage $
- OverlappingInstances className
- tys'
- [ident, Qualified (Just moduleName) dictName]
+ for_ dicts $ \(ident, dictNel) -> do
+ for_ dictNel $ \dict -> do
+ -- ignore instances in the same instance chain
+ if ch == tcdChain dict ||
+ instancesAreApart (typeClassCoveringSets typeClass) tys' (tcdInstanceTypes dict)
+ then return ()
+ else throwError . errorMessage $
+ OverlappingInstances className
+ tys'
+ [ident, Qualified (Just moduleName) dictName]
instancesAreApart
:: S.Set (S.Set Int)
- -> [Type]
- -> [Type]
+ -> [SourceType]
+ -> [SourceType]
-> Bool
instancesAreApart sets lhs rhs = all (any typesApart . S.toList) (S.toList sets)
where
@@ -444,40 +446,55 @@ typeCheckAll moduleName _ = traverse go
-- Note: implementation doesn't need to care about all possible cases:
-- TUnknown, Skolem, etc.
- typeHeadsApart :: Type -> Type -> Bool
- typeHeadsApart l r | l == r = False
- typeHeadsApart (TypeVar _) _ = False
- typeHeadsApart _ (TypeVar _) = False
- typeHeadsApart (KindedType t1 _) t2 = typeHeadsApart t1 t2
- typeHeadsApart t1 (KindedType t2 _) = typeHeadsApart t1 t2
- typeHeadsApart (TypeApp h1 t1) (TypeApp h2 t2) = typeHeadsApart h1 h2 || typeHeadsApart t1 t2
- typeHeadsApart _ _ = True
+ typeHeadsApart :: SourceType -> SourceType -> Bool
+ typeHeadsApart l r | eqType l r = False
+ typeHeadsApart (TypeVar _ _) _ = False
+ typeHeadsApart _ (TypeVar _ _) = False
+ typeHeadsApart (KindedType _ t1 _) t2 = typeHeadsApart t1 t2
+ typeHeadsApart t1 (KindedType _ t2 _) = typeHeadsApart t1 t2
+ typeHeadsApart (TypeApp _ h1 t1) (TypeApp _ h2 t2) = typeHeadsApart h1 h2 || typeHeadsApart t1 t2
+ typeHeadsApart _ _ = True
checkOrphanInstance
:: Ident
-> Qualified (ProperName 'ClassName)
- -> [Type]
+ -> [SourceType]
-> S.Set ModuleName
-> m ()
checkOrphanInstance dictName className tys' nonOrphanModules
| moduleName `S.member` nonOrphanModules = return ()
| otherwise = throwError . errorMessage $ OrphanInstance dictName className nonOrphanModules tys'
+ censorLocalUnnamedWildcards :: Expr -> m a -> m a
+ censorLocalUnnamedWildcards (TypedValue _ _ ty) = censor (filterErrors (not . isLocalUnnamedWildcardError ty))
+ censorLocalUnnamedWildcards _ = id
+
+ isLocalUnnamedWildcardError :: SourceType -> ErrorMessage -> Bool
+ isLocalUnnamedWildcardError ty err@(ErrorMessage _ (WildcardInferredType _ _)) =
+ let
+ ssWildcard (TypeWildcard (ss', _) Nothing) = [ss']
+ ssWildcard _ = []
+ sssWildcards = everythingOnTypes (<>) ssWildcard ty
+ sss = maybe [] NEL.toList $ errorSpan err
+ in
+ null $ intersect sss sssWildcards
+ isLocalUnnamedWildcardError _ _ = False
+
-- |
-- 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.
--
- withKinds :: [(Text, Maybe Kind)] -> Kind -> [(Text, Maybe Kind)]
+ withKinds :: [(Text, Maybe SourceKind)] -> SourceKind -> [(Text, Maybe SourceKind)]
withKinds [] _ = []
- withKinds (s@(_, Just _ ):ss) (FunKind _ k) = s : withKinds ss k
- withKinds ( (s, Nothing):ss) (FunKind k1 k2) = (s, Just k1) : withKinds ss k2
- withKinds _ _ = internalError "Invalid arguments to peelKinds"
+ withKinds (s@(_, Just _ ):ss) (FunKind _ _ k) = s : withKinds ss k
+ withKinds ( (s, Nothing):ss) (FunKind _ k1 k2) = (s, Just k1) : withKinds ss k2
+ withKinds _ _ = internalError "Invalid arguments to peelKinds"
checkNewtype
:: forall m
. MonadError MultipleErrors m
=> ProperName 'TypeName
- -> [(ProperName 'ConstructorName, [Type])]
+ -> [(ProperName 'ConstructorName, [SourceType])]
-> m ()
checkNewtype _ [(_, [_])] = return ()
checkNewtype name _ = throwError . errorMessage $ InvalidNewtype name
@@ -543,12 +560,12 @@ typeCheckModule (Module ss coms mn decls (Just exps)) =
untilSame :: Eq a => (a -> a) -> a -> a
untilSame f a = let a' = f a in if a == a' then a else untilSame f a'
- checkMemberExport :: (Type -> [DeclarationRef]) -> DeclarationRef -> m ()
+ checkMemberExport :: (SourceType -> [DeclarationRef]) -> DeclarationRef -> m ()
checkMemberExport extract dr@(TypeRef _ name dctors) = do
env <- getEnv
for_ (M.lookup (qualify' name) (types env)) $ \(k, _) -> do
let findModuleKinds = everythingOnKinds (++) $ \case
- NamedKind (Qualified (Just mn') kindName) | mn' == mn -> [kindName]
+ NamedKind _ (Qualified (Just mn') kindName) | mn' == mn -> [kindName]
_ -> []
checkExport dr $ KindRef (declRefSourceSpan dr) <$> findModuleKinds k
for_ (M.lookup (qualify' name) (typeSynonyms env)) $ \(_, ty) ->
@@ -605,10 +622,10 @@ typeCheckModule (Module ss coms mn decls (Just exps)) =
checkTypesAreExported :: DeclarationRef -> m ()
checkTypesAreExported ref = checkMemberExport findTcons ref
where
- findTcons :: Type -> [DeclarationRef]
+ findTcons :: SourceType -> [DeclarationRef]
findTcons = everythingOnTypes (++) go
where
- go (TypeConstructor (Qualified (Just mn') name)) | mn' == mn =
+ go (TypeConstructor _ (Qualified (Just mn') name)) | mn' == mn =
[TypeRef (declRefSourceSpan ref) name (internalError "Data constructors unused in checkTypesAreExported")]
go _ = []
@@ -617,10 +634,10 @@ typeCheckModule (Module ss coms mn decls (Just exps)) =
checkClassesAreExported :: DeclarationRef -> m ()
checkClassesAreExported ref = checkMemberExport findClasses ref
where
- findClasses :: Type -> [DeclarationRef]
+ findClasses :: SourceType -> [DeclarationRef]
findClasses = everythingOnTypes (++) go
where
- go (ConstrainedType c _) = (fmap (TypeClassRef (declRefSourceSpan ref)) . extractCurrentModuleClass . constraintClass) c
+ go (ConstrainedType _ c _) = (fmap (TypeClassRef (declRefSourceSpan ref)) . extractCurrentModuleClass . constraintClass) c
go _ = []
extractCurrentModuleClass :: Qualified (ProperName 'ClassName) -> [ProperName 'ClassName]
extractCurrentModuleClass (Qualified (Just mn') name) | mn == mn' = [name]
diff --git a/src/Language/PureScript/TypeChecker/Entailment.hs b/src/Language/PureScript/TypeChecker/Entailment.hs
index 13f8697..23f62f9 100644
--- a/src/Language/PureScript/TypeChecker/Entailment.hs
+++ b/src/Language/PureScript/TypeChecker/Entailment.hs
@@ -30,6 +30,7 @@ import qualified Data.Set as S
import Data.Traversable (for)
import Data.Text (Text, stripPrefix, stripSuffix)
import qualified Data.Text as T
+import qualified Data.List.NonEmpty as NEL
import Language.PureScript.AST
import Language.PureScript.Crash
@@ -50,7 +51,7 @@ data Evidence
= NamedInstance (Qualified Ident)
-- | Computed instances
- | WarnInstance Type -- ^ Warn type class with a user-defined warning message
+ | WarnInstance SourceType -- ^ Warn type class with a user-defined warning message
| IsSymbolInstance PSString -- ^ The IsSymbol type class for a given Symbol literal
| EmptyClassInstance -- ^ For any solved type class with no members
deriving (Show, Eq)
@@ -66,7 +67,7 @@ type TypeClassDict = TypeClassDictionaryInScope Evidence
-- | The 'InstanceContext' tracks those constraints which can be satisfied.
type InstanceContext = M.Map (Maybe ModuleName)
(M.Map (Qualified (ProperName 'ClassName))
- (M.Map (Qualified Ident) NamedDict))
+ (M.Map (Qualified Ident) (NEL.NonEmpty NamedDict)))
-- | A type substitution which makes an instance head match a list of types.
--
@@ -75,7 +76,7 @@ type InstanceContext = M.Map (Maybe ModuleName)
type Matching a = M.Map Text a
combineContexts :: InstanceContext -> InstanceContext -> InstanceContext
-combineContexts = M.unionWith (M.unionWith M.union)
+combineContexts = M.unionWith (M.unionWith (M.unionWith (<>)))
-- | Replace type class dictionary placeholders with inferred type class dictionaries
replaceTypeClassDictionaries
@@ -83,7 +84,7 @@ replaceTypeClassDictionaries
. (MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m, MonadSupply m)
=> Bool
-> Expr
- -> m (Expr, [(Ident, InstanceContext, Constraint)])
+ -> m (Expr, [(Ident, InstanceContext, SourceConstraint)])
replaceTypeClassDictionaries shouldGeneralize expr = flip evalStateT M.empty $ do
-- Loop, deferring any unsolved constraints, until there are no more
-- constraints which can be solved, then make a generalization pass.
@@ -97,16 +98,16 @@ replaceTypeClassDictionaries shouldGeneralize expr = flip evalStateT M.empty $ d
-- This pass solves constraints where possible, deferring constraints if not.
deferPass :: Expr -> StateT InstanceContext m (Expr, Any)
deferPass = fmap (second fst) . runWriterT . f where
- f :: Expr -> WriterT (Any, [(Ident, InstanceContext, Constraint)]) (StateT InstanceContext m) Expr
+ f :: Expr -> WriterT (Any, [(Ident, InstanceContext, SourceConstraint)]) (StateT InstanceContext m) Expr
(_, f, _) = everywhereOnValuesTopDownM return (go True) return
-- This pass generalizes any remaining constraints
- generalizePass :: Expr -> StateT InstanceContext m (Expr, [(Ident, InstanceContext, Constraint)])
+ generalizePass :: Expr -> StateT InstanceContext m (Expr, [(Ident, InstanceContext, SourceConstraint)])
generalizePass = fmap (second snd) . runWriterT . f where
- f :: Expr -> WriterT (Any, [(Ident, InstanceContext, Constraint)]) (StateT InstanceContext m) Expr
+ f :: Expr -> WriterT (Any, [(Ident, InstanceContext, SourceConstraint)]) (StateT InstanceContext m) Expr
(_, f, _) = everywhereOnValuesTopDownM return (go False) return
- go :: Bool -> Expr -> WriterT (Any, [(Ident, InstanceContext, Constraint)]) (StateT InstanceContext m) Expr
+ go :: Bool -> Expr -> WriterT (Any, [(Ident, InstanceContext, SourceConstraint)]) (StateT InstanceContext m) Expr
go deferErrors (TypeClassDictionary constraint context hints) =
rethrow (addHints hints) $ entails (SolverOptions shouldGeneralize deferErrors) constraint context hints
go _ other = return other
@@ -115,7 +116,7 @@ replaceTypeClassDictionaries shouldGeneralize expr = flip evalStateT M.empty $ d
data EntailsResult a
= Solved a TypeClassDict
-- ^ We solved this constraint
- | Unsolved Constraint
+ | Unsolved SourceConstraint
-- ^ We couldn't solve this constraint right now, it will be generalized
| Deferred
-- ^ We couldn't solve this constraint right now, so it has been deferred
@@ -151,17 +152,17 @@ entails
. (MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m, MonadSupply m)
=> SolverOptions
-- ^ Solver options
- -> Constraint
+ -> SourceConstraint
-- ^ The constraint to solve
-> InstanceContext
-- ^ The contexts in which to solve the constraint
-> [ErrorMessageHint]
-- ^ Error message hints to apply to any instance errors
- -> WriterT (Any, [(Ident, InstanceContext, Constraint)]) (StateT InstanceContext m) Expr
+ -> WriterT (Any, [(Ident, InstanceContext, SourceConstraint)]) (StateT InstanceContext m) Expr
entails SolverOptions{..} constraint context hints =
solve constraint
where
- forClassName :: InstanceContext -> Qualified (ProperName 'ClassName) -> [Type] -> [TypeClassDict]
+ forClassName :: InstanceContext -> Qualified (ProperName 'ClassName) -> [SourceType] -> [TypeClassDict]
forClassName ctx cn@C.Warn [msg] =
-- Prefer a warning dictionary in scope if there is one available.
-- This allows us to defer a warning by propagating the constraint.
@@ -178,25 +179,25 @@ entails SolverOptions{..} constraint context hints =
forClassName ctx cn@(Qualified (Just mn) _) tys = concatMap (findDicts ctx cn) (ordNub (Nothing : Just mn : map Just (mapMaybe ctorModules tys)))
forClassName _ _ _ = internalError "forClassName: expected qualified class name"
- ctorModules :: Type -> Maybe ModuleName
- ctorModules (TypeConstructor (Qualified (Just mn) _)) = Just mn
- ctorModules (TypeConstructor (Qualified Nothing _)) = internalError "ctorModules: unqualified type name"
- ctorModules (TypeApp ty _) = ctorModules ty
- ctorModules (KindedType ty _) = ctorModules ty
+ ctorModules :: SourceType -> Maybe ModuleName
+ ctorModules (TypeConstructor _ (Qualified (Just mn) _)) = Just mn
+ ctorModules (TypeConstructor _ (Qualified Nothing _)) = internalError "ctorModules: unqualified type name"
+ ctorModules (TypeApp _ ty _) = ctorModules ty
+ ctorModules (KindedType _ ty _) = ctorModules ty
ctorModules _ = Nothing
findDicts :: InstanceContext -> Qualified (ProperName 'ClassName) -> Maybe ModuleName -> [TypeClassDict]
- findDicts ctx cn = fmap (fmap NamedInstance) . maybe [] M.elems . (>>= M.lookup cn) . flip M.lookup ctx
+ findDicts ctx cn = fmap (fmap NamedInstance) . foldMap NEL.toList . foldMap M.elems . (>>= M.lookup cn) . flip M.lookup ctx
valUndefined :: Expr
valUndefined = Var nullSourceSpan (Qualified (Just (ModuleName [ProperName C.prim])) (Ident C.undefined))
- solve :: Constraint -> WriterT (Any, [(Ident, InstanceContext, Constraint)]) (StateT InstanceContext m) Expr
+ solve :: SourceConstraint -> WriterT (Any, [(Ident, InstanceContext, SourceConstraint)]) (StateT InstanceContext m) Expr
solve con = go 0 con
where
- go :: Int -> Constraint -> WriterT (Any, [(Ident, InstanceContext, Constraint)]) (StateT InstanceContext m) Expr
- go work (Constraint className' tys' _) | work > 1000 = throwError . errorMessage $ PossiblyInfiniteInstance className' tys'
- go work con'@(Constraint className' tys' conInfo) = WriterT . StateT . (withErrorMessageHint (ErrorSolvingConstraint con') .) . runStateT . runWriterT $ do
+ go :: Int -> SourceConstraint -> WriterT (Any, [(Ident, InstanceContext, SourceConstraint)]) (StateT InstanceContext m) Expr
+ go work (Constraint _ className' tys' _) | work > 1000 = throwError . errorMessage $ PossiblyInfiniteInstance className' tys'
+ go work con'@(Constraint _ className' tys' conInfo) = WriterT . StateT . (withErrorMessageHint (ErrorSolvingConstraint con') .) . runStateT . runWriterT $ do
-- We might have unified types by solving other constraints, so we need to
-- apply the latest substitution.
latestSubst <- lift . lift $ gets checkSubstitution
@@ -264,7 +265,7 @@ entails SolverOptions{..} constraint context hints =
Deferred ->
-- Constraint was deferred, just return the dictionary unchanged,
-- with no unsolved constraints. Hopefully, we can solve this later.
- return (TypeClassDictionary (Constraint className' tys'' conInfo) context hints)
+ return (TypeClassDictionary (srcConstraint className' tys'' conInfo) context hints)
where
-- | When checking functional dependencies, we need to use unification to make
-- sure it is safe to use the selected instance. We will unify the solved type with
@@ -279,8 +280,8 @@ entails SolverOptions{..} constraint context hints =
-- as necessary, based on the types in the instance head.
withFreshTypes
:: TypeClassDict
- -> Matching Type
- -> m (Matching Type)
+ -> Matching SourceType
+ -> m (Matching SourceType)
withFreshTypes TypeClassDictionaryInScope{..} subst = do
let onType = everythingOnTypes S.union fromTypeVar
typeVarsInHead = foldMap onType tcdInstanceTypes
@@ -290,29 +291,29 @@ entails SolverOptions{..} constraint context hints =
newSubst <- traverse withFreshType (S.toList uninstantiatedTypeVars)
return (subst <> M.fromList newSubst)
where
- fromTypeVar (TypeVar v) = S.singleton v
+ fromTypeVar (TypeVar _ v) = S.singleton v
fromTypeVar _ = S.empty
withFreshType s = do
t <- freshType
return (s, t)
- unique :: [Type] -> [(a, TypeClassDict)] -> m (EntailsResult a)
+ unique :: [SourceType] -> [(a, TypeClassDict)] -> m (EntailsResult a)
unique tyArgs []
| solverDeferErrors = return Deferred
-- We need a special case for nullary type classes, since we want
-- to generalize over Partial constraints.
- | solverShouldGeneralize && (null tyArgs || any canBeGeneralized tyArgs) = return (Unsolved (Constraint className' tyArgs conInfo))
- | otherwise = throwError . errorMessage $ NoInstanceFound (Constraint className' tyArgs conInfo)
+ | solverShouldGeneralize && (null tyArgs || any canBeGeneralized tyArgs) = return (Unsolved (srcConstraint className' tyArgs conInfo))
+ | otherwise = throwError . errorMessage $ NoInstanceFound (srcConstraint className' tyArgs conInfo)
unique _ [(a, dict)] = return $ Solved a dict
unique tyArgs tcds
| pairwiseAny overlapping (map snd tcds) =
throwError . errorMessage $ OverlappingInstances className' tyArgs (tcds >>= (toList . namedInstanceIdentifier . tcdValue . snd))
| otherwise = return $ uncurry Solved (minimumBy (compare `on` length . tcdPath . snd) tcds)
- canBeGeneralized :: Type -> Bool
+ canBeGeneralized :: Type a -> Bool
canBeGeneralized TUnknown{} = True
- canBeGeneralized (KindedType t _) = canBeGeneralized t
+ canBeGeneralized (KindedType _ t _) = canBeGeneralized t
canBeGeneralized _ = False
-- |
@@ -330,7 +331,7 @@ entails SolverOptions{..} constraint context hints =
-- Create dictionaries for subgoals which still need to be solved by calling go recursively
-- E.g. the goal (Show a, Show b) => Show (Either a b) can be satisfied if the current type
-- unifies with Either a b, and we can satisfy the subgoals Show a and Show b recursively.
- solveSubgoals :: Matching Type -> Maybe [Constraint] -> WriterT (Any, [(Ident, InstanceContext, Constraint)]) (StateT InstanceContext m) (Maybe [Expr])
+ solveSubgoals :: Matching SourceType -> Maybe [SourceConstraint] -> WriterT (Any, [(Ident, InstanceContext, SourceConstraint)]) (StateT InstanceContext m) (Maybe [Expr])
solveSubgoals _ Nothing = return Nothing
solveSubgoals subst (Just subgoals) =
Just <$> traverse (go (work + 1) . mapConstraintArgs (map (replaceAllTypeVars (M.toList subst)))) subgoals
@@ -359,21 +360,21 @@ entails SolverOptions{..} constraint context hints =
subclassDictionaryValue dict className index =
App (Accessor (mkString (superclassName className index)) dict) valUndefined
- solveIsSymbol :: [Type] -> Maybe [TypeClassDict]
- solveIsSymbol [TypeLevelString sym] = Just [TypeClassDictionaryInScope [] 0 (IsSymbolInstance sym) [] C.IsSymbol [TypeLevelString sym] Nothing]
+ solveIsSymbol :: [SourceType] -> Maybe [TypeClassDict]
+ solveIsSymbol [TypeLevelString ann sym] = Just [TypeClassDictionaryInScope [] 0 (IsSymbolInstance sym) [] C.IsSymbol [TypeLevelString ann sym] Nothing]
solveIsSymbol _ = Nothing
- solveSymbolCompare :: [Type] -> Maybe [TypeClassDict]
- solveSymbolCompare [arg0@(TypeLevelString lhs), arg1@(TypeLevelString rhs), _] =
+ solveSymbolCompare :: [SourceType] -> Maybe [TypeClassDict]
+ solveSymbolCompare [arg0@(TypeLevelString _ lhs), arg1@(TypeLevelString _ rhs), _] =
let ordering = case compare lhs rhs of
LT -> C.orderingLT
EQ -> C.orderingEQ
GT -> C.orderingGT
- args' = [arg0, arg1, TypeConstructor ordering]
+ args' = [arg0, arg1, srcTypeConstructor ordering]
in Just [TypeClassDictionaryInScope [] 0 EmptyClassInstance [] C.SymbolCompare args' Nothing]
solveSymbolCompare _ = Nothing
- solveSymbolAppend :: [Type] -> Maybe [TypeClassDict]
+ solveSymbolAppend :: [SourceType] -> Maybe [TypeClassDict]
solveSymbolAppend [arg0, arg1, arg2] = do
(arg0', arg1', arg2') <- appendSymbols arg0 arg1 arg2
let args' = [arg0', arg1', arg2']
@@ -381,126 +382,127 @@ entails SolverOptions{..} constraint context hints =
solveSymbolAppend _ = Nothing
-- | Append type level symbols, or, run backwards, strip a prefix or suffix
- appendSymbols :: Type -> Type -> Type -> Maybe (Type, Type, Type)
- appendSymbols arg0@(TypeLevelString lhs) arg1@(TypeLevelString rhs) _ = Just (arg0, arg1, TypeLevelString (lhs <> rhs))
- appendSymbols arg0@(TypeLevelString lhs) _ arg2@(TypeLevelString out) = do
+ appendSymbols :: SourceType -> SourceType -> SourceType -> Maybe (SourceType, SourceType, SourceType)
+ appendSymbols arg0@(TypeLevelString _ lhs) arg1@(TypeLevelString _ rhs) _ = Just (arg0, arg1, srcTypeLevelString (lhs <> rhs))
+ appendSymbols arg0@(TypeLevelString _ lhs) _ arg2@(TypeLevelString _ out) = do
lhs' <- decodeString lhs
out' <- decodeString out
rhs <- stripPrefix lhs' out'
- pure (arg0, TypeLevelString (mkString rhs), arg2)
- appendSymbols _ arg1@(TypeLevelString rhs) arg2@(TypeLevelString out) = do
+ pure (arg0, srcTypeLevelString (mkString rhs), arg2)
+ appendSymbols _ arg1@(TypeLevelString _ rhs) arg2@(TypeLevelString _ out) = do
rhs' <- decodeString rhs
out' <- decodeString out
lhs <- stripSuffix rhs' out'
- pure (TypeLevelString (mkString lhs), arg1, arg2)
+ pure (srcTypeLevelString (mkString lhs), arg1, arg2)
appendSymbols _ _ _ = Nothing
- solveSymbolCons :: [Type] -> Maybe [TypeClassDict]
+ solveSymbolCons :: [SourceType] -> Maybe [TypeClassDict]
solveSymbolCons [arg0, arg1, arg2] = do
(arg0', arg1', arg2') <- consSymbol arg0 arg1 arg2
let args' = [arg0', arg1', arg2']
pure [TypeClassDictionaryInScope [] 0 EmptyClassInstance [] C.SymbolCons args' Nothing]
solveSymbolCons _ = Nothing
- consSymbol :: Type -> Type -> Type -> Maybe (Type, Type, Type)
- consSymbol _ _ arg@(TypeLevelString s) = do
+ consSymbol :: SourceType -> SourceType -> SourceType -> Maybe (SourceType, SourceType, SourceType)
+ consSymbol _ _ arg@(TypeLevelString _ s) = do
(h, t) <- T.uncons =<< decodeString s
pure (mkTLString (T.singleton h), mkTLString t, arg)
- where mkTLString = TypeLevelString . mkString
- consSymbol arg1@(TypeLevelString h) arg2@(TypeLevelString t) _ = do
+ where mkTLString = srcTypeLevelString . mkString
+ consSymbol arg1@(TypeLevelString _ h) arg2@(TypeLevelString _ t) _ = do
h' <- decodeString h
t' <- decodeString t
guard (T.length h' == 1)
- pure (arg1, arg2, TypeLevelString (mkString $ h' <> t'))
+ pure (arg1, arg2, srcTypeLevelString (mkString $ h' <> t'))
consSymbol _ _ _ = Nothing
- solveUnion :: [Type] -> Maybe [TypeClassDict]
+ solveUnion :: [SourceType] -> Maybe [TypeClassDict]
solveUnion [l, r, u] = do
(lOut, rOut, uOut, cst) <- unionRows l r u
pure [ TypeClassDictionaryInScope [] 0 EmptyClassInstance [] C.RowUnion [lOut, rOut, uOut] cst ]
solveUnion _ = Nothing
-- | Left biased union of two row types
- unionRows :: Type -> Type -> Type -> Maybe (Type, Type, Type, Maybe [Constraint])
+ unionRows :: SourceType -> SourceType -> SourceType -> Maybe (SourceType, SourceType, SourceType, Maybe [SourceConstraint])
unionRows l r _ =
guard canMakeProgress $> (l, r, rowFromList out, cons)
where
(fixed, rest) = rowToList l
- rowVar = TypeVar "r"
+ rowVar = srcTypeVar "r"
(canMakeProgress, out, cons) =
case rest of
-- If the left hand side is a closed row, then we can merge
-- its labels into the right hand side.
- REmpty -> (True, (fixed, r), Nothing)
+ REmpty _ -> (True, (fixed, r), Nothing)
-- If the left hand side is not definitely closed, then the only way we
-- can safely make progress is to move any known labels from the left
-- input into the output, and add a constraint for any remaining labels.
-- Otherwise, the left hand tail might contain the same labels as on
-- the right hand side, and we can't be certain we won't reorder the
-- types for such labels.
- _ -> (not (null fixed), (fixed, rowVar), Just [ Constraint C.RowUnion [rest, r, rowVar] Nothing ])
+ _ -> (not (null fixed), (fixed, rowVar), Just [ srcConstraint C.RowUnion [rest, r, rowVar] Nothing ])
- solveRowCons :: [Type] -> Maybe [TypeClassDict]
- solveRowCons [TypeLevelString sym, ty, r, _] =
- Just [ TypeClassDictionaryInScope [] 0 EmptyClassInstance [] C.RowCons [TypeLevelString sym, ty, r, RCons (Label sym) ty r] Nothing ]
+ solveRowCons :: [SourceType] -> Maybe [TypeClassDict]
+ solveRowCons [TypeLevelString ann sym, ty, r, _] =
+ Just [ TypeClassDictionaryInScope [] 0 EmptyClassInstance [] C.RowCons [TypeLevelString ann sym, ty, r, srcRCons (Label sym) ty r] Nothing ]
solveRowCons _ = Nothing
- solveRowToList :: [Type] -> Maybe [TypeClassDict]
+ solveRowToList :: [SourceType] -> Maybe [TypeClassDict]
solveRowToList [r, _] = do
entries <- rowToRowList r
pure [ TypeClassDictionaryInScope [] 0 EmptyClassInstance [] C.RowToList [r, entries] Nothing ]
solveRowToList _ = Nothing
-- | Convert a closed row to a sorted list of entries
- rowToRowList :: Type -> Maybe Type
+ rowToRowList :: SourceType -> Maybe SourceType
rowToRowList r =
- guard (REmpty == rest) $>
- foldr rowListCons (TypeConstructor C.RowListNil) fixed
+ guard (eqType rest $ REmpty ()) $>
+ foldr rowListCons (srcTypeConstructor C.RowListNil) fixed
where
(fixed, rest) = rowToSortedList r
- rowListCons (lbl, ty) tl = foldl TypeApp (TypeConstructor C.RowListCons)
- [ TypeLevelString (runLabel lbl)
- , ty
- , tl ]
+ rowListCons (RowListItem _ lbl ty) tl =
+ foldl srcTypeApp (srcTypeConstructor C.RowListCons)
+ [ srcTypeLevelString (runLabel lbl)
+ , ty
+ , tl ]
- solveNub :: [Type] -> Maybe [TypeClassDict]
+ solveNub :: [SourceType] -> Maybe [TypeClassDict]
solveNub [r, _] = do
r' <- nubRows r
pure [ TypeClassDictionaryInScope [] 0 EmptyClassInstance [] C.RowNub [r, r'] Nothing ]
solveNub _ = Nothing
- nubRows :: Type -> Maybe Type
+ nubRows :: SourceType -> Maybe SourceType
nubRows r =
- guard (REmpty == rest) $>
- rowFromList (nubBy ((==) `on` fst) fixed, rest)
+ guard (eqType rest $ REmpty ()) $>
+ rowFromList (nubBy ((==) `on` rowListLabel) fixed, rest)
where
(fixed, rest) = rowToSortedList r
- solveLacks :: [Type] -> Maybe [TypeClassDict]
- solveLacks [TypeLevelString sym, r] = do
+ solveLacks :: [SourceType] -> Maybe [TypeClassDict]
+ solveLacks [TypeLevelString ann sym, r] = do
(r', cst) <- rowLacks sym r
- pure [ TypeClassDictionaryInScope [] 0 EmptyClassInstance [] C.RowLacks [TypeLevelString sym, r'] cst ]
+ pure [ TypeClassDictionaryInScope [] 0 EmptyClassInstance [] C.RowLacks [TypeLevelString ann sym, r'] cst ]
solveLacks _ = Nothing
- rowLacks :: PSString -> Type -> Maybe (Type, Maybe [Constraint])
+ rowLacks :: PSString -> SourceType -> Maybe (SourceType, Maybe [SourceConstraint])
rowLacks sym r =
guard (lacksSym && canMakeProgress) $> (r, cst)
where
(fixed, rest) = rowToList r
lacksSym =
- not $ sym `elem` (runLabel . fst <$> fixed)
+ not $ sym `elem` (runLabel . rowListLabel <$> fixed)
(canMakeProgress, cst) = case rest of
- REmpty -> (True, Nothing)
- _ -> (not (null fixed), Just [ Constraint C.RowLacks [TypeLevelString sym, rest] Nothing ])
+ REmpty _ -> (True, Nothing)
+ _ -> (not (null fixed), Just [ srcConstraint C.RowLacks [srcTypeLevelString sym, rest] Nothing ])
-- Check if an instance matches our list of types, allowing for types
-- to be solved via functional dependencies. If the types match, we return a
-- substitution which makes them match. If not, we return 'Nothing'.
-matches :: [FunctionalDependency] -> TypeClassDict -> [Type] -> Matched (Matching [Type])
+matches :: [FunctionalDependency] -> TypeClassDict -> [SourceType] -> Matched (Matching [SourceType])
matches deps TypeClassDictionaryInScope{..} tys =
-- First, find those types which match exactly
let matched = zipWith typeHeadsAreEqual tys tcdInstanceTypes in
@@ -541,76 +543,76 @@ matches deps TypeClassDictionaryInScope{..} tys =
-- Check whether the type heads of two types are equal (for the purposes of type class dictionary lookup),
-- and return a substitution from type variables to types which makes the type heads unify.
--
- typeHeadsAreEqual :: Type -> Type -> (Matched (), Matching [Type])
- typeHeadsAreEqual (KindedType t1 _) t2 = typeHeadsAreEqual t1 t2
- typeHeadsAreEqual t1 (KindedType t2 _) = typeHeadsAreEqual t1 t2
- typeHeadsAreEqual (TUnknown u1) (TUnknown u2) | u1 == u2 = (Match (), M.empty)
- typeHeadsAreEqual (Skolem _ s1 _ _) (Skolem _ s2 _ _) | s1 == s2 = (Match (), M.empty)
- typeHeadsAreEqual t (TypeVar v) = (Match (), M.singleton v [t])
- typeHeadsAreEqual (TypeConstructor c1) (TypeConstructor c2) | c1 == c2 = (Match (), M.empty)
- typeHeadsAreEqual (TypeLevelString s1) (TypeLevelString s2) | s1 == s2 = (Match (), M.empty)
- typeHeadsAreEqual (TypeApp h1 t1) (TypeApp h2 t2) =
+ typeHeadsAreEqual :: Type a -> Type a -> (Matched (), Matching [Type a])
+ typeHeadsAreEqual (KindedType _ t1 _) t2 = typeHeadsAreEqual t1 t2
+ typeHeadsAreEqual t1 (KindedType _ t2 _) = typeHeadsAreEqual t1 t2
+ typeHeadsAreEqual (TUnknown _ u1) (TUnknown _ u2) | u1 == u2 = (Match (), M.empty)
+ typeHeadsAreEqual (Skolem _ _ s1 _) (Skolem _ _ s2 _) | s1 == s2 = (Match (), M.empty)
+ typeHeadsAreEqual t (TypeVar _ v) = (Match (), M.singleton v [t])
+ typeHeadsAreEqual (TypeConstructor _ c1) (TypeConstructor _ c2) | c1 == c2 = (Match (), M.empty)
+ typeHeadsAreEqual (TypeLevelString _ s1) (TypeLevelString _ s2) | s1 == s2 = (Match (), M.empty)
+ typeHeadsAreEqual (TypeApp _ h1 t1) (TypeApp _ h2 t2) =
both (typeHeadsAreEqual h1 h2) (typeHeadsAreEqual t1 t2)
- typeHeadsAreEqual REmpty REmpty = (Match (), M.empty)
+ typeHeadsAreEqual (REmpty _) (REmpty _) = (Match (), M.empty)
typeHeadsAreEqual r1@RCons{} r2@RCons{} =
foldr both (uncurry go rest) common
where
(common, rest) = alignRowsWith typeHeadsAreEqual r1 r2
- go :: ([(Label, Type)], Type) -> ([(Label, Type)], Type) -> (Matched (), Matching [Type])
- go (l, KindedType t1 _) (r, t2) = go (l, t1) (r, t2)
- go (l, t1) (r, KindedType t2 _) = go (l, t1) (r, t2)
- go ([], REmpty) ([], REmpty) = (Match (), M.empty)
- go ([], TUnknown u1) ([], TUnknown u2) | u1 == u2 = (Match (), M.empty)
- go ([], TypeVar v1) ([], TypeVar v2) | v1 == v2 = (Match (), M.empty)
- go ([], Skolem _ sk1 _ _) ([], Skolem _ sk2 _ _) | sk1 == sk2 = (Match (), M.empty)
- go ([], TUnknown _) _ = (Unknown, M.empty)
- go (sd, r) ([], TypeVar v) = (Match (), M.singleton v [rowFromList (sd, r)])
- go _ _ = (Apart, M.empty)
- typeHeadsAreEqual (TUnknown _) _ = (Unknown, M.empty)
+ go :: ([RowListItem a], Type a) -> ([RowListItem a], Type a) -> (Matched (), Matching [Type a])
+ go (l, KindedType _ t1 _) (r, t2) = go (l, t1) (r, t2)
+ go (l, t1) (r, KindedType _ t2 _) = go (l, t1) (r, t2)
+ go ([], REmpty _) ([], REmpty _) = (Match (), M.empty)
+ go ([], TUnknown _ u1) ([], TUnknown _ u2) | u1 == u2 = (Match (), M.empty)
+ go ([], TypeVar _ v1) ([], TypeVar _ v2) | v1 == v2 = (Match (), M.empty)
+ go ([], Skolem _ _ sk1 _) ([], Skolem _ _ sk2 _) | sk1 == sk2 = (Match (), M.empty)
+ go ([], TUnknown _ _) _ = (Unknown, M.empty)
+ go (sd, r) ([], TypeVar _ v) = (Match (), M.singleton v [rowFromList (sd, r)])
+ go _ _ = (Apart, M.empty)
+ typeHeadsAreEqual (TUnknown _ _) _ = (Unknown, M.empty)
typeHeadsAreEqual _ _ = (Apart, M.empty)
- both :: (Matched (), Matching [Type]) -> (Matched (), Matching [Type]) -> (Matched (), Matching [Type])
+ both :: (Matched (), Matching [Type a]) -> (Matched (), Matching [Type a]) -> (Matched (), Matching [Type a])
both (b1, m1) (b2, m2) = (b1 <> b2, M.unionWith (++) m1 m2)
-- Ensure that a substitution is valid
- verifySubstitution :: Matching [Type] -> Matched (Matching [Type])
+ verifySubstitution :: Matching [Type a] -> Matched (Matching [Type a])
verifySubstitution mts = foldMap meet mts $> mts where
meet = pairwiseAll typesAreEqual
-- Note that unknowns are only allowed to unify if they came from a type
-- which was _not_ solved, i.e. one which was inferred by a functional
-- dependency.
- typesAreEqual :: Type -> Type -> Matched ()
- typesAreEqual (KindedType t1 _) t2 = typesAreEqual t1 t2
- typesAreEqual t1 (KindedType t2 _) = typesAreEqual t1 t2
- typesAreEqual (TUnknown u1) (TUnknown u2) | u1 == u2 = Match ()
- typesAreEqual (Skolem _ s1 _ _) (Skolem _ s2 _ _) | s1 == s2 = Match ()
- typesAreEqual (Skolem _ _ _ _) _ = Unknown
- typesAreEqual _ (Skolem _ _ _ _) = Unknown
- typesAreEqual (TypeVar v1) (TypeVar v2) | v1 == v2 = Match ()
- typesAreEqual (TypeLevelString s1) (TypeLevelString s2) | s1 == s2 = Match ()
- typesAreEqual (TypeConstructor c1) (TypeConstructor c2) | c1 == c2 = Match ()
- typesAreEqual (TypeApp h1 t1) (TypeApp h2 t2) = typesAreEqual h1 h2 <> typesAreEqual t1 t2
- typesAreEqual REmpty REmpty = Match ()
- typesAreEqual r1 r2 | isRCons r1 || isRCons r2 =
+ typesAreEqual :: Type a -> Type a -> Matched ()
+ typesAreEqual (KindedType _ t1 _) t2 = typesAreEqual t1 t2
+ typesAreEqual t1 (KindedType _ t2 _) = typesAreEqual t1 t2
+ typesAreEqual (TUnknown _ u1) (TUnknown _ u2) | u1 == u2 = Match ()
+ typesAreEqual (Skolem _ _ s1 _) (Skolem _ _ s2 _) | s1 == s2 = Match ()
+ typesAreEqual (Skolem _ _ _ _) _ = Unknown
+ typesAreEqual _ (Skolem _ _ _ _) = Unknown
+ typesAreEqual (TypeVar _ v1) (TypeVar _ v2) | v1 == v2 = Match ()
+ typesAreEqual (TypeLevelString _ s1) (TypeLevelString _ s2) | s1 == s2 = Match ()
+ typesAreEqual (TypeConstructor _ c1) (TypeConstructor _ c2) | c1 == c2 = Match ()
+ typesAreEqual (TypeApp _ h1 t1) (TypeApp _ h2 t2) = typesAreEqual h1 h2 <> typesAreEqual t1 t2
+ typesAreEqual (REmpty _) (REmpty _) = Match ()
+ typesAreEqual r1 r2 | isRCons r1 || isRCons r2 =
let (common, rest) = alignRowsWith typesAreEqual r1 r2
in fold common <> uncurry go rest
where
- go :: ([(Label, Type)], Type) -> ([(Label, Type)], Type) -> Matched ()
- go (l, KindedType t1 _) (r, t2) = go (l, t1) (r, t2)
- go (l, t1) (r, KindedType t2 _) = go (l, t1) (r, t2)
- go ([], TUnknown u1) ([], TUnknown u2) | u1 == u2 = Match ()
- go ([], Skolem _ s1 _ _) ([], Skolem _ s2 _ _) | s1 == s2 = Match ()
- go ([], Skolem _ _ _ _) _ = Unknown
- go _ ([], Skolem _ _ _ _) = Unknown
- go ([], REmpty) ([], REmpty) = Match ()
- go ([], TypeVar v1) ([], TypeVar v2) | v1 == v2 = Match ()
- go _ _ = Apart
- typesAreEqual _ _ = Apart
-
- isRCons :: Type -> Bool
+ go :: ([RowListItem a], Type a) -> ([RowListItem a], Type a) -> Matched ()
+ go (l, KindedType _ t1 _) (r, t2) = go (l, t1) (r, t2)
+ go (l, t1) (r, KindedType _ t2 _) = go (l, t1) (r, t2)
+ go ([], TUnknown _ u1) ([], TUnknown _ u2) | u1 == u2 = Match ()
+ go ([], Skolem _ _ s1 _) ([], Skolem _ _ s2 _) | s1 == s2 = Match ()
+ go ([], Skolem _ _ _ _) _ = Unknown
+ go _ ([], Skolem _ _ _ _) = Unknown
+ go ([], REmpty _) ([], REmpty _) = Match ()
+ go ([], TypeVar _ v1) ([], TypeVar _ v2) | v1 == v2 = Match ()
+ go _ _ = Apart
+ typesAreEqual _ _ = Apart
+
+ isRCons :: Type a -> Bool
isRCons RCons{} = True
isRCons _ = False
@@ -620,24 +622,24 @@ newDictionaries
:: MonadState CheckState m
=> [(Qualified (ProperName 'ClassName), Integer)]
-> Qualified Ident
- -> Constraint
+ -> SourceConstraint
-> m [NamedDict]
-newDictionaries path name (Constraint className instanceTy _) = do
+newDictionaries path name (Constraint _ className instanceTy _) = do
tcs <- gets (typeClasses . checkEnv)
let TypeClassData{..} = fromMaybe (internalError "newDictionaries: type class lookup failed") $ M.lookup className tcs
- supDicts <- join <$> zipWithM (\(Constraint supName supArgs _) index ->
+ supDicts <- join <$> zipWithM (\(Constraint ann supName supArgs _) index ->
newDictionaries ((supName, index) : path)
name
- (Constraint supName (instantiateSuperclass (map fst typeClassArguments) supArgs instanceTy) Nothing)
+ (Constraint ann supName (instantiateSuperclass (map fst typeClassArguments) supArgs instanceTy) Nothing)
) typeClassSuperclasses [0..]
return (TypeClassDictionaryInScope [] 0 name path className instanceTy Nothing : supDicts)
where
- instantiateSuperclass :: [Text] -> [Type] -> [Type] -> [Type]
+ instantiateSuperclass :: [Text] -> [SourceType] -> [SourceType] -> [SourceType]
instantiateSuperclass args supArgs tys = map (replaceAllTypeVars (zip args tys)) supArgs
mkContext :: [NamedDict] -> InstanceContext
mkContext = foldr combineContexts M.empty . map fromDict where
- fromDict d = M.singleton Nothing (M.singleton (tcdClassName d) (M.singleton (tcdValue d) d))
+ fromDict d = M.singleton Nothing (M.singleton (tcdClassName d) (M.singleton (tcdValue d) (pure d)))
-- | Check all pairs of values in a list match a predicate
pairwiseAll :: Monoid m => (a -> a -> m) -> [a] -> m
diff --git a/src/Language/PureScript/TypeChecker/Kinds.hs b/src/Language/PureScript/TypeChecker/Kinds.hs
index 58ec2f0..0e6792c 100644
--- a/src/Language/PureScript/TypeChecker/Kinds.hs
+++ b/src/Language/PureScript/TypeChecker/Kinds.hs
@@ -17,8 +17,10 @@ import Control.Monad
import Control.Monad.Error.Class (MonadError(..))
import Control.Monad.State
+import Data.Functor (($>))
import qualified Data.Map as M
import Data.Text (Text)
+import Data.Traversable (for)
import Language.PureScript.Crash
import Language.PureScript.Environment
@@ -29,17 +31,20 @@ import Language.PureScript.TypeChecker.Monad
import Language.PureScript.Types
-- | Generate a fresh kind variable
-freshKind :: (MonadState CheckState m) => m Kind
-freshKind = do
+freshKind :: (MonadState CheckState m) => SourceAnn -> m SourceKind
+freshKind ann = do
k <- gets checkNextKind
modify $ \st -> st { checkNextKind = k + 1 }
- return $ KUnknown k
+ return $ KUnknown ann k
+
+freshKind' :: (MonadState CheckState m) => m SourceKind
+freshKind' = freshKind NullSourceAnn
-- | Update the substitution to solve a kind constraint
solveKind
:: (MonadError MultipleErrors m, MonadState CheckState m)
=> Int
- -> Kind
+ -> SourceKind
-> m ()
solveKind u k = do
occursCheck u k
@@ -50,13 +55,13 @@ solveKind u k = do
}
-- | Apply a substitution to a kind
-substituteKind :: Substitution -> Kind -> Kind
+substituteKind :: Substitution -> SourceKind -> SourceKind
substituteKind sub = everywhereOnKinds go
where
- go (KUnknown u) =
+ go (KUnknown ann u) =
case M.lookup u (substKind sub) of
- Nothing -> KUnknown u
- Just (KUnknown u1) | u1 == u -> KUnknown u1
+ Nothing -> KUnknown ann u
+ Just (KUnknown ann' u1) | u1 == u -> KUnknown ann' u1
Just t -> substituteKind sub t
go other = other
@@ -64,46 +69,49 @@ substituteKind sub = everywhereOnKinds go
occursCheck
:: (MonadError MultipleErrors m)
=> Int
- -> Kind
+ -> SourceKind
-> m ()
occursCheck _ KUnknown{} = return ()
occursCheck u k = void $ everywhereOnKindsM go k
where
- go (KUnknown u') | u == u' = throwError . errorMessage . InfiniteKind $ k
+ go (KUnknown _ u') | u == u' = throwError . errorMessage . InfiniteKind $ k
go other = return other
-- | Unify two kinds
unifyKinds
:: (MonadError MultipleErrors m, MonadState CheckState m)
- => Kind
- -> Kind
+ => SourceKind
+ -> SourceKind
-> m ()
unifyKinds k1 k2 = do
sub <- gets checkSubstitution
go (substituteKind sub k1) (substituteKind sub k2)
where
- go (KUnknown u1) (KUnknown u2) | u1 == u2 = return ()
- go (KUnknown u) k = solveKind u k
- go k (KUnknown u) = solveKind u k
- go (NamedKind k1') (NamedKind k2') | k1' == k2' = return ()
- go (Row k1') (Row k2') = unifyKinds k1' k2'
- go (FunKind k1' k2') (FunKind k3 k4) = do
+ go (KUnknown _ u1) (KUnknown _ u2) | u1 == u2 = return ()
+ go (KUnknown _ u) k = solveKind u k
+ go k (KUnknown _ u) = solveKind u k
+ go (NamedKind _ k1') (NamedKind _ k2') | k1' == k2' = return ()
+ go (Row _ k1') (Row _ k2') = unifyKinds k1' k2'
+ go (FunKind _ k1' k2') (FunKind _ k3 k4) = do
unifyKinds k1' k3
unifyKinds k2' k4
- go k1' k2' = throwError . errorMessage $ KindsDoNotUnify k1' k2'
+ go k1' k2' =
+ throwError
+ . errorMessage''' (fst . getAnnForKind <$> [k1', k2'])
+ $ KindsDoNotUnify k1' k2'
-- | Infer the kind of a single type
kindOf
:: (MonadError MultipleErrors m, MonadState CheckState m)
- => Type
- -> m Kind
+ => SourceType
+ -> m SourceKind
kindOf ty = fst <$> kindOfWithScopedVars ty
-- | Infer the kind of a single type, returning the kinds of any scoped type variables
kindOfWithScopedVars ::
(MonadError MultipleErrors m, MonadState CheckState m) =>
- Type ->
- m (Kind, [(Text, Kind)])
+ SourceType ->
+ m (SourceKind, [(Text, SourceKind)])
kindOfWithScopedVars ty =
withErrorMessageHint (ErrorCheckingKind ty) $
fmap tidyUp . withFreshSubstitution . captureSubstitution $ infer ty
@@ -118,12 +126,12 @@ kindsOf
=> Bool
-> ModuleName
-> ProperName 'TypeName
- -> [(Text, Maybe Kind)]
- -> [Type]
- -> m Kind
+ -> [(Text, Maybe SourceKind)]
+ -> [SourceType]
+ -> m SourceKind
kindsOf isData moduleName name args ts = fmap tidyUp . withFreshSubstitution . captureSubstitution $ do
- tyCon <- freshKind
- kargs <- replicateM (length args) freshKind
+ tyCon <- freshKind'
+ kargs <- replicateM (length args) $ freshKind'
rest <- zipWithM freshKindVar args kargs
let dict = (name, tyCon) : rest
bindLocalTypeVariables moduleName dict $
@@ -133,9 +141,9 @@ kindsOf isData moduleName name args ts = fmap tidyUp . withFreshSubstitution . c
freshKindVar
:: (MonadError MultipleErrors m, MonadState CheckState m)
- => (Text, Maybe Kind)
- -> Kind
- -> m (ProperName 'TypeName, Kind)
+ => (Text, Maybe SourceKind)
+ -> SourceKind
+ -> m (ProperName 'TypeName, SourceKind)
freshKindVar (arg, Nothing) kind = return (ProperName arg, kind)
freshKindVar (arg, Just kind') kind = do
unifyKinds kind kind'
@@ -145,23 +153,23 @@ freshKindVar (arg, Just kind') kind = do
kindsOfAll
:: (MonadError MultipleErrors m, MonadState CheckState m)
=> ModuleName
- -> [(ProperName 'TypeName, [(Text, Maybe Kind)], Type)]
- -> [(ProperName 'TypeName, [(Text, Maybe Kind)], [Type])]
- -> m ([Kind], [Kind])
+ -> [(SourceAnn, ProperName 'TypeName, [(Text, Maybe SourceKind)], SourceType)]
+ -> [(SourceAnn, ProperName 'TypeName, [(Text, Maybe SourceKind)], [SourceType])]
+ -> m ([SourceKind], [SourceKind])
kindsOfAll moduleName syns tys = fmap tidyUp . withFreshSubstitution . captureSubstitution $ do
- synVars <- replicateM (length syns) freshKind
- let dict = zipWith (\(name, _, _) var -> (name, var)) syns synVars
+ synVars <- for syns $ \(sa, _, _, _) -> freshKind sa
+ let dict = zipWith (\(_, name, _, _) var -> (name, var)) syns synVars
bindLocalTypeVariables moduleName dict $ do
- tyCons <- replicateM (length tys) freshKind
- let dict' = zipWith (\(name, _, _) tyCon -> (name, tyCon)) tys tyCons
+ tyCons <- for tys $ \(sa, _, _, _) -> freshKind sa
+ let dict' = zipWith (\(_, name, _, _) tyCon -> (name, tyCon)) tys tyCons
bindLocalTypeVariables moduleName dict' $ do
- data_ks <- zipWithM (\tyCon (_, args, ts) -> do
- kargs <- replicateM (length args) freshKind
+ data_ks <- zipWithM (\tyCon (_, _, args, ts) -> do
+ kargs <- for args $ \(_, kind) -> maybe freshKind' (freshKind . getAnnForKind) kind
argDict <- zipWithM freshKindVar args kargs
bindLocalTypeVariables moduleName argDict $
solveTypes True ts kargs tyCon) tyCons tys
- syn_ks <- zipWithM (\synVar (_, args, ty) -> do
- kargs <- replicateM (length args) freshKind
+ syn_ks <- zipWithM (\synVar (_, _, args, ty) -> do
+ kargs <- for args $ \(_, kind) -> maybe freshKind' (freshKind . getAnnForKind) kind
argDict <- zipWithM freshKindVar args kargs
bindLocalTypeVariables moduleName argDict $
solveTypes False [ty] kargs synVar) synVars syns
@@ -173,93 +181,96 @@ kindsOfAll moduleName syns tys = fmap tidyUp . withFreshSubstitution . captureSu
solveTypes
:: (MonadError MultipleErrors m, MonadState CheckState m)
=> Bool
- -> [Type]
- -> [Kind]
- -> Kind
- -> m Kind
+ -> [SourceType]
+ -> [SourceKind]
+ -> SourceKind
+ -> m SourceKind
solveTypes isData ts kargs tyCon = do
ks <- traverse (fmap fst . infer) ts
when isData $ do
- unifyKinds tyCon (foldr FunKind kindType kargs)
- forM_ ks $ \k -> unifyKinds k kindType
+ unifyKinds tyCon (foldr srcFunKind kindType kargs)
+ forM_ ks $ \k -> unifyKinds k (kindType $> getAnnForKind k)
unless isData $
- unifyKinds tyCon (foldr FunKind (head ks) kargs)
+ unifyKinds tyCon (foldr srcFunKind (head ks) kargs)
return tyCon
-- | Default all unknown kinds to the kindType kind of types
-starIfUnknown :: Kind -> Kind
-starIfUnknown (KUnknown _) = kindType
-starIfUnknown (Row k) = Row (starIfUnknown k)
-starIfUnknown (FunKind k1 k2) = FunKind (starIfUnknown k1) (starIfUnknown k2)
+starIfUnknown :: Kind a -> Kind a
+starIfUnknown (KUnknown ann _) = kindType $> ann
+starIfUnknown (Row ann k) = Row ann (starIfUnknown k)
+starIfUnknown (FunKind ann k1 k2) = FunKind ann (starIfUnknown k1) (starIfUnknown k2)
starIfUnknown k = k
-- | Infer a kind for a type
infer
:: (MonadError MultipleErrors m, MonadState CheckState m)
- => Type
- -> m (Kind, [(Text, Kind)])
-infer ty = withErrorMessageHint (ErrorCheckingKind ty) $ infer' ty
+ => SourceType
+ -> m (SourceKind, [(Text, SourceKind)])
+infer ty =
+ withErrorMessageHint (ErrorCheckingKind ty)
+ . rethrowWithPosition (fst $ getAnnForType ty)
+ $ infer' ty
infer'
:: forall m
. (MonadError MultipleErrors m, MonadState CheckState m)
- => Type
- -> m (Kind, [(Text, Kind)])
-infer' (ForAll ident ty _) = do
- k1 <- freshKind
+ => SourceType
+ -> m (SourceKind, [(Text, SourceKind)])
+infer' (ForAll ann ident ty _) = do
+ k1 <- freshKind ann
Just moduleName <- checkCurrentModule <$> get
(k2, args) <- bindLocalTypeVariables moduleName [(ProperName ident, k1)] $ infer ty
unifyKinds k2 kindType
return (kindType, (ident, k1) : args)
-infer' (KindedType ty k) = do
+infer' (KindedType _ ty k) = do
(k', args) <- infer ty
unifyKinds k k'
return (k', args)
infer' other = (, []) <$> go other
where
- go :: Type -> m Kind
- go (ForAll ident ty _) = do
- k1 <- freshKind
+ go :: SourceType -> m SourceKind
+ go (ForAll ann ident ty _) = do
+ k1 <- freshKind ann
Just moduleName <- checkCurrentModule <$> get
k2 <- bindLocalTypeVariables moduleName [(ProperName ident, k1)] $ go ty
unifyKinds k2 kindType
- return kindType
- go (KindedType ty k) = do
+ return $ kindType $> ann
+ go (KindedType _ ty k) = do
k' <- go ty
unifyKinds k k'
return k'
- go TypeWildcard{} = freshKind
- go TUnknown{} = freshKind
- go (TypeLevelString _) = return kindSymbol
- go (TypeVar v) = do
+ go (TypeWildcard ann _) = freshKind ann
+ go (TUnknown ann _) = freshKind ann
+ go (TypeLevelString ann _) = return $ kindSymbol $> ann
+ go (TypeVar ann v) = do
Just moduleName <- checkCurrentModule <$> get
- lookupTypeVariable moduleName (Qualified Nothing (ProperName v))
- go (Skolem v _ _ _) = do
+ ($> ann) <$> lookupTypeVariable moduleName (Qualified Nothing (ProperName v))
+ go (Skolem ann v _ _) = do
Just moduleName <- checkCurrentModule <$> get
- lookupTypeVariable moduleName (Qualified Nothing (ProperName v))
- go (TypeConstructor v) = do
+ ($> ann) <$> lookupTypeVariable moduleName (Qualified Nothing (ProperName v))
+ go (TypeConstructor ann v) = do
env <- getEnv
case M.lookup v (types env) of
- Nothing -> throwError . errorMessage . UnknownName $ fmap TyName v
- Just (kind, _) -> return kind
- go (TypeApp t1 t2) = do
- k0 <- freshKind
+ Nothing -> throwError . errorMessage' (fst ann) . UnknownName $ fmap TyName v
+ Just (kind, _) -> return $ kind $> ann
+ go (TypeApp ann t1 t2) = do
+ k0 <- freshKind ann
k1 <- go t1
k2 <- go t2
- unifyKinds k1 (FunKind k2 k0)
+ unifyKinds k1 (FunKind ann k2 k0)
return k0
- go REmpty = do
- k <- freshKind
- return $ Row k
- go (RCons _ ty row) = do
+ go (REmpty ann) = do
+ k <- freshKind ann
+ return $ Row ann k
+ go (RCons ann _ ty row) = do
k1 <- go ty
k2 <- go row
- unifyKinds k2 (Row k1)
- return $ Row k1
- go (ConstrainedType (Constraint className tys _) ty) = do
- k1 <- go $ foldl TypeApp (TypeConstructor (fmap coerceProperName className)) tys
+ unifyKinds k2 (Row ann k1)
+ return $ Row ann k1
+ go (ConstrainedType ann2 (Constraint ann1 className tys _) ty) = do
+ k1 <- go $ foldl (TypeApp ann2) (TypeConstructor ann1 (fmap coerceProperName className)) tys
unifyKinds k1 kindType
k2 <- go ty
unifyKinds k2 kindType
- return kindType
+ return $ kindType $> ann2
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 dcc40cc..7ec603f 100644
--- a/src/Language/PureScript/TypeChecker/Monad.hs
+++ b/src/Language/PureScript/TypeChecker/Monad.hs
@@ -16,6 +16,7 @@ import Control.Monad.Writer.Class (MonadWriter(..), censor)
import Data.Maybe
import qualified Data.Map as M
import Data.Text (Text)
+import qualified Data.List.NonEmpty as NEL
import Language.PureScript.Environment
import Language.PureScript.Errors
@@ -26,8 +27,8 @@ import Language.PureScript.Types
-- | A substitution of unification variables for types or kinds
data Substitution = Substitution
- { substType :: M.Map Int Type -- ^ Type substitution
- , substKind :: M.Map Int Kind -- ^ Kind substitution
+ { substType :: M.Map Int SourceType -- ^ Type substitution
+ , substKind :: M.Map Int SourceKind -- ^ Kind substitution
}
-- | An empty substitution
@@ -67,7 +68,7 @@ type Unknown = Int
-- | Temporarily bind a collection of names to values
bindNames
:: MonadState CheckState m
- => M.Map (Qualified Ident) (Type, NameKind, NameVisibility)
+ => M.Map (Qualified Ident) (SourceType, NameKind, NameVisibility)
-> m a
-> m a
bindNames newNames action = do
@@ -80,7 +81,7 @@ bindNames newNames action = do
-- | Temporarily bind a collection of names to types
bindTypes
:: MonadState CheckState m
- => M.Map (Qualified (ProperName 'TypeName)) (Kind, TypeKind)
+ => M.Map (Qualified (ProperName 'TypeName)) (SourceKind, TypeKind)
-> m a
-> m a
bindTypes newNames action = do
@@ -94,7 +95,7 @@ bindTypes newNames action = do
withScopedTypeVars
:: (MonadState CheckState m, MonadWriter MultipleErrors m)
=> ModuleName
- -> [(Text, Kind)]
+ -> [(Text, SourceKind)]
-> m a
-> m a
withScopedTypeVars mn ks ma = do
@@ -144,8 +145,15 @@ withTypeClassDictionaries
-> m a
withTypeClassDictionaries entries action = do
orig <- get
- let mentries = M.fromListWith (M.unionWith M.union) [ (mn, M.singleton className (M.singleton (tcdValue entry) entry)) | entry@TypeClassDictionaryInScope{ tcdValue = Qualified mn _, tcdClassName = className } <- entries ]
- modify $ \st -> st { checkEnv = (checkEnv st) { typeClassDictionaries = M.unionWith (M.unionWith M.union) (typeClassDictionaries . checkEnv $ st) mentries } }
+
+ let mentries =
+ M.fromListWith (M.unionWith (M.unionWith (<>)))
+ [ (mn, M.singleton className (M.singleton (tcdValue entry) (pure entry)))
+ | entry@TypeClassDictionaryInScope{ tcdValue = Qualified mn _, tcdClassName = className }
+ <- entries
+ ]
+
+ modify $ \st -> st { checkEnv = (checkEnv st) { typeClassDictionaries = M.unionWith (M.unionWith (M.unionWith (<>))) (typeClassDictionaries . checkEnv $ st) mentries } }
a <- action
modify $ \st -> st { checkEnv = (checkEnv st) { typeClassDictionaries = typeClassDictionaries . checkEnv $ orig } }
return a
@@ -153,14 +161,14 @@ withTypeClassDictionaries entries action = do
-- | Get the currently available map of type class dictionaries
getTypeClassDictionaries
:: (MonadState CheckState m)
- => m (M.Map (Maybe ModuleName) (M.Map (Qualified (ProperName 'ClassName)) (M.Map (Qualified Ident) NamedDict)))
+ => m (M.Map (Maybe ModuleName) (M.Map (Qualified (ProperName 'ClassName)) (M.Map (Qualified Ident) (NEL.NonEmpty NamedDict))))
getTypeClassDictionaries = typeClassDictionaries . checkEnv <$> get
-- | Lookup type class dictionaries in a module.
lookupTypeClassDictionaries
:: (MonadState CheckState m)
=> Maybe ModuleName
- -> m (M.Map (Qualified (ProperName 'ClassName)) (M.Map (Qualified Ident) NamedDict))
+ -> m (M.Map (Qualified (ProperName 'ClassName)) (M.Map (Qualified Ident) (NEL.NonEmpty NamedDict)))
lookupTypeClassDictionaries mn = fromMaybe M.empty . M.lookup mn . typeClassDictionaries . checkEnv <$> get
-- | Lookup type class dictionaries in a module.
@@ -168,13 +176,13 @@ lookupTypeClassDictionariesForClass
:: (MonadState CheckState m)
=> Maybe ModuleName
-> Qualified (ProperName 'ClassName)
- -> m (M.Map (Qualified Ident) NamedDict)
+ -> m (M.Map (Qualified Ident) (NEL.NonEmpty NamedDict))
lookupTypeClassDictionariesForClass mn cn = fromMaybe M.empty . M.lookup cn <$> lookupTypeClassDictionaries mn
-- | Temporarily bind a collection of names to local variables
bindLocalVariables
:: (MonadState CheckState m)
- => [(Ident, Type, NameVisibility)]
+ => [(Ident, SourceType, NameVisibility)]
-> m a
-> m a
bindLocalVariables bindings =
@@ -184,7 +192,7 @@ bindLocalVariables bindings =
bindLocalTypeVariables
:: (MonadState CheckState m)
=> ModuleName
- -> [(ProperName 'TypeName, Kind)]
+ -> [(ProperName 'TypeName, SourceKind)]
-> m a
-> m a
bindLocalTypeVariables moduleName bindings =
@@ -210,7 +218,7 @@ preservingNames action = do
lookupVariable
:: (e ~ MultipleErrors, MonadState CheckState m, MonadError e m)
=> Qualified Ident
- -> m Type
+ -> m SourceType
lookupVariable qual = do
env <- getEnv
case M.lookup qual (names env) of
@@ -244,7 +252,7 @@ lookupTypeVariable
:: (e ~ MultipleErrors, MonadState CheckState m, MonadError e m)
=> ModuleName
-> Qualified (ProperName 'TypeName)
- -> m Kind
+ -> m SourceKind
lookupTypeVariable currentModule (Qualified moduleName name) = do
env <- getEnv
case M.lookup (Qualified (Just $ fromMaybe currentModule moduleName) name) (types env) of
diff --git a/src/Language/PureScript/TypeChecker/Skolems.hs b/src/Language/PureScript/TypeChecker/Skolems.hs
index ed7659c..76af631 100644
--- a/src/Language/PureScript/TypeChecker/Skolems.hs
+++ b/src/Language/PureScript/TypeChecker/Skolems.hs
@@ -31,10 +31,10 @@ newSkolemConstant = do
return s
-- | Introduce skolem scope at every occurence of a ForAll
-introduceSkolemScope :: MonadState CheckState m => Type -> m Type
+introduceSkolemScope :: MonadState CheckState m => Type a -> m (Type a)
introduceSkolemScope = everywhereOnTypesM go
where
- go (ForAll ident ty Nothing) = ForAll ident ty <$> (Just <$> newSkolemScope)
+ go (ForAll ann ident ty Nothing) = ForAll ann ident ty <$> (Just <$> newSkolemScope)
go other = return other
-- | Generate a new skolem scope
@@ -45,14 +45,14 @@ newSkolemScope = do
return $ SkolemScope s
-- | Skolemize a type variable by replacing its instances with fresh skolem constants
-skolemize :: Text -> Int -> SkolemScope -> Maybe SourceSpan -> Type -> Type
-skolemize ident sko scope ss = replaceTypeVars ident (Skolem ident sko scope ss)
+skolemize :: a -> Text -> Int -> SkolemScope -> Type a -> Type a
+skolemize ann ident sko scope = replaceTypeVars ident (Skolem ann ident sko scope)
-- | This function skolemizes type variables appearing in any type signatures or
-- 'DeferredDictionary' placeholders. These type variables are the only places
-- where scoped type variables can appear in expressions.
-skolemizeTypesInValue :: Text -> Int -> SkolemScope -> Maybe SourceSpan -> Expr -> Expr
-skolemizeTypesInValue ident sko scope ss =
+skolemizeTypesInValue :: SourceAnn -> Text -> Int -> SkolemScope -> Expr -> Expr
+skolemizeTypesInValue ann ident sko scope =
runIdentity . onExpr'
where
onExpr' :: Expr -> Identity Expr
@@ -60,18 +60,18 @@ skolemizeTypesInValue ident sko scope ss =
onExpr :: [Text] -> Expr -> Identity ([Text], Expr)
onExpr sco (DeferredDictionary c ts)
- | ident `notElem` sco = return (sco, DeferredDictionary c (map (skolemize ident sko scope ss) ts))
+ | ident `notElem` sco = return (sco, DeferredDictionary c (map (skolemize ann ident sko scope) ts))
onExpr sco (TypedValue check val ty)
- | ident `notElem` sco = return (sco ++ peelTypeVars ty, TypedValue check val (skolemize ident sko scope ss ty))
+ | ident `notElem` sco = return (sco ++ peelTypeVars ty, TypedValue check val (skolemize ann ident sko scope ty))
onExpr sco other = return (sco, other)
onBinder :: [Text] -> Binder -> Identity ([Text], Binder)
onBinder sco (TypedBinder ty b)
- | ident `notElem` sco = return (sco ++ peelTypeVars ty, TypedBinder (skolemize ident sko scope ss ty) b)
+ | ident `notElem` sco = return (sco ++ peelTypeVars ty, TypedBinder (skolemize ann ident sko scope ty) b)
onBinder sco other = return (sco, other)
- peelTypeVars :: Type -> [Text]
- peelTypeVars (ForAll i ty _) = i : peelTypeVars ty
+ peelTypeVars :: SourceType -> [Text]
+ peelTypeVars (ForAll _ i ty _) = i : peelTypeVars ty
peelTypeVars _ = []
-- | Ensure skolem variables do not escape their scope
@@ -100,8 +100,8 @@ skolemEscapeCheck expr@TypedValue{} =
go (scopes, ssUsed) val@(TypedValue _ _ ty) =
( (allScopes, ssUsed)
, [ ErrorMessage (maybe id ((:) . positionedError) ssUsed [ ErrorInExpression val ]) $
- EscapedSkolem name ssBound ty
- | (name, scope, ssBound) <- collectSkolems ty
+ EscapedSkolem name (nonEmptySpan ssBound) ty
+ | (ssBound, name, scope) <- collectSkolems ty
, notMember scope allScopes
]
)
@@ -115,15 +115,15 @@ skolemEscapeCheck expr@TypedValue{} =
allScopes = fromList newScopes <> scopes
-- Collect any scopes appearing in quantifiers at the top level
- collectScopes :: Type -> [SkolemScope]
- collectScopes (ForAll _ t (Just sco)) = sco : collectScopes t
+ collectScopes :: SourceType -> [SkolemScope]
+ collectScopes (ForAll _ _ t (Just sco)) = sco : collectScopes t
collectScopes ForAll{} = internalError "skolemEscapeCheck: No skolem scope"
collectScopes _ = []
-- Collect any skolem variables appearing in a type
- collectSkolems :: Type -> [(Text, SkolemScope, Maybe SourceSpan)]
+ collectSkolems :: SourceType -> [(SourceAnn, Text, SkolemScope)]
collectSkolems = everythingOnTypes (++) collect where
- collect (Skolem name _ scope srcSpan) = [(name, scope, srcSpan)]
+ collect (Skolem ss name _ scope) = [(ss, name, scope)]
collect _ = []
go scos _ = (scos, [])
skolemEscapeCheck _ = internalError "skolemEscapeCheck: untyped value"
diff --git a/src/Language/PureScript/TypeChecker/Subsumption.hs b/src/Language/PureScript/TypeChecker/Subsumption.hs
index 65d6a91..af5275d 100644
--- a/src/Language/PureScript/TypeChecker/Subsumption.hs
+++ b/src/Language/PureScript/TypeChecker/Subsumption.hs
@@ -61,8 +61,8 @@ defaultCoercion SNoElaborate = ()
-- | Check that one type subsumes another, rethrowing errors to provide a better error message
subsumes
:: (MonadError MultipleErrors m, MonadState CheckState m)
- => Type
- -> Type
+ => SourceType
+ -> SourceType
-> m (Expr -> Expr)
subsumes ty1 ty2 =
withErrorMessageHint (ErrorInSubsumption ty1 ty2) $
@@ -72,46 +72,46 @@ subsumes ty1 ty2 =
subsumes'
:: (MonadError MultipleErrors m, MonadState CheckState m)
=> ModeSing mode
- -> Type
- -> Type
+ -> SourceType
+ -> SourceType
-> m (Coercion mode)
-subsumes' mode (ForAll ident ty1 _) ty2 = do
+subsumes' mode (ForAll _ ident ty1 _) ty2 = do
replaced <- replaceVarWithUnknown ident ty1
subsumes' mode replaced ty2
-subsumes' mode ty1 (ForAll ident ty2 sco) =
+subsumes' mode ty1 (ForAll _ ident ty2 sco) =
case sco of
Just sco' -> do
sko <- newSkolemConstant
- let sk = skolemize ident sko sco' Nothing ty2
+ let sk = skolemize NullSourceAnn ident sko sco' ty2
subsumes' mode ty1 sk
Nothing -> internalError "subsumes: unspecified skolem scope"
-subsumes' mode (TypeApp (TypeApp f1 arg1) ret1) (TypeApp (TypeApp f2 arg2) ret2) | f1 == tyFunction && f2 == tyFunction = do
+subsumes' mode (TypeApp _ (TypeApp _ f1 arg1) ret1) (TypeApp _ (TypeApp _ f2 arg2) ret2) | eqType f1 tyFunction && eqType f2 tyFunction = do
subsumes' SNoElaborate arg2 arg1
subsumes' SNoElaborate ret1 ret2
-- Nothing was elaborated, return the default coercion
return (defaultCoercion mode)
-subsumes' mode (KindedType ty1 _) ty2 =
+subsumes' mode (KindedType _ ty1 _) ty2 =
subsumes' mode ty1 ty2
-subsumes' mode ty1 (KindedType ty2 _) =
+subsumes' mode ty1 (KindedType _ ty2 _) =
subsumes' mode ty1 ty2
-- Only check subsumption for constrained types when elaborating.
-- Otherwise fall back to unification.
-subsumes' SElaborate (ConstrainedType con ty1) ty2 = do
+subsumes' SElaborate (ConstrainedType _ con ty1) ty2 = do
dicts <- getTypeClassDictionaries
hints <- getHints
elaborate <- subsumes' SElaborate ty1 ty2
let addDicts val = App val (TypeClassDictionary con dicts hints)
return (elaborate . addDicts)
-subsumes' mode (TypeApp f1 r1) (TypeApp f2 r2) | f1 == tyRecord && f2 == tyRecord = do
+subsumes' mode (TypeApp _ f1 r1) (TypeApp _ f2 r2) | eqType f1 tyRecord && eqType f2 tyRecord = do
let (common, ((ts1', r1'), (ts2', r2'))) = alignRowsWith (subsumes' SNoElaborate) r1 r2
-- For { ts1 | r1 } to subsume { ts2 | r2 } when r1 is empty (= we're working with a closed row),
-- every property in ts2 must appear in ts1. If not, then the candidate expression is missing a required property.
-- Conversely, when r2 is empty, every property in ts1 must appear in ts2, or else the expression has
-- an additional property which is not allowed.
- when (r1' == REmpty)
- (for_ (firstMissingProp ts2' ts1') (throwError . errorMessage . PropertyIsMissing . fst))
- when (r2' == REmpty)
- (for_ (firstMissingProp ts1' ts2') (throwError . errorMessage . AdditionalProperty . fst))
+ when (eqType r1' $ REmpty ())
+ (for_ (firstMissingProp ts2' ts1') (throwError . errorMessage . PropertyIsMissing . rowListLabel))
+ when (eqType r2' $ REmpty ())
+ (for_ (firstMissingProp ts1' ts2') (throwError . errorMessage . AdditionalProperty . rowListLabel))
-- Check subsumption for common labels
sequence_ common
unifyTypes (rowFromList (ts1', r1')) (rowFromList (ts2', r2'))
@@ -119,8 +119,8 @@ subsumes' mode (TypeApp f1 r1) (TypeApp f2 r2) | f1 == tyRecord && f2 == tyRecor
return (defaultCoercion mode)
where
-- Find the first property that's in the first list (of tuples) but not in the second
- firstMissingProp t1 t2 = fst <$> uncons (minusBy' (comparing fst) t1 t2)
-subsumes' mode ty1 ty2@(TypeApp obj _) | obj == tyRecord =
+ firstMissingProp t1 t2 = fst <$> uncons (minusBy' (comparing rowListLabel) t1 t2)
+subsumes' mode ty1 ty2@(TypeApp _ obj _) | obj == tyRecord =
subsumes' mode ty2 ty1
subsumes' mode ty1 ty2 = do
unifyTypes ty1 ty2
diff --git a/src/Language/PureScript/TypeChecker/Synonyms.hs b/src/Language/PureScript/TypeChecker/Synonyms.hs
index 08016b2..7d5d250 100644
--- a/src/Language/PureScript/TypeChecker/Synonyms.hs
+++ b/src/Language/PureScript/TypeChecker/Synonyms.hs
@@ -24,19 +24,19 @@ import Language.PureScript.TypeChecker.Monad
import Language.PureScript.Types
-- | Type synonym information (arguments with kinds, aliased type), indexed by name
-type SynonymMap = M.Map (Qualified (ProperName 'TypeName)) ([(Text, Maybe Kind)], Type)
+type SynonymMap = M.Map (Qualified (ProperName 'TypeName)) ([(Text, Maybe SourceKind)], SourceType)
replaceAllTypeSynonyms'
:: SynonymMap
- -> Type
- -> Either MultipleErrors Type
+ -> SourceType
+ -> Either MultipleErrors SourceType
replaceAllTypeSynonyms' syns = everywhereOnTypesTopDownM try
where
- try :: Type -> Either MultipleErrors Type
+ try :: SourceType -> Either MultipleErrors SourceType
try t = fromMaybe t <$> go 0 [] t
- go :: Int -> [Type] -> Type -> Either MultipleErrors (Maybe Type)
- go c args (TypeConstructor ctor)
+ go :: Int -> [SourceType] -> SourceType -> Either MultipleErrors (Maybe SourceType)
+ go c args (TypeConstructor _ ctor)
| Just (synArgs, body) <- M.lookup ctor syns
, c == length synArgs
= let repl = replaceAllTypeVars (zip (map fst synArgs) args) body
@@ -44,11 +44,11 @@ replaceAllTypeSynonyms' syns = everywhereOnTypesTopDownM try
| Just (synArgs, _) <- M.lookup ctor syns
, length synArgs > c
= throwError . errorMessage $ PartiallyAppliedSynonym ctor
- go c args (TypeApp f arg) = go (c + 1) (arg : args) f
+ go c args (TypeApp _ f arg) = go (c + 1) (arg : args) f
go _ _ _ = return Nothing
-- | Replace fully applied type synonyms
-replaceAllTypeSynonyms :: (e ~ MultipleErrors, MonadState CheckState m, MonadError e m) => Type -> m Type
+replaceAllTypeSynonyms :: (e ~ MultipleErrors, MonadState CheckState m, MonadError e m) => SourceType -> m SourceType
replaceAllTypeSynonyms d = do
env <- getEnv
either throwError return $ replaceAllTypeSynonyms' (typeSynonyms env) d
@@ -57,6 +57,6 @@ replaceAllTypeSynonyms d = do
replaceAllTypeSynonymsM
:: MonadError MultipleErrors m
=> SynonymMap
- -> Type
- -> m Type
+ -> SourceType
+ -> m SourceType
replaceAllTypeSynonymsM syns = either throwError pure . replaceAllTypeSynonyms' syns
diff --git a/src/Language/PureScript/TypeChecker/TypeSearch.hs b/src/Language/PureScript/TypeChecker/TypeSearch.hs
index 225410a..a636e35 100644
--- a/src/Language/PureScript/TypeChecker/TypeSearch.hs
+++ b/src/Language/PureScript/TypeChecker/TypeSearch.hs
@@ -39,17 +39,17 @@ evalWriterT :: Monad m => WriterT b m r -> m r
evalWriterT m = liftM fst (runWriterT m)
checkSubsume
- :: Maybe [(P.Ident, Entailment.InstanceContext, P.Constraint)]
+ :: Maybe [(P.Ident, Entailment.InstanceContext, P.SourceConstraint)]
-- ^ Additional constraints we need to satisfy
-> P.Environment
-- ^ The Environment which contains the relevant definitions and typeclasses
-> TC.CheckState
-- ^ The typechecker state
- -> P.Type
+ -> P.SourceType
-- ^ The user supplied type
- -> P.Type
+ -> P.SourceType
-- ^ The type supplied by the environment
- -> Maybe ((P.Expr, [(P.Ident, Entailment.InstanceContext, P.Constraint)]), P.Environment)
+ -> Maybe ((P.Expr, [(P.Ident, Entailment.InstanceContext, P.SourceConstraint)]), P.Environment)
checkSubsume unsolved env st userT envT = checkInEnvironment env st $ do
let initializeSkolems =
Skolem.introduceSkolemScope
@@ -79,11 +79,11 @@ checkSubsume unsolved env st userT envT = checkInEnvironment env st $ do
Entailment.replaceTypeClassDictionaries (isJust unsolved) expP
accessorSearch
- :: Maybe [(P.Ident, Entailment.InstanceContext, P.Constraint)]
+ :: Maybe [(P.Ident, Entailment.InstanceContext, P.SourceConstraint)]
-> P.Environment
-> TC.CheckState
- -> P.Type
- -> ([(Label, P.Type)], [(Label, P.Type)])
+ -> P.SourceType
+ -> ([(Label, P.SourceType)], [(Label, P.SourceType)])
-- ^ (all accessors we found, all accessors we found that match the result type)
accessorSearch unsolved env st userT = maybe ([], []) fst $ checkInEnvironment env st $ do
let initializeSkolems =
@@ -95,28 +95,29 @@ accessorSearch unsolved env st userT = maybe ([], []) fst $ checkInEnvironment e
rowType <- freshType
resultType <- freshType
- let recordFunction = TypeApp (TypeApp tyFunction (TypeApp tyRecord rowType)) resultType
+ let recordFunction = srcTypeApp (srcTypeApp tyFunction (srcTypeApp tyRecord rowType)) resultType
_ <- subsumes recordFunction userT'
subst <- gets TC.checkSubstitution
- let solvedRow = fst (rowToList (substituteType subst rowType))
+ let solvedRow = toRowPair <$> fst (rowToList (substituteType subst rowType))
tcS <- get
pure (solvedRow, filter (\x -> checkAccessor tcS (substituteType subst resultType) x) solvedRow)
where
checkAccessor tcs x (_, type') = isJust (checkSubsume unsolved env tcs x type')
+ toRowPair (RowListItem _ lbl ty) = (lbl, ty)
typeSearch
- :: Maybe [(P.Ident, Entailment.InstanceContext, P.Constraint)]
+ :: Maybe [(P.Ident, Entailment.InstanceContext, P.SourceConstraint)]
-- ^ Additional constraints we need to satisfy
-> P.Environment
-- ^ The Environment which contains the relevant definitions and typeclasses
-> TC.CheckState
-- ^ The typechecker state
- -> P.Type
+ -> P.SourceType
-- ^ The type we are looking for
- -> ([(P.Qualified Text, P.Type)], Maybe [(Label, P.Type)])
+ -> ([(P.Qualified Text, P.SourceType)], Maybe [(Label, P.SourceType)])
typeSearch unsolved env st type' =
let
- runTypeSearch :: Map k P.Type -> Map k P.Type
+ runTypeSearch :: Map k P.SourceType -> Map k P.SourceType
runTypeSearch = Map.mapMaybe (\ty -> checkSubsume unsolved env st type' ty $> ty)
matchingNames = runTypeSearch (Map.map (\(ty, _, _) -> ty) (P.names env))
diff --git a/src/Language/PureScript/TypeChecker/Types.hs b/src/Language/PureScript/TypeChecker/Types.hs
index 51dac64..f372a69 100644
--- a/src/Language/PureScript/TypeChecker/Types.hs
+++ b/src/Language/PureScript/TypeChecker/Types.hs
@@ -75,7 +75,7 @@ typesOf
=> BindingGroupType
-> ModuleName
-> [((SourceAnn, Ident), Expr)]
- -> m [((SourceAnn, Ident), (Expr, Type))]
+ -> m [((SourceAnn, Ident), (Expr, SourceType))]
typesOf bindingGroupType moduleName vals = withFreshSubstitution $ do
(tys, wInfer) <- capturingSubstitution tidyUp $ do
(SplitBindingGroup untyped typed dict, w) <- withoutWarnings $ typeDictionaryForBindingGroup (Just moduleName) vals
@@ -144,26 +144,26 @@ typesOf bindingGroupType moduleName vals = withFreshSubstitution $ do
-- | Run type search to complete any typed hole error messages
runTypeSearch
- :: Maybe [(Ident, InstanceContext, Constraint)]
+ :: Maybe [(Ident, InstanceContext, SourceConstraint)]
-- ^ Any unsolved constraints which we need to continue to satisfy
-> CheckState
-- ^ The final type checker state
-> ErrorMessage
-> ErrorMessage
runTypeSearch cons st = \case
- ErrorMessage hints (HoleInferredType x ty y (TSBefore env)) ->
+ ErrorMessage hints (HoleInferredType x ty y (Just (TSBefore env))) ->
let subst = checkSubstitution st
searchResult = onTypeSearchTypes
(substituteType subst)
(uncurry TSAfter (typeSearch cons env st (substituteType subst ty)))
- in ErrorMessage hints (HoleInferredType x ty y searchResult)
+ in ErrorMessage hints (HoleInferredType x ty y (Just searchResult))
other -> other
-- | Generalize type vars using forall and add inferred constraints
generalize unsolved = varIfUnknown . constrain unsolved
-- | Add any unsolved constraints
- constrain cs ty = foldr ConstrainedType ty (map (\(_, _, x) -> x) cs)
+ constrain cs ty = foldr srcConstrainedType ty (map (\(_, _, x) -> x) cs)
-- Apply the substitution that was returned from runUnify to both types and (type-annotated) values
tidyUp ts sub = first (map (second (first (second (overTypes (substituteType sub) *** substituteType sub))))) ts
@@ -177,11 +177,11 @@ typesOf bindingGroupType moduleName vals = withFreshSubstitution $ do
--
-- This structure breaks down a binding group into typed and untyped parts.
data SplitBindingGroup = SplitBindingGroup
- { _splitBindingGroupUntyped :: [((SourceAnn, Ident), (Expr, Type))]
+ { _splitBindingGroupUntyped :: [((SourceAnn, Ident), (Expr, SourceType))]
-- ^ The untyped expressions
- , _splitBindingGroupTyped :: [((SourceAnn, Ident), (Expr, Type, Bool))]
+ , _splitBindingGroupTyped :: [((SourceAnn, Ident), (Expr, SourceType, Bool))]
-- ^ The typed expressions, along with their type annotations
- , _splitBindingGroupNames :: M.Map (Qualified Ident) (Type, NameKind, NameVisibility)
+ , _splitBindingGroupNames :: M.Map (Qualified Ident) (SourceType, NameKind, NameVisibility)
-- ^ A map containing all expressions and their assigned types (which might be
-- fresh unification variables). These will be added to the 'Environment' after
-- the binding group is checked, so the value type of the 'Map' is chosen to be
@@ -218,7 +218,7 @@ typeDictionaryForBindingGroup moduleName vals = do
where
-- | Check if a value contains a type annotation, and if so, separate it
-- from the value itself.
- splitTypeAnnotation :: (a, Expr) -> Either (a, Expr) (a, (Expr, Type, Bool))
+ splitTypeAnnotation :: (a, Expr) -> Either (a, Expr) (a, (Expr, SourceType, Bool))
splitTypeAnnotation (a, TypedValue checkType value ty) = Right (a, (value, ty, checkType))
splitTypeAnnotation (a, PositionedValue pos c value) =
bimap (second (PositionedValue pos c))
@@ -230,11 +230,11 @@ typeDictionaryForBindingGroup moduleName vals = do
checkTypedBindingGroupElement
:: (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m)
=> ModuleName
- -> ((SourceAnn, Ident), (Expr, Type, Bool))
+ -> ((SourceAnn, Ident), (Expr, SourceType, Bool))
-- ^ The identifier we are trying to define, along with the expression and its type annotation
- -> M.Map (Qualified Ident) (Type, NameKind, NameVisibility)
+ -> M.Map (Qualified Ident) (SourceType, NameKind, NameVisibility)
-- ^ Names brought into scope in this binding group
- -> m ((SourceAnn, Ident), (Expr, Type))
+ -> m ((SourceAnn, Ident), (Expr, SourceType))
checkTypedBindingGroupElement mn (ident, (val, ty, checkType)) dict = do
-- Kind check
(kind, args) <- kindOfWithScopedVars ty
@@ -251,12 +251,12 @@ checkTypedBindingGroupElement mn (ident, (val, ty, checkType)) dict = do
-- | Infer a type for a value in a binding group which lacks an annotation.
typeForBindingGroupElement
:: (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m)
- => ((SourceAnn, Ident), (Expr, Type))
+ => ((SourceAnn, Ident), (Expr, SourceType))
-- ^ The identifier we are trying to define, along with the expression and its assigned type
-- (at this point, this should be a unification variable)
- -> M.Map (Qualified Ident) (Type, NameKind, NameVisibility)
+ -> M.Map (Qualified Ident) (SourceType, NameKind, NameVisibility)
-- ^ Names brought into scope in this binding group
- -> m ((SourceAnn, Ident), (Expr, Type))
+ -> m ((SourceAnn, Ident), (Expr, SourceType))
typeForBindingGroupElement (ident, (val, ty)) dict = do
-- Infer the type with the new names in scope
TypedValue _ val' ty' <- bindNames dict $ infer val
@@ -267,10 +267,10 @@ typeForBindingGroupElement (ident, (val, ty)) dict = do
-- | Check the kind of a type, failing if it is not of kind *.
checkTypeKind
:: MonadError MultipleErrors m
- => Type
- -> Kind
+ => SourceType
+ -> SourceKind
-> m ()
-checkTypeKind ty kind = guardWith (errorMessage (ExpectedType ty kind)) $ kind == kindType
+checkTypeKind ty kind = guardWith (errorMessage (ExpectedType ty kind)) $ isKindType kind
-- | Remove any ForAlls and ConstrainedType constructors in a type by introducing new unknowns
-- or TypeClassDictionary values.
@@ -280,12 +280,12 @@ checkTypeKind ty kind = guardWith (errorMessage (ExpectedType ty kind)) $ kind =
instantiatePolyTypeWithUnknowns
:: (MonadState CheckState m, MonadError MultipleErrors m)
=> Expr
- -> Type
- -> m (Expr, Type)
-instantiatePolyTypeWithUnknowns val (ForAll ident ty _) = do
+ -> SourceType
+ -> m (Expr, SourceType)
+instantiatePolyTypeWithUnknowns val (ForAll _ ident ty _) = do
ty' <- replaceVarWithUnknown ident ty
instantiatePolyTypeWithUnknowns val ty'
-instantiatePolyTypeWithUnknowns val (ConstrainedType con ty) = do
+instantiatePolyTypeWithUnknowns val (ConstrainedType _ con ty) = do
dicts <- getTypeClassDictionaries
hints <- getHints
instantiatePolyTypeWithUnknowns (App val (TypeClassDictionary con dicts hints)) ty
@@ -316,7 +316,7 @@ infer' (Literal ss (ArrayLiteral vals)) = do
(val', t') <- instantiatePolyTypeWithUnknowns val t
unifyTypes els t'
return (TypedValue ch val' t')
- return $ TypedValue True (Literal ss (ArrayLiteral ts')) (TypeApp tyArray els)
+ return $ TypedValue True (Literal ss (ArrayLiteral ts')) (srcTypeApp tyArray els)
infer' (Literal ss (ObjectLiteral ps)) = do
ensureNoDuplicateProperties ps
-- We make a special case for Vars in record labels, since these are the
@@ -327,29 +327,33 @@ infer' (Literal ss (ObjectLiteral ps)) = do
shouldInstantiate (PositionedValue _ _ e) = shouldInstantiate e
shouldInstantiate _ = False
- inferProperty :: (PSString, Expr) -> m (PSString, (Expr, Type))
+ inferProperty :: (PSString, Expr) -> m (PSString, (Expr, SourceType))
inferProperty (name, val) = do
TypedValue _ val' ty <- infer val
valAndType <- if shouldInstantiate val
then instantiatePolyTypeWithUnknowns val' ty
else pure (val', ty)
pure (name, valAndType)
+
+ toRowListItem (lbl, (_, ty)) = srcRowListItem (Label lbl) ty
+
fields <- forM ps inferProperty
- let ty = TypeApp tyRecord $ rowFromList (map (Label *** snd) fields, REmpty)
+ let ty = srcTypeApp tyRecord $ rowFromList (map toRowListItem fields, srcREmpty)
return $ TypedValue True (Literal ss (ObjectLiteral (map (fmap (uncurry (TypedValue True))) fields))) ty
infer' (ObjectUpdate o ps) = do
ensureNoDuplicateProperties ps
row <- freshType
newVals <- zipWith (\(name, _) t -> (name, t)) ps <$> traverse (infer . snd) ps
+ let toRowListItem = uncurry srcRowListItem
let newTys = map (\(name, TypedValue _ _ ty) -> (Label name, ty)) newVals
oldTys <- zip (map (Label . fst) ps) <$> replicateM (length ps) freshType
- let oldTy = TypeApp tyRecord $ rowFromList (oldTys, row)
+ let oldTy = srcTypeApp tyRecord $ rowFromList (toRowListItem <$> oldTys, row)
o' <- TypedValue True <$> check o oldTy <*> pure oldTy
- return $ TypedValue True (ObjectUpdate o' newVals) $ TypeApp tyRecord $ rowFromList (newTys, row)
+ return $ TypedValue True (ObjectUpdate o' newVals) $ srcTypeApp tyRecord $ rowFromList (toRowListItem <$> newTys, row)
infer' (Accessor prop val) = withErrorMessageHint (ErrorCheckingAccessor val prop) $ do
field <- freshType
rest <- freshType
- typed <- check val (TypeApp tyRecord (RCons (Label prop) field rest))
+ typed <- check val (srcTypeApp tyRecord (srcRCons (Label prop) field rest))
return $ TypedValue True (Accessor prop typed) field
infer' (Abs binder ret)
| VarBinder ss arg <- binder = do
@@ -367,7 +371,7 @@ infer' (Var ss var) = do
checkVisibility var
ty <- introduceSkolemScope <=< replaceAllTypeSynonyms <=< replaceTypeWildcards <=< lookupVariable $ var
case ty of
- ConstrainedType con ty' -> do
+ ConstrainedType _ con ty' -> do
dicts <- getTypeClassDictionaries
hints <- getHints
return $ TypedValue True (App (Var ss var) (TypeClassDictionary con dicts hints)) ty'
@@ -398,8 +402,8 @@ infer' (DeferredDictionary className tys) = do
dicts <- getTypeClassDictionaries
hints <- getHints
return $ TypedValue False
- (TypeClassDictionary (Constraint className tys Nothing) dicts hints)
- (foldl TypeApp (TypeConstructor (fmap coerceProperName className)) tys)
+ (TypeClassDictionary (srcConstraint className tys Nothing) dicts hints)
+ (foldl srcTypeApp (srcTypeConstructor (fmap coerceProperName className)) tys)
infer' (TypedValue checkType val ty) = do
Just moduleName <- checkCurrentModule <$> get
(kind, args) <- kindOfWithScopedVars ty
@@ -411,7 +415,7 @@ infer' (Hole name) = do
ty <- freshType
ctx <- getLocalContext
env <- getEnv
- tell . errorMessage $ HoleInferredType name ty ctx (TSBefore env)
+ tell . errorMessage $ HoleInferredType name ty ctx . Just $ TSBefore env
return $ TypedValue True (Hole name) ty
infer' (PositionedValue pos c val) = warnAndRethrowWithPositionTC pos $ do
TypedValue t v ty <- infer' val
@@ -426,24 +430,24 @@ inferLetBinding
-> (Expr -> m Expr)
-> m ([Declaration], Expr)
inferLetBinding seen [] ret j = (,) seen <$> withBindingGroupVisible (j ret)
-inferLetBinding seen (ValueDecl sa@(ss, _) ident nameKind [] [MkUnguarded tv@(TypedValue checkType val ty)] : rest) ret j =
- warnAndRethrowWithPositionTC ss $ do
- Just moduleName <- checkCurrentModule <$> get
+inferLetBinding seen (ValueDecl sa@(ss, _) ident nameKind [] [MkUnguarded tv@(TypedValue checkType val ty)] : rest) ret j = do
+ Just moduleName <- checkCurrentModule <$> get
+ TypedValue _ val' ty'' <- warnAndRethrowWithPositionTC ss $ do
(kind, args) <- kindOfWithScopedVars ty
checkTypeKind ty kind
let dict = M.singleton (Qualified Nothing ident) (ty, nameKind, Undefined)
ty' <- introduceSkolemScope <=< replaceAllTypeSynonyms <=< replaceTypeWildcards $ ty
- TypedValue _ val' ty'' <- if checkType then withScopedTypeVars moduleName args (bindNames dict (check val ty')) else return tv
- bindNames (M.singleton (Qualified Nothing ident) (ty'', nameKind, Defined))
- $ inferLetBinding (seen ++ [ValueDecl sa ident nameKind [] [MkUnguarded (TypedValue checkType val' ty'')]]) rest ret j
-inferLetBinding seen (ValueDecl sa@(ss, _) ident nameKind [] [MkUnguarded val] : rest) ret j =
- warnAndRethrowWithPositionTC ss $ do
- valTy <- freshType
+ if checkType then withScopedTypeVars moduleName args (bindNames dict (check val ty')) else return tv
+ bindNames (M.singleton (Qualified Nothing ident) (ty'', nameKind, Defined))
+ $ inferLetBinding (seen ++ [ValueDecl sa ident nameKind [] [MkUnguarded (TypedValue checkType val' ty'')]]) rest ret j
+inferLetBinding seen (ValueDecl sa@(ss, _) ident nameKind [] [MkUnguarded val] : rest) ret j = do
+ valTy <- freshType
+ TypedValue _ val' valTy' <- warnAndRethrowWithPositionTC ss $ do
let dict = M.singleton (Qualified Nothing ident) (valTy, nameKind, Undefined)
- TypedValue _ val' valTy' <- bindNames dict $ infer val
- unifyTypes valTy valTy'
- bindNames (M.singleton (Qualified Nothing ident) (valTy', nameKind, Defined))
- $ inferLetBinding (seen ++ [ValueDecl sa ident nameKind [] [MkUnguarded val']]) rest ret j
+ bindNames dict $ infer val
+ warnAndRethrowWithPositionTC ss $ unifyTypes valTy valTy'
+ bindNames (M.singleton (Qualified Nothing ident) (valTy', nameKind, Defined))
+ $ inferLetBinding (seen ++ [ValueDecl sa ident nameKind [] [MkUnguarded val']]) rest ret j
inferLetBinding seen (BindingGroupDeclaration ds : rest) ret j = do
Just moduleName <- checkCurrentModule <$> get
SplitBindingGroup untyped typed dict <- typeDictionaryForBindingGroup Nothing . NEL.toList $ fmap (\(i, _, v) -> (i, v)) ds
@@ -459,9 +463,9 @@ inferLetBinding _ _ _ _ = internalError "Invalid argument to inferLetBinding"
inferBinder
:: forall m
. (MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m)
- => Type
+ => SourceType
-> Binder
- -> m (M.Map Ident Type)
+ -> m (M.Map Ident SourceType)
inferBinder _ NullBinder = return M.empty
inferBinder val (LiteralBinder _ (StringLiteral _)) = unifyTypes val tyString >> return M.empty
inferBinder val (LiteralBinder _ (CharLiteral _)) = unifyTypes val tyChar >> return M.empty
@@ -483,29 +487,29 @@ inferBinder val (ConstructorBinder ss ctor binders) = do
M.unions <$> zipWithM inferBinder (reverse args) binders
_ -> throwError . errorMessage' ss . UnknownName . fmap DctorName $ ctor
where
- peelArgs :: Type -> ([Type], Type)
+ peelArgs :: Type a -> ([Type a], Type a)
peelArgs = go []
where
- go args (TypeApp (TypeApp fn arg) ret) | fn == tyFunction = go (arg : args) ret
+ go args (TypeApp _ (TypeApp _ fn arg) ret) | eqType fn tyFunction = go (arg : args) ret
go args ret = (args, ret)
inferBinder val (LiteralBinder _ (ObjectLiteral props)) = do
row <- freshType
rest <- freshType
m1 <- inferRowProperties row rest props
- unifyTypes val (TypeApp tyRecord row)
+ unifyTypes val (srcTypeApp tyRecord row)
return m1
where
- inferRowProperties :: Type -> Type -> [(PSString, Binder)] -> m (M.Map Ident Type)
+ inferRowProperties :: SourceType -> SourceType -> [(PSString, Binder)] -> m (M.Map Ident SourceType)
inferRowProperties nrow row [] = unifyTypes nrow row >> return M.empty
inferRowProperties nrow row ((name, binder):binders) = do
propTy <- freshType
m1 <- inferBinder propTy binder
- m2 <- inferRowProperties nrow (RCons (Label name) propTy row) binders
+ m2 <- inferRowProperties nrow (srcRCons (Label name) propTy row) binders
return $ m1 `M.union` m2
inferBinder val (LiteralBinder _ (ArrayLiteral binders)) = do
el <- freshType
m1 <- M.unions <$> traverse (inferBinder el) binders
- unifyTypes val (TypeApp tyArray el)
+ unifyTypes val (srcTypeApp tyArray el)
return m1
inferBinder val (NamedBinder ss name binder) =
warnAndRethrowWithPositionTC ss $ do
@@ -541,7 +545,7 @@ instantiateForBinders
:: (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m)
=> [Expr]
-> [CaseAlternative]
- -> m ([Expr], [Type])
+ -> m ([Expr], [SourceType])
instantiateForBinders vals cas = unzip <$> zipWithM (\val inst -> do
TypedValue _ val' ty <- infer val
if inst
@@ -556,8 +560,8 @@ instantiateForBinders vals cas = unzip <$> zipWithM (\val inst -> do
--
checkBinders
:: (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m)
- => [Type]
- -> Type
+ => [SourceType]
+ -> SourceType
-> [CaseAlternative]
-> m [CaseAlternative]
checkBinders _ _ [] = return []
@@ -573,7 +577,7 @@ checkBinders nvals ret (CaseAlternative binders result : bs) = do
checkGuardedRhs
:: (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m)
=> GuardedExpr
- -> Type
+ -> SourceType
-> m GuardedExpr
checkGuardedRhs (GuardedExpr [] rhs) ret = do
rhs' <- TypedValue True <$> check rhs ret <*> pure ret
@@ -597,7 +601,7 @@ checkGuardedRhs (GuardedExpr (PatternGuard binder expr : guards) rhs) ret = do
check
:: (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m)
=> Expr
- -> Type
+ -> SourceType
-> m Expr
check val ty = withErrorMessageHint (ErrorCheckingType val ty) $ check' val ty
@@ -608,24 +612,24 @@ check'
:: forall m
. (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m)
=> Expr
- -> Type
+ -> SourceType
-> m Expr
-check' val (ForAll ident ty _) = do
+check' val (ForAll ann ident ty _) = do
scope <- newSkolemScope
sko <- newSkolemConstant
let ss = case val of
- PositionedValue pos _ _ -> Just pos
- _ -> Nothing
- sk = skolemize ident sko scope ss ty
- skVal = skolemizeTypesInValue ident sko scope ss val
+ PositionedValue pos c _ -> (pos, c)
+ _ -> NullSourceAnn
+ sk = skolemize ss ident sko scope ty
+ skVal = skolemizeTypesInValue ss ident sko scope val
val' <- check skVal sk
- return $ TypedValue True val' (ForAll ident ty (Just scope))
-check' val t@(ConstrainedType con@(Constraint (Qualified _ (ProperName className)) _ _) ty) = do
+ return $ TypedValue True val' (ForAll ann ident ty (Just scope))
+check' val t@(ConstrainedType _ con@(Constraint _ (Qualified _ (ProperName className)) _ _) ty) = do
dictName <- freshIdent ("dict" <> className)
dicts <- newDictionaries [] (Qualified Nothing dictName) con
val' <- withBindingGroupVisible $ withTypeClassDictionaries dicts $ check val ty
return $ TypedValue True (Abs (VarBinder nullSourceSpan dictName) val') t
-check' val u@(TUnknown _) = do
+check' val u@(TUnknown _ _) = do
val'@(TypedValue _ _ ty) <- infer val
-- Don't unify an unknown with an inferred polytype
(val'', ty') <- instantiatePolyTypeWithUnknowns val' ty
@@ -641,11 +645,11 @@ check' v@(Literal _ (CharLiteral _)) t | t == tyChar =
return $ TypedValue True v t
check' v@(Literal _ (BooleanLiteral _)) t | t == tyBoolean =
return $ TypedValue True v t
-check' (Literal ss (ArrayLiteral vals)) t@(TypeApp a ty) = do
+check' (Literal ss (ArrayLiteral vals)) t@(TypeApp _ a ty) = do
unifyTypes a tyArray
array <- Literal ss . ArrayLiteral <$> forM vals (`check` ty)
return $ TypedValue True array t
-check' (Abs binder ret) ty@(TypeApp (TypeApp t argTy) retTy)
+check' (Abs binder ret) ty@(TypeApp _ (TypeApp _ t argTy) retTy)
| VarBinder ss arg <- binder = do
unifyTypes t tyFunction
ret' <- withBindingGroupVisible $ bindLocalVariables [(arg, argTy, Defined)] $ check ret retTy
@@ -672,7 +676,7 @@ check' (DeferredDictionary className tys) ty = do
dicts <- getTypeClassDictionaries
hints <- getHints
return $ TypedValue False
- (TypeClassDictionary (Constraint className tys Nothing) dicts hints)
+ (TypeClassDictionary (srcConstraint className tys Nothing) dicts hints)
ty
check' (TypedValue checkType val ty1) ty2 = do
kind <- kindOf ty1
@@ -693,26 +697,26 @@ check' (IfThenElse cond th el) ty = do
th' <- check th ty
el' <- check el ty
return $ TypedValue True (IfThenElse cond' th' el') ty
-check' e@(Literal ss (ObjectLiteral ps)) t@(TypeApp obj row) | obj == tyRecord = do
+check' e@(Literal ss (ObjectLiteral ps)) t@(TypeApp _ obj row) | obj == tyRecord = do
ensureNoDuplicateProperties ps
ps' <- checkProperties e ps row False
return $ TypedValue True (Literal ss (ObjectLiteral ps')) t
check' (TypeClassDictionaryConstructorApp name ps) t = do
ps' <- check' ps t
return $ TypedValue True (TypeClassDictionaryConstructorApp name ps') t
-check' e@(ObjectUpdate obj ps) t@(TypeApp o row) | o == tyRecord = do
+check' e@(ObjectUpdate obj ps) t@(TypeApp _ o row) | o == tyRecord = do
ensureNoDuplicateProperties ps
-- We need to be careful to avoid duplicate labels here.
-- We check _obj_ against the type _t_ with the types in _ps_ replaced with unknowns.
let (propsToCheck, rest) = rowToList row
- (removedProps, remainingProps) = partition (\(p, _) -> p `elem` map (Label . fst) ps) propsToCheck
- us <- zip (map fst removedProps) <$> replicateM (length ps) freshType
- obj' <- check obj (TypeApp tyRecord (rowFromList (us ++ remainingProps, rest)))
+ (removedProps, remainingProps) = partition (\(RowListItem _ p _) -> p `elem` map (Label . fst) ps) propsToCheck
+ us <- zipWith srcRowListItem (map rowListLabel removedProps) <$> replicateM (length ps) freshType
+ obj' <- check obj (srcTypeApp tyRecord (rowFromList (us ++ remainingProps, rest)))
ps' <- checkProperties e ps row True
return $ TypedValue True (ObjectUpdate obj' ps') t
check' (Accessor prop val) ty = withErrorMessageHint (ErrorCheckingAccessor val prop) $ do
rest <- freshType
- val' <- check val (TypeApp tyRecord (RCons (Label prop) ty rest))
+ val' <- check val (srcTypeApp tyRecord (srcRCons (Label prop) ty rest))
return $ TypedValue True (Accessor prop val') ty
check' v@(Constructor _ c) ty = do
env <- getEnv
@@ -726,7 +730,7 @@ check' v@(Constructor _ c) ty = do
check' (Let w ds val) ty = do
(ds', val') <- inferLetBinding [] ds val (`check` ty)
return $ TypedValue True (Let w ds' val') ty
-check' val kt@(KindedType ty kind) = do
+check' val kt@(KindedType _ ty kind) = do
checkTypeKind ty kind
val' <- check' val ty
return $ TypedValue True val' kt
@@ -747,32 +751,33 @@ checkProperties
:: (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m)
=> Expr
-> [(PSString, Expr)]
- -> Type
+ -> SourceType
-> Bool
-> m [(PSString, Expr)]
-checkProperties expr ps row lax = let (ts, r') = rowToList row in go ps ts r' where
- go [] [] REmpty = return []
- go [] [] u@(TUnknown _)
+checkProperties expr ps row lax = let (ts, r') = rowToList row in go ps (toRowPair <$> ts) r' where
+ toRowPair (RowListItem _ lbl ty) = (lbl, ty)
+ go [] [] (REmpty _) = return []
+ go [] [] u@(TUnknown _ _)
| lax = return []
- | otherwise = do unifyTypes u REmpty
+ | otherwise = do unifyTypes u srcREmpty
return []
go [] [] Skolem{} | lax = return []
go [] ((p, _): _) _ | lax = return []
| otherwise = throwError . errorMessage $ PropertyIsMissing p
- go ((p,_):_) [] REmpty = throwError . errorMessage $ AdditionalProperty $ Label p
+ go ((p,_):_) [] (REmpty _) = throwError . errorMessage $ AdditionalProperty $ Label p
go ((p,v):ps') ts r =
case lookup (Label p) ts of
Nothing -> do
v'@(TypedValue _ _ ty) <- infer v
rest <- freshType
- unifyTypes r (RCons (Label p) ty rest)
+ unifyTypes r (srcRCons (Label p) ty rest)
ps'' <- go ps' ts rest
return $ (p, v') : ps''
Just ty -> do
v' <- check v ty
ps'' <- go ps' (delete (Label p, ty) ts) r
return $ (p, v') : ps''
- go _ _ _ = throwError . errorMessage $ ExprDoesNotHaveType expr (TypeApp tyRecord row)
+ go _ _ _ = throwError . errorMessage $ ExprDoesNotHaveType expr (srcTypeApp tyRecord row)
-- | Check the type of a function application, rethrowing errors to provide a better error message.
--
@@ -791,11 +796,11 @@ checkFunctionApplication
:: (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m)
=> Expr
-- ^ The function expression
- -> Type
+ -> SourceType
-- ^ The type of the function
-> Expr
-- ^ The argument expression
- -> m (Type, Expr)
+ -> m (SourceType, Expr)
-- ^ The result type, and the elaborated term
checkFunctionApplication fn fnTy arg = withErrorMessageHint (ErrorInApplication fn fnTy arg) $ do
subst <- gets checkSubstitution
@@ -805,19 +810,19 @@ checkFunctionApplication fn fnTy arg = withErrorMessageHint (ErrorInApplication
checkFunctionApplication'
:: (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m)
=> Expr
- -> Type
+ -> SourceType
-> Expr
- -> m (Type, Expr)
-checkFunctionApplication' fn (TypeApp (TypeApp tyFunction' argTy) retTy) arg = do
+ -> m (SourceType, Expr)
+checkFunctionApplication' fn (TypeApp _ (TypeApp _ tyFunction' argTy) retTy) arg = do
unifyTypes tyFunction' tyFunction
arg' <- check arg argTy
return (retTy, App fn arg')
-checkFunctionApplication' fn (ForAll ident ty _) arg = do
+checkFunctionApplication' fn (ForAll _ ident ty _) arg = do
replaced <- replaceVarWithUnknown ident ty
checkFunctionApplication fn replaced arg
-checkFunctionApplication' fn (KindedType ty _) arg =
+checkFunctionApplication' fn (KindedType _ ty _) arg =
checkFunctionApplication fn ty arg
-checkFunctionApplication' fn (ConstrainedType con fnTy) arg = do
+checkFunctionApplication' fn (ConstrainedType _ con fnTy) arg = do
dicts <- getTypeClassDictionaries
hints <- getHints
checkFunctionApplication' (App fn (TypeClassDictionary con dicts hints)) fnTy arg
diff --git a/src/Language/PureScript/TypeChecker/Unify.hs b/src/Language/PureScript/TypeChecker/Unify.hs
index 04186db..19bf3e6 100644
--- a/src/Language/PureScript/TypeChecker/Unify.hs
+++ b/src/Language/PureScript/TypeChecker/Unify.hs
@@ -17,7 +17,6 @@ module Language.PureScript.TypeChecker.Unify
) where
import Prelude.Compat
-import Protolude (ordNub)
import Control.Arrow (first, second)
import Control.Monad
@@ -25,8 +24,10 @@ import Control.Monad.Error.Class (MonadError(..))
import Control.Monad.State.Class (MonadState(..), gets, modify)
import Control.Monad.Writer.Class (MonadWriter(..))
-import Data.List (sort)
+import Data.Function (on)
+import Data.List (sortBy, nubBy)
import qualified Data.Map as M
+import Data.Ord (comparing)
import Data.Text (Text)
import qualified Data.Text as T
@@ -34,18 +35,17 @@ import Language.PureScript.Crash
import Language.PureScript.Errors
import Language.PureScript.TypeChecker.Monad
import Language.PureScript.TypeChecker.Skolems
-import Language.PureScript.Label (Label(..))
import Language.PureScript.Types
-- | Generate a fresh type variable
-freshType :: (MonadState CheckState m) => m Type
+freshType :: (MonadState CheckState m) => m SourceType
freshType = do
t <- gets checkNextType
modify $ \st -> st { checkNextType = t + 1 }
- return $ TUnknown t
+ return $ srcTUnknown t
-- | Update the substitution to solve a type constraint
-solveType :: (MonadError MultipleErrors m, MonadState CheckState m) => Int -> Type -> m ()
+solveType :: (MonadError MultipleErrors m, MonadState CheckState m) => Int -> SourceType -> m ()
solveType u t = do
occursCheck u t
modify $ \cs -> cs { checkSubstitution =
@@ -55,69 +55,69 @@ solveType u t = do
}
-- | Apply a substitution to a type
-substituteType :: Substitution -> Type -> Type
+substituteType :: Substitution -> SourceType -> SourceType
substituteType sub = everywhereOnTypes go
where
- go (TUnknown u) =
+ go (TUnknown ann u) =
case M.lookup u (substType sub) of
- Nothing -> TUnknown u
- Just (TUnknown u1) | u1 == u -> TUnknown u1
+ Nothing -> TUnknown ann u
+ Just (TUnknown ann' u1) | u1 == u -> TUnknown ann' u1
Just t -> substituteType sub t
go other = other
-- | Make sure that an unknown does not occur in a type
-occursCheck :: (MonadError MultipleErrors m) => Int -> Type -> m ()
+occursCheck :: (MonadError MultipleErrors m) => Int -> SourceType -> m ()
occursCheck _ TUnknown{} = return ()
occursCheck u t = void $ everywhereOnTypesM go t
where
- go (TUnknown u') | u == u' = throwError . errorMessage . InfiniteType $ t
+ go (TUnknown _ u') | u == u' = throwError . errorMessage . InfiniteType $ t
go other = return other
-- | Compute a list of all unknowns appearing in a type
-unknownsInType :: Type -> [Int]
+unknownsInType :: Type a -> [(a, Int)]
unknownsInType t = everythingOnTypes (.) go t []
where
- go :: Type -> [Int] -> [Int]
- go (TUnknown u) = (u :)
+ go :: Type a -> [(a, Int)] -> [(a, Int)]
+ go (TUnknown ann u) = ((ann, u) :)
go _ = id
-- | Unify two types, updating the current substitution
-unifyTypes :: (MonadError MultipleErrors m, MonadState CheckState m) => Type -> Type -> m ()
+unifyTypes :: (MonadError MultipleErrors m, MonadState CheckState m) => SourceType -> SourceType -> m ()
unifyTypes t1 t2 = do
sub <- gets checkSubstitution
withErrorMessageHint (ErrorUnifyingTypes t1 t2) $ unifyTypes' (substituteType sub t1) (substituteType sub t2)
where
- unifyTypes' (TUnknown u1) (TUnknown u2) | u1 == u2 = return ()
- unifyTypes' (TUnknown u) t = solveType u t
- unifyTypes' t (TUnknown u) = solveType u t
- unifyTypes' (ForAll ident1 ty1 sc1) (ForAll ident2 ty2 sc2) =
+ unifyTypes' (TUnknown _ u1) (TUnknown _ u2) | u1 == u2 = return ()
+ unifyTypes' (TUnknown _ u) t = solveType u t
+ unifyTypes' t (TUnknown _ u) = solveType u t
+ unifyTypes' (ForAll ann1 ident1 ty1 sc1) (ForAll ann2 ident2 ty2 sc2) =
case (sc1, sc2) of
(Just sc1', Just sc2') -> do
sko <- newSkolemConstant
- let sk1 = skolemize ident1 sko sc1' Nothing ty1
- let sk2 = skolemize ident2 sko sc2' Nothing ty2
+ let sk1 = skolemize ann1 ident1 sko sc1' ty1
+ let sk2 = skolemize ann2 ident2 sko sc2' ty2
sk1 `unifyTypes` sk2
_ -> internalError "unifyTypes: unspecified skolem scope"
- unifyTypes' (ForAll ident ty1 (Just sc)) ty2 = do
+ unifyTypes' (ForAll ann ident ty1 (Just sc)) ty2 = do
sko <- newSkolemConstant
- let sk = skolemize ident sko sc Nothing ty1
+ let sk = skolemize ann ident sko sc ty1
sk `unifyTypes` ty2
unifyTypes' ForAll{} _ = internalError "unifyTypes: unspecified skolem scope"
unifyTypes' ty f@ForAll{} = f `unifyTypes` ty
- unifyTypes' (TypeVar v1) (TypeVar v2) | v1 == v2 = return ()
- unifyTypes' ty1@(TypeConstructor c1) ty2@(TypeConstructor c2) =
+ unifyTypes' (TypeVar _ v1) (TypeVar _ v2) | v1 == v2 = return ()
+ unifyTypes' ty1@(TypeConstructor _ c1) ty2@(TypeConstructor _ c2) =
guardWith (errorMessage (TypesDoNotUnify ty1 ty2)) (c1 == c2)
- unifyTypes' (TypeLevelString s1) (TypeLevelString s2) | s1 == s2 = return ()
- unifyTypes' (TypeApp t3 t4) (TypeApp t5 t6) = do
+ unifyTypes' (TypeLevelString _ s1) (TypeLevelString _ s2) | s1 == s2 = return ()
+ unifyTypes' (TypeApp _ t3 t4) (TypeApp _ t5 t6) = do
t3 `unifyTypes` t5
t4 `unifyTypes` t6
- unifyTypes' (Skolem _ s1 _ _) (Skolem _ s2 _ _) | s1 == s2 = return ()
- unifyTypes' (KindedType ty1 _) ty2 = ty1 `unifyTypes` ty2
- unifyTypes' ty1 (KindedType ty2 _) = ty1 `unifyTypes` ty2
+ unifyTypes' (Skolem _ _ s1 _) (Skolem _ _ s2 _) | s1 == s2 = return ()
+ unifyTypes' (KindedType _ ty1 _) ty2 = ty1 `unifyTypes` ty2
+ unifyTypes' ty1 (KindedType _ ty2 _) = ty1 `unifyTypes` ty2
unifyTypes' r1@RCons{} r2 = unifyRows r1 r2
unifyTypes' r1 r2@RCons{} = unifyRows r1 r2
- unifyTypes' r1@REmpty r2 = unifyRows r1 r2
- unifyTypes' r1 r2@REmpty = unifyRows r1 r2
+ unifyTypes' r1@REmpty{} r2 = unifyRows r1 r2
+ unifyTypes' r1 r2@REmpty{} = unifyRows r1 r2
unifyTypes' ty1@ConstrainedType{} ty2 =
throwError . errorMessage $ ConstrainedTypeUnified ty1 ty2
unifyTypes' t3 t4@ConstrainedType{} = unifyTypes' t4 t3
@@ -132,38 +132,38 @@ unifyTypes t1 t2 = do
--
-- Note: importantly, we preserve the order of the types with a given label.
alignRowsWith
- :: (Type -> Type -> a)
- -> Type
- -> Type
- -> ([a], (([(Label, Type)], Type), ([(Label, Type)], Type)))
+ :: (Type a -> Type a -> r)
+ -> Type a
+ -> Type a
+ -> ([r], (([RowListItem a], Type a), ([RowListItem a], Type a)))
alignRowsWith f ty1 ty2 = go s1 s2 where
(s1, tail1) = rowToSortedList ty1
(s2, tail2) = rowToSortedList ty2
go [] r = ([], (([], tail1), (r, tail2)))
go r [] = ([], ((r, tail1), ([], tail2)))
- go lhs@((l1, t1) : r1) rhs@((l2, t2) : r2)
- | l1 < l2 = (second . first . first) ((l1, t1) :) (go r1 rhs)
- | l2 < l1 = (second . second . first) ((l2, t2) :) (go lhs r2)
+ go lhs@(RowListItem a1 l1 t1 : r1) rhs@(RowListItem a2 l2 t2 : r2)
+ | l1 < l2 = (second . first . first) (RowListItem a1 l1 t1 :) (go r1 rhs)
+ | l2 < l1 = (second . second . first) (RowListItem a2 l2 t2 :) (go lhs r2)
| otherwise = first (f t1 t2 :) (go r1 r2)
-- | Unify two rows, updating the current substitution
--
-- Common labels are identified and unified. Remaining labels and types are unified with a
-- trailing row unification variable, if appropriate.
-unifyRows :: forall m. (MonadError MultipleErrors m, MonadState CheckState m) => Type -> Type -> m ()
+unifyRows :: forall m. (MonadError MultipleErrors m, MonadState CheckState m) => SourceType -> SourceType -> m ()
unifyRows r1 r2 = sequence_ matches *> uncurry unifyTails rest where
(matches, rest) = alignRowsWith unifyTypes r1 r2
- unifyTails :: ([(Label, Type)], Type) -> ([(Label, Type)], Type) -> m ()
- unifyTails ([], TUnknown u) (sd, r) = solveType u (rowFromList (sd, r))
- unifyTails (sd, r) ([], TUnknown u) = solveType u (rowFromList (sd, r))
- unifyTails ([], REmpty) ([], REmpty) = return ()
- unifyTails ([], TypeVar v1) ([], TypeVar v2) | v1 == v2 = return ()
+ unifyTails :: ([RowListItem SourceAnn], SourceType) -> ([RowListItem SourceAnn], SourceType) -> m ()
+ unifyTails ([], TUnknown _ u) (sd, r) = solveType u (rowFromList (sd, r))
+ unifyTails (sd, r) ([], TUnknown _ u) = solveType u (rowFromList (sd, r))
+ unifyTails ([], REmpty _) ([], REmpty _) = return ()
+ unifyTails ([], TypeVar _ v1) ([], TypeVar _ v2) | v1 == v2 = return ()
unifyTails ([], Skolem _ s1 _ _) ([], Skolem _ s2 _ _) | s1 == s2 = return ()
- unifyTails (sd1, TUnknown u1) (sd2, TUnknown u2) = do
- forM_ sd1 $ \(_, t) -> occursCheck u2 t
- forM_ sd2 $ \(_, t) -> occursCheck u1 t
+ unifyTails (sd1, TUnknown _ u1) (sd2, TUnknown _ u2) = do
+ forM_ sd1 $ occursCheck u2 . rowListType
+ forM_ sd2 $ occursCheck u1 . rowListType
rest' <- freshType
solveType u1 (rowFromList (sd2, rest'))
solveType u2 (rowFromList (sd1, rest'))
@@ -173,7 +173,7 @@ unifyRows r1 r2 = sequence_ matches *> uncurry unifyTails rest where
-- |
-- Replace a single type variable with a new unification variable
--
-replaceVarWithUnknown :: (MonadState CheckState m) => Text -> Type -> m Type
+replaceVarWithUnknown :: (MonadState CheckState m) => Text -> SourceType -> m SourceType
replaceVarWithUnknown ident ty = do
tu <- freshType
return $ replaceTypeVars ident tu ty
@@ -181,25 +181,26 @@ replaceVarWithUnknown ident ty = do
-- |
-- Replace type wildcards with unknowns
--
-replaceTypeWildcards :: (MonadWriter MultipleErrors m, MonadState CheckState m) => Type -> m Type
+replaceTypeWildcards :: (MonadWriter MultipleErrors m, MonadState CheckState m) => SourceType -> m SourceType
replaceTypeWildcards = everywhereOnTypesM replace
where
- replace (TypeWildcard ss) = do
+ replace (TypeWildcard ann name) = do
t <- freshType
ctx <- getLocalContext
- warnWithPosition ss $ tell . errorMessage $ WildcardInferredType t ctx
+ let err = maybe (WildcardInferredType t ctx) (\n -> HoleInferredType n t ctx Nothing) name
+ warnWithPosition (fst ann) $ tell $ errorMessage err
return t
replace other = return other
-- |
-- Replace outermost unsolved unification variables with named type variables
--
-varIfUnknown :: Type -> Type
+varIfUnknown :: SourceType -> SourceType
varIfUnknown ty =
- let unks = ordNub $ unknownsInType ty
+ let unks = nubBy ((==) `on` snd) $ unknownsInType ty
toName = T.cons 't' . T.pack . show
ty' = everywhereOnTypes typeToVar ty
- typeToVar :: Type -> Type
- typeToVar (TUnknown u) = TypeVar (toName u)
+ typeToVar :: SourceType -> SourceType
+ typeToVar (TUnknown ann u) = TypeVar ann (toName u)
typeToVar t = t
- in mkForAll (sort . map toName $ unks) ty'
+ in mkForAll (sortBy (comparing snd) . fmap (fmap toName) $ unks) ty'
diff --git a/src/Language/PureScript/TypeClassDictionaries.hs b/src/Language/PureScript/TypeClassDictionaries.hs
index 84b569c..7f1ad25 100644
--- a/src/Language/PureScript/TypeClassDictionaries.hs
+++ b/src/Language/PureScript/TypeClassDictionaries.hs
@@ -28,9 +28,9 @@ data TypeClassDictionaryInScope v
-- | The name of the type class to which this type class instance applies
, tcdClassName :: Qualified (ProperName 'ClassName)
-- | The types to which this type class instance applies
- , tcdInstanceTypes :: [Type]
+ , tcdInstanceTypes :: [SourceType]
-- | Type class dependencies which must be satisfied to construct this dictionary
- , tcdDependencies :: Maybe [Constraint]
+ , tcdDependencies :: Maybe [SourceConstraint]
}
deriving (Show, Functor, Foldable, Traversable, Generic)
diff --git a/src/Language/PureScript/Types.hs b/src/Language/PureScript/Types.hs
index 3ec7943..56f963b 100644
--- a/src/Language/PureScript/Types.hs
+++ b/src/Language/PureScript/Types.hs
@@ -1,6 +1,9 @@
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DeriveFoldable #-}
+{-# LANGUAGE DeriveTraversable #-}
+{-# LANGUAGE FlexibleInstances #-}
-- |
-- Data types for types
@@ -10,11 +13,14 @@ module Language.PureScript.Types where
import Prelude.Compat
import Protolude (ordNub)
+import Control.Applicative ((<|>))
import Control.Arrow (first)
import Control.DeepSeq (NFData)
import Control.Monad ((<=<))
+import Data.Aeson ((.:), (.=))
import qualified Data.Aeson as A
-import qualified Data.Aeson.TH as A
+import qualified Data.Aeson.Types as A
+import Data.Foldable (fold)
import Data.List (sortBy)
import Data.Ord (comparing)
import Data.Maybe (fromMaybe)
@@ -28,6 +34,11 @@ import Language.PureScript.Names
import Language.PureScript.Label (Label)
import Language.PureScript.PSString (PSString)
+import Lens.Micro.Platform (Lens', (^.), set)
+
+type SourceType = Type SourceAnn
+type SourceConstraint = Constraint SourceAnn
+
-- |
-- An identifier for the scope of a skolem variable
--
@@ -39,52 +50,91 @@ instance NFData SkolemScope
-- |
-- The type of types
--
-data Type
+data Type a
-- | A unification variable of type Type
- = TUnknown Int
+ = TUnknown a Int
-- | A named type variable
- | TypeVar Text
+ | TypeVar a Text
-- | A type-level string
- | TypeLevelString PSString
+ | TypeLevelString a PSString
-- | A type wildcard, as would appear in a partial type synonym
- | TypeWildcard SourceSpan
+ | TypeWildcard a (Maybe Text)
-- | A type constructor
- | TypeConstructor (Qualified (ProperName 'TypeName))
+ | TypeConstructor a (Qualified (ProperName 'TypeName))
-- | A type operator. This will be desugared into a type constructor during the
-- "operators" phase of desugaring.
- | TypeOp (Qualified (OpName 'TypeOpName))
+ | TypeOp a (Qualified (OpName 'TypeOpName))
-- | A type application
- | TypeApp Type Type
+ | TypeApp a (Type a) (Type a)
-- | Forall quantifier
- | ForAll Text Type (Maybe SkolemScope)
+ | ForAll a Text (Type a) (Maybe SkolemScope)
-- | A type with a set of type class constraints
- | ConstrainedType Constraint Type
+ | ConstrainedType a (Constraint a) (Type a)
-- | A skolem constant
- | Skolem Text Int SkolemScope (Maybe SourceSpan)
+ | Skolem a Text Int SkolemScope
-- | An empty row
- | REmpty
+ | REmpty a
-- | A non-empty row
- | RCons Label Type Type
+ | RCons a Label (Type a) (Type a)
-- | A type with a kind annotation
- | KindedType Type Kind
- -- | A placeholder used in pretty printing
- | PrettyPrintFunction Type Type
- -- | A placeholder used in pretty printing
- | PrettyPrintObject Type
- -- | A placeholder used in pretty printing
- | PrettyPrintForAll [Text] Type
+ | KindedType a (Type a) (Kind a)
-- | Binary operator application. During the rebracketing phase of desugaring,
-- this data constructor will be removed.
- | BinaryNoParensType Type Type Type
+ | BinaryNoParensType a (Type a) (Type a) (Type a)
-- | 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, Eq, Ord, Generic)
+ | ParensInType a (Type a)
+ deriving (Show, Generic, Functor, Foldable, Traversable)
+
+instance NFData a => NFData (Type a)
+
+srcTUnknown :: Int -> SourceType
+srcTUnknown = TUnknown NullSourceAnn
+
+srcTypeVar :: Text -> SourceType
+srcTypeVar = TypeVar NullSourceAnn
+
+srcTypeLevelString :: PSString -> SourceType
+srcTypeLevelString = TypeLevelString NullSourceAnn
+
+srcTypeWildcard :: SourceType
+srcTypeWildcard = TypeWildcard NullSourceAnn Nothing
+
+srcTypeConstructor :: Qualified (ProperName 'TypeName) -> SourceType
+srcTypeConstructor = TypeConstructor NullSourceAnn
+
+srcTypeOp :: Qualified (OpName 'TypeOpName) -> SourceType
+srcTypeOp = TypeOp NullSourceAnn
-instance NFData Type
+srcTypeApp :: SourceType -> SourceType -> SourceType
+srcTypeApp = TypeApp NullSourceAnn
+
+srcForAll :: Text -> SourceType -> Maybe SkolemScope -> SourceType
+srcForAll = ForAll NullSourceAnn
+
+srcConstrainedType :: SourceConstraint -> SourceType -> SourceType
+srcConstrainedType = ConstrainedType NullSourceAnn
+
+srcSkolem :: Text -> Int -> SkolemScope -> SourceType
+srcSkolem = Skolem NullSourceAnn
+
+srcREmpty :: SourceType
+srcREmpty = REmpty NullSourceAnn
+
+srcRCons :: Label -> SourceType -> SourceType -> SourceType
+srcRCons = RCons NullSourceAnn
+
+srcKindedType :: SourceType -> SourceKind -> SourceType
+srcKindedType = KindedType NullSourceAnn
+
+srcBinaryNoParensType :: SourceType -> SourceType -> SourceType -> SourceType
+srcBinaryNoParensType = BinaryNoParensType NullSourceAnn
+
+srcParensInType :: SourceType -> SourceType
+srcParensInType = ParensInType NullSourceAnn
-- | Additional data relevant to type class constraints
data ConstraintData
@@ -99,77 +149,253 @@ data ConstraintData
instance NFData ConstraintData
-- | A typeclass constraint
-data Constraint = Constraint
- { constraintClass :: Qualified (ProperName 'ClassName)
+data Constraint a = Constraint
+ { constraintAnn :: a
+ -- ^ constraint annotation
+ , constraintClass :: Qualified (ProperName 'ClassName)
-- ^ constraint class name
- , constraintArgs :: [Type]
+ , constraintArgs :: [Type a]
-- ^ type arguments
, constraintData :: Maybe ConstraintData
-- ^ additional data relevant to this constraint
- } deriving (Show, Eq, Ord, Generic)
+ } deriving (Show, Generic, Functor, Foldable, Traversable)
-instance NFData Constraint
+instance NFData a => NFData (Constraint a)
-mapConstraintArgs :: ([Type] -> [Type]) -> Constraint -> Constraint
+srcConstraint :: Qualified (ProperName 'ClassName) -> [SourceType] -> Maybe ConstraintData -> SourceConstraint
+srcConstraint = Constraint NullSourceAnn
+
+mapConstraintArgs :: ([Type a] -> [Type a]) -> Constraint a -> Constraint a
mapConstraintArgs f c = c { constraintArgs = f (constraintArgs c) }
-overConstraintArgs :: Functor f => ([Type] -> f [Type]) -> Constraint -> f Constraint
+overConstraintArgs :: Functor f => ([Type a] -> f [Type a]) -> Constraint a -> f (Constraint a)
overConstraintArgs f c = (\args -> c { constraintArgs = args }) <$> f (constraintArgs c)
-$(A.deriveJSON A.defaultOptions ''Type)
-$(A.deriveJSON A.defaultOptions ''Constraint)
-$(A.deriveJSON A.defaultOptions ''ConstraintData)
+constraintDataToJSON :: ConstraintData -> A.Value
+constraintDataToJSON (PartialConstraintData bs trunc) =
+ A.object
+ [ "contents" .= (bs, trunc)
+ ]
+
+constraintToJSON :: (a -> A.Value) -> Constraint a -> A.Value
+constraintToJSON annToJSON (Constraint {..}) =
+ A.object
+ [ "constraintAnn" .= annToJSON constraintAnn
+ , "constraintClass" .= constraintClass
+ , "constraintArgs" .= fmap (typeToJSON annToJSON) constraintArgs
+ , "constraintData" .= fmap constraintDataToJSON constraintData
+ ]
+
+typeToJSON :: forall a. (a -> A.Value) -> Type a -> A.Value
+typeToJSON annToJSON ty =
+ case ty of
+ TUnknown a b ->
+ variant "TUnknown" a b
+ TypeVar a b ->
+ variant "TypeVar" a b
+ TypeLevelString a b ->
+ variant "TypeLevelString" a b
+ TypeWildcard a b ->
+ variant "TypeWildcard" a b
+ TypeConstructor a b ->
+ variant "TypeConstructor" a b
+ TypeOp a b ->
+ variant "TypeOp" a b
+ TypeApp a b c ->
+ variant "TypeApp" a (go b, go c)
+ ForAll a b c d ->
+ variant "ForAll" a (b, go c, d)
+ ConstrainedType a b c ->
+ variant "ConstrainedType" a (constraintToJSON annToJSON b, go c)
+ Skolem a b c d ->
+ variant "Skolem" a (b, c, d)
+ REmpty a ->
+ nullary "REmpty" a
+ RCons a b c d ->
+ variant "RCons" a (b, go c, go d)
+ KindedType a b c ->
+ variant "KindedType" a (go b, kindToJSON annToJSON c)
+ BinaryNoParensType a b c d ->
+ variant "BinaryNoParensType" a (go b, go c, go d)
+ ParensInType a b ->
+ variant "ParensInType" a (go b)
+ where
+ go :: Type a -> A.Value
+ go = typeToJSON annToJSON
+
+ variant :: A.ToJSON b => String -> a -> b -> A.Value
+ variant tag ann contents =
+ A.object
+ [ "tag" .= tag
+ , "annotation" .= annToJSON ann
+ , "contents" .= contents
+ ]
+
+ nullary :: String -> a -> A.Value
+ nullary tag ann =
+ A.object
+ [ "tag" .= tag
+ , "annotation" .= annToJSON ann
+ ]
+
+instance A.ToJSON a => A.ToJSON (Type a) where
+ toJSON = typeToJSON A.toJSON
+
+instance A.ToJSON a => A.ToJSON (Constraint a) where
+ toJSON = constraintToJSON A.toJSON
+
+instance A.ToJSON ConstraintData where
+ toJSON = constraintDataToJSON
+
+constraintDataFromJSON :: A.Value -> A.Parser ConstraintData
+constraintDataFromJSON = A.withObject "PartialConstraintData" $ \o -> do
+ (bs, trunc) <- o .: "contents"
+ pure $ PartialConstraintData bs trunc
+
+constraintFromJSON :: forall a. A.Parser a -> (A.Value -> A.Parser a) -> A.Value -> A.Parser (Constraint a)
+constraintFromJSON defaultAnn annFromJSON = A.withObject "Constraint" $ \o -> do
+ constraintAnn <- (o .: "constraintAnn" >>= annFromJSON) <|> defaultAnn
+ constraintClass <- o .: "constraintClass"
+ constraintArgs <- o .: "constraintArgs" >>= traverse (typeFromJSON defaultAnn annFromJSON)
+ constraintData <- o .: "constraintData" >>= traverse constraintDataFromJSON
+ pure $ Constraint {..}
+
+typeFromJSON :: forall a. A.Parser a -> (A.Value -> A.Parser a) -> A.Value -> A.Parser (Type a)
+typeFromJSON defaultAnn annFromJSON = A.withObject "Type" $ \o -> do
+ tag <- o .: "tag"
+ a <- (o .: "annotation" >>= annFromJSON) <|> defaultAnn
+ let
+ contents :: A.FromJSON b => A.Parser b
+ contents = o .: "contents"
+ case tag of
+ "TUnknown" ->
+ TUnknown a <$> contents
+ "TypeVar" ->
+ TypeVar a <$> contents
+ "TypeLevelString" ->
+ TypeLevelString a <$> contents
+ "TypeWildcard" -> do
+ b <- contents <|> pure Nothing
+ pure $ TypeWildcard a b
+ "TypeConstructor" ->
+ TypeConstructor a <$> contents
+ "TypeOp" ->
+ TypeOp a <$> contents
+ "TypeApp" -> do
+ (b, c) <- contents
+ TypeApp a <$> go b <*> go c
+ "ForAll" -> do
+ (b, c, d) <- contents
+ ForAll a b <$> go c <*> pure d
+ "ConstrainedType" -> do
+ (b, c) <- contents
+ ConstrainedType a <$> constraintFromJSON defaultAnn annFromJSON b <*> go c
+ "Skolem" -> do
+ (b, c, d) <- contents
+ pure $ Skolem a b c d
+ "REmpty" ->
+ pure $ REmpty a
+ "RCons" -> do
+ (b, c, d) <- contents
+ RCons a b <$> go c <*> go d
+ "KindedType" -> do
+ (b, c) <- contents
+ KindedType a <$> go b <*> kindFromJSON defaultAnn annFromJSON c
+ "BinaryNoParensType" -> do
+ (b, c, d) <- contents
+ BinaryNoParensType a <$> go b <*> go c <*> go d
+ "ParensInType" -> do
+ b <- contents
+ ParensInType a <$> go b
+ other ->
+ fail $ "Unrecognised tag: " ++ other
+ where
+ go :: A.Value -> A.Parser (Type a)
+ go = typeFromJSON defaultAnn annFromJSON
+
+-- These overlapping instances exist to preserve compatability for common
+-- instances which have a sensible default for missing annotations.
+instance {-# OVERLAPPING #-} A.FromJSON (Type SourceAnn) where
+ parseJSON = typeFromJSON (pure NullSourceAnn) A.parseJSON
+
+instance {-# OVERLAPPING #-} A.FromJSON (Type ()) where
+ parseJSON = typeFromJSON (pure ()) A.parseJSON
+
+instance {-# OVERLAPPING #-} A.FromJSON a => A.FromJSON (Type a) where
+ parseJSON = typeFromJSON (fail "Invalid annotation") A.parseJSON
+
+instance {-# OVERLAPPING #-} A.FromJSON (Constraint SourceAnn) where
+ parseJSON = constraintFromJSON (pure NullSourceAnn) A.parseJSON
+
+instance {-# OVERLAPPING #-} A.FromJSON (Constraint ()) where
+ parseJSON = constraintFromJSON (pure ()) A.parseJSON
+
+instance {-# OVERLAPPING #-} A.FromJSON a => A.FromJSON (Constraint a) where
+ parseJSON = constraintFromJSON (fail "Invalid annotation") A.parseJSON
+
+instance A.FromJSON ConstraintData where
+ parseJSON = constraintDataFromJSON
+
+data RowListItem a = RowListItem
+ { rowListAnn :: a
+ , rowListLabel :: Label
+ , rowListType :: Type a
+ } deriving (Show, Generic, Functor, Foldable, Traversable)
+
+srcRowListItem :: Label -> SourceType -> RowListItem SourceAnn
+srcRowListItem = RowListItem NullSourceAnn
-- | Convert a row to a list of pairs of labels and types
-rowToList :: Type -> ([(Label, Type)], Type)
+rowToList :: Type a -> ([RowListItem a], Type a)
rowToList = go where
- go (RCons name ty row) =
- first ((name, ty) :) (rowToList row)
+ go (RCons ann name ty row) =
+ first (RowListItem ann name ty :) (rowToList row)
go r = ([], r)
-- | Convert a row to a list of pairs of labels and types, sorted by the labels.
-rowToSortedList :: Type -> ([(Label, Type)], Type)
-rowToSortedList = first (sortBy (comparing fst)) . rowToList
+rowToSortedList :: Type a -> ([RowListItem a], Type a)
+rowToSortedList = first (sortBy (comparing rowListLabel)) . rowToList
-- | Convert a list of labels and types to a row
-rowFromList :: ([(Label, Type)], Type) -> Type
-rowFromList (xs, r) = foldr (uncurry RCons) r xs
+rowFromList :: ([RowListItem a], Type a) -> Type a
+rowFromList (xs, r) = foldr (\(RowListItem ann name ty) -> RCons ann name ty) r xs
-- | Check whether a type is a monotype
-isMonoType :: Type -> Bool
+isMonoType :: Type a -> Bool
isMonoType ForAll{} = False
-isMonoType (ParensInType t) = isMonoType t
-isMonoType (KindedType t _) = isMonoType t
+isMonoType (ParensInType _ t) = isMonoType t
+isMonoType (KindedType _ t _) = isMonoType t
isMonoType _ = True
-- | Universally quantify a type
-mkForAll :: [Text] -> Type -> Type
-mkForAll args ty = foldl (\t arg -> ForAll arg t Nothing) ty args
+mkForAll :: [(a, Text)] -> Type a -> Type a
+mkForAll args ty = foldl (\t (ann, arg) -> ForAll ann arg t Nothing) ty args
-- | Replace a type variable, taking into account variable shadowing
-replaceTypeVars :: Text -> Type -> Type -> Type
+replaceTypeVars :: Text -> Type a -> Type a -> Type a
replaceTypeVars v r = replaceAllTypeVars [(v, r)]
-- | Replace named type variables with types
-replaceAllTypeVars :: [(Text, Type)] -> Type -> Type
+replaceAllTypeVars :: [(Text, Type a)] -> Type a -> Type a
replaceAllTypeVars = go [] where
- go :: [Text] -> [(Text, Type)] -> Type -> Type
- go _ m (TypeVar v) = fromMaybe (TypeVar v) (v `lookup` m)
- go bs m (TypeApp t1 t2) = TypeApp (go bs m t1) (go bs m t2)
- go bs m f@(ForAll v t sco) | v `elem` keys = go bs (filter ((/= v) . fst) m) f
- | v `elem` usedVars =
- let v' = genName v (keys ++ bs ++ usedVars)
- t' = go bs [(v, TypeVar v')] t
- in ForAll v' (go (v' : bs) m t') sco
- | otherwise = ForAll v (go (v : bs) m t) sco
+ go :: [Text] -> [(Text, Type a)] -> Type a -> Type a
+ go _ m (TypeVar ann v) = fromMaybe (TypeVar ann v) (v `lookup` m)
+ go bs m (TypeApp ann t1 t2) = TypeApp ann (go bs m t1) (go bs m t2)
+ go bs m f@(ForAll ann v t sco)
+ | v `elem` keys = go bs (filter ((/= v) . fst) m) f
+ | v `elem` usedVars =
+ let v' = genName v (keys ++ bs ++ usedVars)
+ t' = go bs [(v, TypeVar ann v')] t
+ in ForAll ann v' (go (v' : bs) m t') sco
+ | otherwise = ForAll ann v (go (v : bs) m t) sco
where
keys = map fst m
usedVars = concatMap (usedTypeVariables . snd) m
- go bs m (ConstrainedType c t) = ConstrainedType (mapConstraintArgs (map (go bs m)) c) (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 bs m (ConstrainedType ann c t) = ConstrainedType ann (mapConstraintArgs (map (go bs m)) c) (go bs m t)
+ go bs m (RCons ann name' t r) = RCons ann name' (go bs m t) (go bs m r)
+ go bs m (KindedType ann t k) = KindedType ann (go bs m t) k
+ go bs m (BinaryNoParensType ann t1 t2 t3) = BinaryNoParensType ann (go bs m t1) (go bs m t2) (go bs m t3)
+ go bs m (ParensInType ann t) = ParensInType ann (go bs m t)
go _ _ ty = ty
genName orig inUse = try' 0 where
@@ -178,131 +404,231 @@ replaceAllTypeVars = go [] where
| otherwise = orig <> T.pack (show n)
-- | Collect all type variables appearing in a type
-usedTypeVariables :: Type -> [Text]
+usedTypeVariables :: Type a -> [Text]
usedTypeVariables = ordNub . everythingOnTypes (++) go where
- go (TypeVar v) = [v]
+ go (TypeVar _ v) = [v]
go _ = []
-- | Collect all free type variables appearing in a type
-freeTypeVariables :: Type -> [Text]
+freeTypeVariables :: Type a -> [Text]
freeTypeVariables = ordNub . go [] where
- go :: [Text] -> Type -> [Text]
- go bound (TypeVar v) | v `notElem` bound = [v]
- go bound (TypeApp t1 t2) = go bound t1 ++ go bound t2
- go bound (ForAll v t _) = go (v : bound) t
- go bound (ConstrainedType c t) = concatMap (go bound) (constraintArgs c) ++ 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 :: [Text] -> Type a -> [Text]
+ go bound (TypeVar _ v) | v `notElem` bound = [v]
+ go bound (TypeApp _ t1 t2) = go bound t1 ++ go bound t2
+ go bound (ForAll _ v t _) = go (v : bound) t
+ go bound (ConstrainedType _ c t) = concatMap (go bound) (constraintArgs c) ++ 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 _ _ = []
-- | Universally quantify over all type variables appearing free in a type
-quantify :: Type -> Type
-quantify ty = foldr (\arg t -> ForAll arg t Nothing) ty $ freeTypeVariables ty
+quantify :: Type a -> Type a
+quantify ty = foldr (\arg t -> ForAll (getAnnForType ty) arg t Nothing) ty $ freeTypeVariables ty
-- | Move all universal quantifiers to the front of a type
-moveQuantifiersToFront :: Type -> Type
+moveQuantifiersToFront :: Type a -> Type a
moveQuantifiersToFront = go [] [] where
- go qs cs (ForAll q ty sco) = go ((q, sco) : qs) cs ty
- go qs cs (ConstrainedType c ty) = go qs (c : cs) ty
- go qs cs ty = foldl (\ty' (q, sco) -> ForAll q ty' sco) (foldl (flip ConstrainedType) ty cs) qs
+ go qs cs (ForAll ann q ty sco) = go ((ann, q, sco) : qs) cs ty
+ go qs cs (ConstrainedType ann c ty) = go qs ((ann, c) : cs) ty
+ go qs cs ty = foldl (\ty' (ann, q, sco) -> ForAll ann q ty' sco) (foldl (\ty' (ann, c) -> ConstrainedType ann c ty') ty cs) qs
-- | Check if a type contains wildcards
-containsWildcards :: Type -> Bool
+containsWildcards :: Type a -> Bool
containsWildcards = everythingOnTypes (||) go where
- go :: Type -> Bool
+ go :: Type a -> Bool
go TypeWildcard{} = True
go _ = False
-- | Check if a type contains `forall`
-containsForAll :: Type -> Bool
+containsForAll :: Type a -> Bool
containsForAll = everythingOnTypes (||) go where
- go :: Type -> Bool
+ go :: Type a -> Bool
go ForAll{} = True
go _ = False
-everywhereOnTypes :: (Type -> Type) -> Type -> Type
+everywhereOnTypes :: (Type a -> Type a) -> Type a -> Type a
everywhereOnTypes f = go where
- go (TypeApp t1 t2) = f (TypeApp (go t1) (go t2))
- go (ForAll arg ty sco) = f (ForAll arg (go ty) sco)
- go (ConstrainedType c ty) = f (ConstrainedType (mapConstraintArgs (map go) c) (go ty))
- go (RCons name ty rest) = f (RCons name (go ty) (go rest))
- go (KindedType ty k) = f (KindedType (go ty) k)
- 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 (TypeApp ann t1 t2) = f (TypeApp ann (go t1) (go t2))
+ go (ForAll ann arg ty sco) = f (ForAll ann arg (go ty) sco)
+ go (ConstrainedType ann c ty) = f (ConstrainedType ann (mapConstraintArgs (map go) c) (go ty))
+ go (RCons ann name ty rest) = f (RCons ann name (go ty) (go rest))
+ go (KindedType ann ty k) = f (KindedType ann (go ty) k)
+ go (BinaryNoParensType ann t1 t2 t3) = f (BinaryNoParensType ann (go t1) (go t2) (go t3))
+ go (ParensInType ann t) = f (ParensInType ann (go t))
go other = f other
-everywhereOnTypesTopDown :: (Type -> Type) -> Type -> Type
+everywhereOnTypesTopDown :: (Type a -> Type a) -> Type a -> Type a
everywhereOnTypesTopDown f = go . f where
- go (TypeApp t1 t2) = TypeApp (go (f t1)) (go (f t2))
- go (ForAll arg ty sco) = ForAll arg (go (f ty)) sco
- go (ConstrainedType c ty) = ConstrainedType (mapConstraintArgs (map (go . f)) c) (go (f ty))
- go (RCons name ty rest) = RCons name (go (f ty)) (go (f rest))
- go (KindedType ty k) = KindedType (go (f ty)) k
- 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 (go (f t1)) (go (f t2)) (go (f t3))
- go (ParensInType t) = ParensInType (go (f t))
+ go (TypeApp ann t1 t2) = TypeApp ann (go (f t1)) (go (f t2))
+ go (ForAll ann arg ty sco) = ForAll ann arg (go (f ty)) sco
+ go (ConstrainedType ann c ty) = ConstrainedType ann (mapConstraintArgs (map (go . f)) c) (go (f ty))
+ go (RCons ann name ty rest) = RCons ann name (go (f ty)) (go (f rest))
+ go (KindedType ann ty k) = KindedType ann (go (f ty)) k
+ go (BinaryNoParensType ann t1 t2 t3) = BinaryNoParensType ann (go (f t1)) (go (f t2)) (go (f t3))
+ go (ParensInType ann t) = ParensInType ann (go (f t))
go other = f other
-everywhereOnTypesM :: Monad m => (Type -> m Type) -> Type -> m Type
+everywhereOnTypesM :: Monad m => (Type a -> m (Type a)) -> Type a -> m (Type a)
everywhereOnTypesM f = go where
- go (TypeApp t1 t2) = (TypeApp <$> go t1 <*> go t2) >>= f
- go (ForAll arg ty sco) = (ForAll arg <$> go ty <*> pure sco) >>= f
- go (ConstrainedType c ty) = (ConstrainedType <$> overConstraintArgs (mapM go) c <*> go ty) >>= f
- go (RCons name ty rest) = (RCons name <$> go ty <*> go rest) >>= f
- go (KindedType ty k) = (KindedType <$> go ty <*> pure k) >>= f
- 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 (TypeApp ann t1 t2) = (TypeApp ann <$> go t1 <*> go t2) >>= f
+ go (ForAll ann arg ty sco) = (ForAll ann arg <$> go ty <*> pure sco) >>= f
+ go (ConstrainedType ann c ty) = (ConstrainedType ann <$> overConstraintArgs (mapM go) c <*> go ty) >>= f
+ go (RCons ann name ty rest) = (RCons ann name <$> go ty <*> go rest) >>= f
+ go (KindedType ann ty k) = (KindedType ann <$> go ty <*> pure k) >>= f
+ go (BinaryNoParensType ann t1 t2 t3) = (BinaryNoParensType ann <$> go t1 <*> go t2 <*> go t3) >>= f
+ go (ParensInType ann t) = (ParensInType ann <$> go t) >>= f
go other = f other
-everywhereOnTypesTopDownM :: Monad m => (Type -> m Type) -> Type -> m Type
+everywhereOnTypesTopDownM :: Monad m => (Type a -> m (Type a)) -> Type a -> m (Type a)
everywhereOnTypesTopDownM f = go <=< f where
- go (TypeApp t1 t2) = TypeApp <$> (f t1 >>= go) <*> (f t2 >>= go)
- go (ForAll arg ty sco) = ForAll arg <$> (f ty >>= go) <*> pure sco
- go (ConstrainedType c ty) = ConstrainedType <$> overConstraintArgs (mapM (go <=< f)) c <*> (f ty >>= go)
- go (RCons name ty rest) = RCons name <$> (f ty >>= go) <*> (f rest >>= go)
- go (KindedType ty k) = KindedType <$> (f ty >>= go) <*> pure k
- 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 (TypeApp ann t1 t2) = TypeApp ann <$> (f t1 >>= go) <*> (f t2 >>= go)
+ go (ForAll ann arg ty sco) = ForAll ann arg <$> (f ty >>= go) <*> pure sco
+ go (ConstrainedType ann c ty) = ConstrainedType ann <$> overConstraintArgs (mapM (go <=< f)) c <*> (f ty >>= go)
+ go (RCons ann name ty rest) = RCons ann name <$> (f ty >>= go) <*> (f rest >>= go)
+ go (KindedType ann ty k) = KindedType ann <$> (f ty >>= go) <*> pure k
+ go (BinaryNoParensType ann t1 t2 t3) = BinaryNoParensType ann <$> (f t1 >>= go) <*> (f t2 >>= go) <*> (f t3 >>= go)
+ go (ParensInType ann t) = ParensInType ann <$> (f t >>= go)
go other = f other
-everythingOnTypes :: (r -> r -> r) -> (Type -> r) -> Type -> r
+everythingOnTypes :: (r -> r -> r) -> (Type a -> r) -> Type a -> r
everythingOnTypes (<+>) f = go where
- go t@(TypeApp t1 t2) = f t <+> go t1 <+> go t2
- go t@(ForAll _ ty _) = f t <+> go ty
- go t@(ConstrainedType c ty) = foldl (<+>) (f t) (map go (constraintArgs c)) <+> go ty
- go t@(RCons _ ty rest) = f t <+> go ty <+> go rest
- go t@(KindedType ty _) = f t <+> go ty
- 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 t@(TypeApp _ t1 t2) = f t <+> go t1 <+> go t2
+ go t@(ForAll _ _ ty _) = f t <+> go ty
+ go t@(ConstrainedType _ c ty) = foldl (<+>) (f t) (map go (constraintArgs c)) <+> go ty
+ go t@(RCons _ _ ty rest) = f t <+> go ty <+> go rest
+ go t@(KindedType _ ty _) = f t <+> go ty
+ 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
+everythingWithContextOnTypes :: s -> r -> (r -> r -> r) -> (s -> Type a -> (s, r)) -> Type a -> r
everythingWithContextOnTypes s0 r0 (<+>) f = go' s0 where
go' s t = let (s', r) = f s t in r <+> go s' t
- go s (TypeApp t1 t2) = go' s t1 <+> go' s t2
- go s (ForAll _ ty _) = go' s ty
- go s (ConstrainedType c ty) = foldl (<+>) r0 (map (go' s) (constraintArgs c)) <+> go' s ty
- go s (RCons _ ty rest) = go' s ty <+> go' s rest
- go s (KindedType ty _) = go' s ty
- 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 s (TypeApp _ t1 t2) = go' s t1 <+> go' s t2
+ go s (ForAll _ _ ty _) = go' s ty
+ go s (ConstrainedType _ c ty) = foldl (<+>) r0 (map (go' s) (constraintArgs c)) <+> go' s ty
+ go s (RCons _ _ ty rest) = go' s ty <+> go' s rest
+ go s (KindedType _ ty _) = go' s ty
+ go s (BinaryNoParensType _ t1 t2 t3) = go' s t1 <+> go' s t2 <+> go' s t3
+ go s (ParensInType _ t1) = go' s t1
go _ _ = r0
+
+annForType :: Lens' (Type a) a
+annForType k (TUnknown a b) = (\z -> TUnknown z b) <$> k a
+annForType k (TypeVar a b) = (\z -> TypeVar z b) <$> k a
+annForType k (TypeLevelString a b) = (\z -> TypeLevelString z b) <$> k a
+annForType k (TypeWildcard a b) = (\z -> TypeWildcard z b) <$> k a
+annForType k (TypeConstructor a b) = (\z -> TypeConstructor z b) <$> k a
+annForType k (TypeOp a b) = (\z -> TypeOp z b) <$> k a
+annForType k (TypeApp a b c) = (\z -> TypeApp z b c) <$> k a
+annForType k (ForAll a b c d) = (\z -> ForAll z b c d) <$> k a
+annForType k (ConstrainedType a b c) = (\z -> ConstrainedType z b c) <$> k a
+annForType k (Skolem a b c d) = (\z -> Skolem z b c d) <$> k a
+annForType k (REmpty a) = REmpty <$> k a
+annForType k (RCons a b c d) = (\z -> RCons z b c d) <$> k a
+annForType k (KindedType a b c) = (\z -> KindedType z b c) <$> k a
+annForType k (BinaryNoParensType a b c d) = (\z -> BinaryNoParensType z b c d) <$> k a
+annForType k (ParensInType a b) = (\z -> ParensInType z b) <$> k a
+
+getAnnForType :: Type a -> a
+getAnnForType = (^. annForType)
+
+setAnnForType :: a -> Type a -> Type a
+setAnnForType = set annForType
+
+instance Eq (Type a) where
+ (==) = eqType
+
+instance Ord (Type a) where
+ compare = compareType
+
+eqType :: Type a -> Type b -> Bool
+eqType (TUnknown _ a) (TUnknown _ a') = a == a'
+eqType (TypeVar _ a) (TypeVar _ a') = a == a'
+eqType (TypeLevelString _ a) (TypeLevelString _ a') = a == a'
+eqType (TypeWildcard _ a) (TypeWildcard _ a') = a == a'
+eqType (TypeConstructor _ a) (TypeConstructor _ a') = a == a'
+eqType (TypeOp _ a) (TypeOp _ a') = a == a'
+eqType (TypeApp _ a b) (TypeApp _ a' b') = eqType a a' && eqType b b'
+eqType (ForAll _ a b c) (ForAll _ a' b' c') = a == a' && eqType b b' && c == c'
+eqType (ConstrainedType _ a b) (ConstrainedType _ a' b') = eqConstraint a a' && eqType b b'
+eqType (Skolem _ a b c) (Skolem _ a' b' c') = a == a' && b == b' && c == c'
+eqType (REmpty _) (REmpty _) = True
+eqType (RCons _ a b c) (RCons _ a' b' c') = a == a' && eqType b b' && eqType c c'
+eqType (KindedType _ a b) (KindedType _ a' b') = eqType a a' && eqKind b b'
+eqType (BinaryNoParensType _ a b c) (BinaryNoParensType _ a' b' c') = eqType a a' && eqType b b' && eqType c c'
+eqType (ParensInType _ a) (ParensInType _ a') = eqType a a'
+eqType _ _ = False
+
+compareType :: Type a -> Type b -> Ordering
+compareType (TUnknown _ a) (TUnknown _ a') = compare a a'
+compareType (TUnknown {}) _ = LT
+
+compareType (TypeVar _ a) (TypeVar _ a') = compare a a'
+compareType (TypeVar {}) _ = LT
+compareType _ (TypeVar {}) = GT
+
+compareType (TypeLevelString _ a) (TypeLevelString _ a') = compare a a'
+compareType (TypeLevelString {}) _ = LT
+compareType _ (TypeLevelString {}) = GT
+
+compareType (TypeWildcard _ a) (TypeWildcard _ a') = compare a a'
+compareType (TypeWildcard {}) _ = LT
+compareType _ (TypeWildcard {}) = GT
+
+compareType (TypeConstructor _ a) (TypeConstructor _ a') = compare a a'
+compareType (TypeConstructor {}) _ = LT
+compareType _ (TypeConstructor {}) = GT
+
+compareType (TypeOp _ a) (TypeOp _ a') = compare a a'
+compareType (TypeOp {}) _ = LT
+compareType _ (TypeOp {}) = GT
+
+compareType (TypeApp _ a b) (TypeApp _ a' b') = compareType a a' <> compareType b b'
+compareType (TypeApp {}) _ = LT
+compareType _ (TypeApp {}) = GT
+
+compareType (ForAll _ a b c) (ForAll _ a' b' c') = compare a a' <> compareType b b' <> compare c c'
+compareType (ForAll {}) _ = LT
+compareType _ (ForAll {}) = GT
+
+compareType (ConstrainedType _ a b) (ConstrainedType _ a' b') = compareConstraint a a' <> compareType b b'
+compareType (ConstrainedType {}) _ = LT
+compareType _ (ConstrainedType {}) = GT
+
+compareType (Skolem _ a b c) (Skolem _ a' b' c') = compare a a' <> compare b b' <> compare c c'
+compareType (Skolem {}) _ = LT
+compareType _ (Skolem {}) = GT
+
+compareType (REmpty _) (REmpty _) = EQ
+compareType (REmpty _) _ = LT
+compareType _ (REmpty _) = GT
+
+compareType (RCons _ a b c) (RCons _ a' b' c') = compare a a' <> compareType b b' <> compareType c c'
+compareType (RCons {}) _ = LT
+compareType _ (RCons {}) = GT
+
+compareType (KindedType _ a b) (KindedType _ a' b') = compareType a a' <> compareKind b b'
+compareType (KindedType {}) _ = LT
+compareType _ (KindedType {}) = GT
+
+compareType (BinaryNoParensType _ a b c) (BinaryNoParensType _ a' b' c') = compareType a a' <> compareType b b' <> compareType c c'
+compareType (BinaryNoParensType {}) _ = LT
+compareType _ (BinaryNoParensType {}) = GT
+
+compareType (ParensInType _ a) (ParensInType _ a') = compareType a a'
+compareType (ParensInType {}) _ = GT
+
+instance Eq (Constraint a) where
+ (==) = eqConstraint
+
+instance Ord (Constraint a) where
+ compare = compareConstraint
+
+eqConstraint :: Constraint a -> Constraint b -> Bool
+eqConstraint (Constraint _ a b c) (Constraint _ a' b' c') = a == a' && and (zipWith eqType b b') && c == c'
+
+compareConstraint :: Constraint a -> Constraint b -> Ordering
+compareConstraint (Constraint _ a b c) (Constraint _ a' b' c') = compare a a' <> fold (zipWith compareType b b') <> compare c c'
diff --git a/tests/Language/PureScript/Ide/MatcherSpec.hs b/tests/Language/PureScript/Ide/MatcherSpec.hs
index cfb7102..22eb860 100644
--- a/tests/Language/PureScript/Ide/MatcherSpec.hs
+++ b/tests/Language/PureScript/Ide/MatcherSpec.hs
@@ -12,7 +12,7 @@ import Language.PureScript.Ide.Util
import Test.Hspec
value :: Text -> IdeDeclarationAnn
-value s = withEmptyAnn (IdeDeclValue (IdeValue (P.Ident (toS s)) P.REmpty))
+value s = withEmptyAnn (IdeDeclValue (IdeValue (P.Ident (toS s)) P.srcREmpty))
firstResult, secondResult, fiult :: Match IdeDeclarationAnn
firstResult = Match (P.moduleNameFromString "Match", value "firstResult")
diff --git a/tests/Language/PureScript/Ide/SourceFileSpec.hs b/tests/Language/PureScript/Ide/SourceFileSpec.hs
index dbcfed9..2ef859e 100644
--- a/tests/Language/PureScript/Ide/SourceFileSpec.hs
+++ b/tests/Language/PureScript/Ide/SourceFileSpec.hs
@@ -22,9 +22,9 @@ ann1 = (span1, [])
ann2 = (span2, [])
typeAnnotation1, value1, synonym1, class1, class2, data1, data2, valueFixity, typeFixity, foreign1, foreign2, foreign3, member1 :: P.Declaration
-typeAnnotation1 = P.TypeDeclaration (P.TypeDeclarationData ann1 (P.Ident "value1") P.REmpty)
+typeAnnotation1 = P.TypeDeclaration (P.TypeDeclarationData ann1 (P.Ident "value1") P.srcREmpty)
value1 = P.ValueDecl ann1 (P.Ident "value1") P.Public [] []
-synonym1 = P.TypeSynonymDeclaration ann1 (P.ProperName "Synonym1") [] P.REmpty
+synonym1 = P.TypeSynonymDeclaration ann1 (P.ProperName "Synonym1") [] P.srcREmpty
class1 = P.TypeClassDeclaration ann1 (P.ProperName "Class1") [] [] [] []
class2 = P.TypeClassDeclaration ann1 (P.ProperName "Class2") [] [] [] [member1]
data1 = P.DataDeclaration ann1 P.Newtype (P.ProperName "Data1") [] []
@@ -41,10 +41,10 @@ typeFixity =
(P.Fixity P.Infix 0)
(P.Qualified Nothing (P.ProperName ""))
(P.OpName "~>")
-foreign1 = P.ExternDeclaration ann1 (P.Ident "foreign1") P.REmpty
+foreign1 = P.ExternDeclaration ann1 (P.Ident "foreign1") P.srcREmpty
foreign2 = P.ExternDataDeclaration ann1 (P.ProperName "Foreign2") P.kindType
foreign3 = P.ExternKindDeclaration ann1 (P.ProperName "Foreign3")
-member1 = P.TypeDeclaration (P.TypeDeclarationData ann2 (P.Ident "member1") P.REmpty)
+member1 = P.TypeDeclaration (P.TypeDeclarationData ann2 (P.Ident "member1") P.srcREmpty)
spec :: Spec
spec = do
@@ -73,7 +73,7 @@ spec = do
extractSpans foreign3 `shouldBe` [(IdeNamespaced IdeNSKind "Foreign3", span1)]
describe "Type annotations" $ do
it "extracts a type annotation" $
- extractTypeAnnotations [typeAnnotation1] `shouldBe` [(P.Ident "value1", P.REmpty)]
+ extractTypeAnnotations [typeAnnotation1] `shouldBe` [(P.Ident "value1", P.srcREmpty)]
describe "Finding Source Spans for identifiers" $ do
it "finds a value declaration" $ do
Just r <- getLocation "sfValue"
diff --git a/tests/Language/PureScript/Ide/StateSpec.hs b/tests/Language/PureScript/Ide/StateSpec.hs
index 33d9f30..4775a67 100644
--- a/tests/Language/PureScript/Ide/StateSpec.hs
+++ b/tests/Language/PureScript/Ide/StateSpec.hs
@@ -11,22 +11,22 @@ import Lens.Micro.Platform hiding ((&))
import Test.Hspec
import qualified Data.Map as Map
-valueOperator :: Maybe P.Type -> IdeDeclarationAnn
+valueOperator :: Maybe P.SourceType -> IdeDeclarationAnn
valueOperator =
ideValueOp "<$>" (P.Qualified (Just (mn "Test")) (Left "function")) 2 Nothing
-ctorOperator :: Maybe P.Type -> IdeDeclarationAnn
+ctorOperator :: Maybe P.SourceType -> IdeDeclarationAnn
ctorOperator =
ideValueOp ":" (P.Qualified (Just (mn "Test")) (Right "Cons")) 2 Nothing
-typeOperator :: Maybe P.Kind -> IdeDeclarationAnn
+typeOperator :: Maybe P.SourceKind -> IdeDeclarationAnn
typeOperator =
ideTypeOp ":" (P.Qualified (Just (mn "Test")) "List") 2 Nothing
testModule :: (P.ModuleName, [IdeDeclarationAnn])
testModule =
(mn "Test",
- [ ideValue "function" (Just P.REmpty)
+ [ ideValue "function" (Just P.srcREmpty)
, ideDtor "Cons" "List" (Just P.tyString)
, ideType "List" Nothing []
, valueOperator Nothing
@@ -82,7 +82,7 @@ spec :: Spec
spec = do
describe "resolving operators" $ do
it "resolves the type for a value operator" $
- resolveOperatorsForModule testState (snd testModule) `shouldSatisfy` elem (valueOperator (Just P.REmpty))
+ resolveOperatorsForModule testState (snd testModule) `shouldSatisfy` elem (valueOperator (Just P.srcREmpty))
it "resolves the type for a constructor operator" $
resolveOperatorsForModule testState (snd testModule) `shouldSatisfy` elem (ctorOperator (Just P.tyString))
it "resolves the kind for a type operator" $
diff --git a/tests/Language/PureScript/Ide/Test.hs b/tests/Language/PureScript/Ide/Test.hs
index cca8e99..5cf613f 100644
--- a/tests/Language/PureScript/Ide/Test.hs
+++ b/tests/Language/PureScript/Ide/Test.hs
@@ -55,7 +55,7 @@ annLoc (IdeDeclarationAnn a d) loc = IdeDeclarationAnn a {_annLocation = Just lo
annExp :: IdeDeclarationAnn -> Text -> IdeDeclarationAnn
annExp (IdeDeclarationAnn a d) e = IdeDeclarationAnn a {_annExportedFrom = Just (mn e)} d
-annTyp :: IdeDeclarationAnn -> P.Type -> IdeDeclarationAnn
+annTyp :: IdeDeclarationAnn -> P.SourceType -> IdeDeclarationAnn
annTyp (IdeDeclarationAnn a d) ta = IdeDeclarationAnn a {_annTypeAnnotation = Just ta} d
@@ -63,22 +63,22 @@ ida :: IdeDeclaration -> IdeDeclarationAnn
ida = IdeDeclarationAnn emptyAnn
-- | Builders for Ide declarations
-ideValue :: Text -> Maybe P.Type -> IdeDeclarationAnn
+ideValue :: Text -> Maybe P.SourceType -> IdeDeclarationAnn
ideValue i ty = ida (IdeDeclValue (IdeValue (P.Ident i) (fromMaybe P.tyString ty)))
-ideType :: Text -> Maybe P.Kind -> [(P.ProperName 'P.ConstructorName, P.Type)] -> IdeDeclarationAnn
+ideType :: Text -> Maybe P.SourceKind -> [(P.ProperName 'P.ConstructorName, P.SourceType)] -> IdeDeclarationAnn
ideType pn ki dtors = ida (IdeDeclType (IdeType (P.ProperName pn) (fromMaybe P.kindType ki) dtors))
-ideSynonym :: Text -> Maybe P.Type -> Maybe P.Kind -> IdeDeclarationAnn
+ideSynonym :: Text -> Maybe P.SourceType -> Maybe P.SourceKind -> IdeDeclarationAnn
ideSynonym pn ty kind = ida (IdeDeclTypeSynonym (IdeTypeSynonym (P.ProperName pn) (fromMaybe P.tyString ty) (fromMaybe P.kindType kind)))
-ideTypeClass :: Text -> P.Kind -> [IdeInstance] -> IdeDeclarationAnn
+ideTypeClass :: Text -> P.SourceKind -> [IdeInstance] -> IdeDeclarationAnn
ideTypeClass pn kind instances = ida (IdeDeclTypeClass (IdeTypeClass (P.ProperName pn) kind instances))
-ideDtor :: Text -> Text -> Maybe P.Type -> IdeDeclarationAnn
+ideDtor :: Text -> Text -> Maybe P.SourceType -> IdeDeclarationAnn
ideDtor pn tn ty = ida (IdeDeclDataConstructor (IdeDataConstructor (P.ProperName pn) (P.ProperName tn) (fromMaybe P.tyString ty)))
-ideValueOp :: Text -> P.Qualified (Either Text Text) -> Integer -> Maybe P.Associativity -> Maybe P.Type -> IdeDeclarationAnn
+ideValueOp :: Text -> P.Qualified (Either Text Text) -> Integer -> Maybe P.Associativity -> Maybe P.SourceType -> IdeDeclarationAnn
ideValueOp opName ident precedence assoc t =
ida (IdeDeclValueOperator
(IdeValueOperator
@@ -88,7 +88,7 @@ ideValueOp opName ident precedence assoc t =
(fromMaybe P.Infix assoc)
t))
-ideTypeOp :: Text -> P.Qualified Text -> Integer -> Maybe P.Associativity -> Maybe P.Kind -> IdeDeclarationAnn
+ideTypeOp :: Text -> P.Qualified Text -> Integer -> Maybe P.Associativity -> Maybe P.SourceKind -> IdeDeclarationAnn
ideTypeOp opName ident precedence assoc k =
ida (IdeDeclTypeOperator
(IdeTypeOperator
diff --git a/tests/Main.hs b/tests/Main.hs
index c026938..9214ff3 100644
--- a/tests/Main.hs
+++ b/tests/Main.hs
@@ -31,14 +31,13 @@ main = do
TestUtils.updateSupportCode
heading "Prim documentation test suite"
TestPrimDocs.main
- heading "psc-publish test suite"
- TestPscPublish.main
ideTests <- TestIde.main
compilerTests <- TestCompiler.main
psciTests <- TestPsci.main
coreFnTests <- TestCoreFn.main
docsTests <- TestDocs.main
+ publishTests <- TestPscPublish.main
hierarchyTests <- TestHierarchy.main
defaultMain $
@@ -49,6 +48,7 @@ main = do
, ideTests
, coreFnTests
, docsTests
+ , publishTests
, hierarchyTests
]
diff --git a/tests/TestDocs.hs b/tests/TestDocs.hs
index 8bd082e..3ca26f1 100644
--- a/tests/TestDocs.hs
+++ b/tests/TestDocs.hs
@@ -133,10 +133,10 @@ data DocsAssertion
| ShouldHaveFunDeps P.ModuleName Text [([Text],[Text])]
-- | Assert that a particular value declaration exists, and its type
-- satisfies the given predicate.
- | ValueShouldHaveTypeSignature P.ModuleName Text (P.Type -> Bool)
+ | ValueShouldHaveTypeSignature P.ModuleName Text (Docs.Type' -> Bool)
-- | Assert that a particular instance declaration exists under some class or
-- type declaration, and that its type satisfies the given predicate.
- | InstanceShouldHaveTypeSignature P.ModuleName Text Text (P.Type -> Bool)
+ | InstanceShouldHaveTypeSignature P.ModuleName Text Text (Docs.Type' -> Bool)
-- | Assert that a particular type alias exists, and its corresponding
-- type, when rendered, matches a given string exactly
-- fields: module, type synonym name, expected type
@@ -225,7 +225,7 @@ data DocsAssertionFailure
-- because the inferred type was used when the explicit type should have
-- been.
-- Fields: module name, declaration name, actual type.
- | DeclarationWrongType P.ModuleName Text P.Type
+ | DeclarationWrongType P.ModuleName Text Docs.Type'
-- | A Type synonym has been rendered in an unexpected format
-- Fields: module name, declaration name, expected rendering, actual rendering
| TypeSynonymMismatch P.ModuleName Text Text Text
@@ -500,13 +500,13 @@ runTagsAssertion assertion tags =
Just taggedLine -> TagsFail $ Tagged decl taggedLine
Nothing -> TagsPass
-checkConstrained :: P.Type -> Text -> Bool
+checkConstrained :: P.Type a -> Text -> Bool
checkConstrained ty tyClass =
case ty of
- P.ConstrainedType c ty'
+ P.ConstrainedType _ c ty'
| matches tyClass c -> True
| otherwise -> checkConstrained ty' tyClass
- P.ForAll _ ty' _ ->
+ P.ForAll _ _ ty' _ ->
checkConstrained ty' tyClass
_ ->
False
@@ -593,8 +593,8 @@ testCases =
, ("ExplicitTypeSignatures",
[ ValueShouldHaveTypeSignature (n "ExplicitTypeSignatures") "explicit" (hasTypeVar "something")
- , ValueShouldHaveTypeSignature (n "ExplicitTypeSignatures") "anInt" (P.tyInt ==)
- , ValueShouldHaveTypeSignature (n "ExplicitTypeSignatures") "aNumber" (P.tyNumber ==)
+ , ValueShouldHaveTypeSignature (n "ExplicitTypeSignatures") "anInt" (P.tyInt `P.eqType`)
+ , ValueShouldHaveTypeSignature (n "ExplicitTypeSignatures") "aNumber" (P.tyNumber `P.eqType`)
])
, ("ConstrainedArgument",
@@ -652,7 +652,7 @@ testCases =
hasTypeVar varName =
getAny . P.everythingOnTypes (<>) (Any . isVar varName)
- isVar varName (P.TypeVar name) | varName == T.unpack name = True
+ isVar varName (P.TypeVar _ name) | varName == T.unpack name = True
isVar _ _ = False
renderedType expected ty =
diff --git a/tests/TestHierarchy.hs b/tests/TestHierarchy.hs
index 898f869..3cbf612 100644
--- a/tests/TestHierarchy.hs
+++ b/tests/TestHierarchy.hs
@@ -53,7 +53,7 @@ main = testSpec "hierarchy" $ do
(P.internalModuleSourceSpan "<B>", [])
(P.ProperName "B")
[]
- [P.Constraint (P.Qualified Nothing $ P.ProperName "A") [] Nothing]
+ [P.srcConstraint (P.Qualified Nothing $ P.ProperName "A") [] Nothing]
[]
[]
]
diff --git a/tests/TestPrimDocs.hs b/tests/TestPrimDocs.hs
index 584c8a9..ef545de 100644
--- a/tests/TestPrimDocs.hs
+++ b/tests/TestPrimDocs.hs
@@ -20,6 +20,7 @@ main = do
-- note that prim type classes are listed in P.primTypes
(map (P.runProperName . P.disqualify . fst) $ Map.toList
( P.primTypes <>
+ P.primBooleanTypes <>
P.primOrderingTypes <>
P.primRowTypes <>
P.primRowListTypes <>
diff --git a/tests/TestPscPublish.hs b/tests/TestPscPublish.hs
index 9126d36..d32853e 100644
--- a/tests/TestPscPublish.hs
+++ b/tests/TestPscPublish.hs
@@ -7,22 +7,47 @@ module TestPscPublish where
import Prelude
import Control.Monad.IO.Class (liftIO)
-import System.Exit (exitFailure)
import Data.ByteString.Lazy (ByteString)
import Data.Time.Clock (getCurrentTime)
import qualified Data.Aeson as A
import Data.Version
+import Data.Foldable (forM_)
+import qualified Text.PrettyPrint.Boxes as Boxes
+import System.Directory (listDirectory)
+import System.FilePath ((</>))
import Language.PureScript.Docs
import Language.PureScript.Publish
import Language.PureScript.Publish.ErrorsWarnings as Publish
+import Test.Tasty
+import Test.Tasty.Hspec (Spec, Expectation, runIO, context, it, expectationFailure, testSpec)
import TestUtils
-main :: IO ()
-main = testPackage
- "tests/support/bower_components/purescript-prelude"
- "../../prelude-resolutions.json"
+main :: IO TestTree
+main = testSpec "publish" spec
+
+spec :: Spec
+spec = do
+ it "roundtrips the json for purescript-prelude" $ do
+ testPackage
+ "tests/support/bower_components/purescript-prelude"
+ "../../prelude-resolutions.json"
+
+ context "json compatibility" $ do
+ let compatDir = "tests" </> "json-compat"
+ versions <- runIO $ listDirectory compatDir
+ forM_ versions $ \version -> do
+ context ("json produced by " ++ version) $ do
+ files <- runIO $ listDirectory (compatDir </> version)
+ forM_ files $ \file -> do
+ it file $ do
+ result <- A.eitherDecodeFileStrict' (compatDir </> version </> file)
+ case result of
+ Right (_ :: VerifiedPackage) ->
+ pure ()
+ Left err ->
+ expectationFailure ("JSON parsing failed: " ++ err)
data TestResult
= ParseFailed String
@@ -51,18 +76,19 @@ testRunOptions = defaultPublishOptions
-- | Given a directory which contains a package, produce JSON from it, and then
-- | attempt to parse it again, and ensure that it doesn't change.
-testPackage :: FilePath -> FilePath -> IO ()
-testPackage dir resolutionsFile = pushd dir $ do
- res <- preparePackage "bower.json" resolutionsFile testRunOptions
+testPackage :: FilePath -> FilePath -> Expectation
+testPackage dir resolutionsFile = do
+ res <- pushd dir (preparePackage "bower.json" resolutionsFile testRunOptions)
case res of
- Left e -> preparePackageError e
- Right package -> case roundTrip package of
- Pass _ -> do
- putStrLn ("psc-publish test passed for: " ++ dir)
- pure ()
- other -> do
- putStrLn ("psc-publish tests failed on " ++ dir ++ ":")
- print other
- exitFailure
- where
- preparePackageError e = Publish.printErrorToStdout e >> exitFailure
+ Left err ->
+ expectationFailure $
+ "Failed to produce JSON from " ++ dir ++ ":\n" ++
+ Boxes.render (Publish.renderError err)
+ Right package ->
+ case roundTrip package of
+ Pass _ ->
+ pure ()
+ ParseFailed msg ->
+ expectationFailure ("Failed to re-parse: " ++ msg)
+ Mismatch _ _ ->
+ expectationFailure "JSON did not match"
diff --git a/tests/TestPsci/CommandTest.hs b/tests/TestPsci/CommandTest.hs
index 7de6412..758cfbc 100644
--- a/tests/TestPsci/CommandTest.hs
+++ b/tests/TestPsci/CommandTest.hs
@@ -65,3 +65,18 @@ commandTests = context "commandTests" $ do
":browse Mirp" `printed` flip shouldContain "is not valid"
":browse Prim" `printed` flip shouldContain "class Partial"
+
+ specPSCi ":print" $ do
+ let failMsg = "Unable to set the repl's printing function"
+ let interactivePrintModuleShouldBe modName = do
+ modName' <- (fst . psciInteractivePrint) <$> get
+ modName' `equalsTo` modName
+
+ run "import Prelude"
+ ":print Prelude.show" `printed` flip shouldContain failMsg
+ interactivePrintModuleShouldBe (moduleNameFromString "PSCI.Support")
+
+ ":print InteractivePrint.unsafeEval" `printed` flip shouldNotContain failMsg
+ "(identity :: _ -> _)" `printed` flip shouldContain "[Function]"
+ interactivePrintModuleShouldBe (moduleNameFromString "InteractivePrint")
+ ":print" `printed` flip shouldContain "InteractivePrint"
diff --git a/tests/TestPsci/CompletionTest.hs b/tests/TestPsci/CompletionTest.hs
index 13ba6c0..7cf9ba7 100644
--- a/tests/TestPsci/CompletionTest.hs
+++ b/tests/TestPsci/CompletionTest.hs
@@ -47,8 +47,8 @@ completionTestData supportModuleNames =
, (":reload ", [])
, (":clear ", [])
- -- :show should complete to "loaded" and "import"
- , (":show ", [":show import", ":show loaded"])
+ -- :show should complete its available arguments
+ , (":show ", [":show import", ":show loaded", ":show print"])
, (":show a", [])
-- :type should complete next word from values and constructors in scope
diff --git a/tests/TestPsci/TestEnv.hs b/tests/TestPsci/TestEnv.hs
index 84cb90f..646d93b 100644
--- a/tests/TestPsci/TestEnv.hs
+++ b/tests/TestPsci/TestEnv.hs
@@ -9,6 +9,7 @@ import Control.Exception.Lifted (bracket_)
import Control.Monad (void, when)
import Control.Monad.IO.Class (liftIO)
import Control.Monad.Trans.RWS.Strict (evalRWST, asks, local, RWST)
+import Data.Foldable (traverse_)
import Data.List (isSuffixOf)
import qualified Data.Text as T
import qualified Language.PureScript as P
@@ -70,10 +71,10 @@ runAndEval :: String -> TestPSCi () -> (String -> TestPSCi ()) -> TestPSCi ()
runAndEval comm jsOutputEval textOutputEval =
case parseCommand comm of
Left errStr -> liftIO $ putStrLn errStr >> exitFailure
- Right command ->
+ Right commands ->
-- The JS result is ignored, as it's already written in a JS source file.
-- For the detail, please refer to Interactive.hs
- handleCommand (\_ -> jsOutputEval) (return ()) textOutputEval command
+ traverse_ (handleCommand (\_ -> jsOutputEval) (return ()) textOutputEval) commands
-- | Run a PSCi command, evaluate compiled JS, and ignore evaluation output and printed output
run :: String -> TestPSCi ()
diff --git a/tests/json-compat/v0.11.3/generics-4.0.0.json b/tests/json-compat/v0.11.3/generics-4.0.0.json
new file mode 100644
index 0000000..9b7d826
--- /dev/null
+++ b/tests/json-compat/v0.11.3/generics-4.0.0.json
@@ -0,0 +1 @@
+{"uploader":"paf31","packageMeta":{"homepage":"https://github.com/purescript-contrib/purescript-generics","repository":{"url":"git://github.com/purescript/purescript-generics.git","type":"git"},"ignore":["**/.*","bower_components","node_modules","output","test","bower.json","package.json"],"devDependencies":{"purescript-console":"^3.0.0","purescript-assert":"^3.0.0"},"authors":[{"email":"gershomb@gmail.com","name":"Gershom Bazerman"}],"dependencies":{"purescript-proxy":"^2.0.0","purescript-either":"^3.0.0","purescript-arrays":"^4.0.0","purescript-strings":"^3.0.0","purescript-identity":"^3.0.0","purescript-lists":"^4.0.0"},"name":"purescript-generics","license":["MIT"],"description":"Generic programming for PureScript"},"tagTime":"2017-03-26T22:17:38+0000","modules":[{"reExports":[],"name":"Data.Generic","comments":null,"declarations":[{"children":[{"comments":null,"title":"toSpine","info":{"declType":"typeClassMember","type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeVar","contents":"a"}]},{"tag":"TypeConstructor","contents":[["Data","Generic"],"GenericSpine"]}]}},"sourceSpan":null},{"comments":null,"title":"toSignature","info":{"declType":"typeClassMember","type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"tag":"TypeVar","contents":"a"}]}]},{"tag":"TypeConstructor","contents":[["Data","Generic"],"GenericSignature"]}]}},"sourceSpan":null},{"comments":null,"title":"fromSpine","info":{"declType":"typeClassMember","type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeConstructor","contents":[["Data","Generic"],"GenericSpine"]}]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Maybe"],"Maybe"]},{"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":null},{"comments":null,"title":"genericNumber","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Generic"],"Generic"]},{"tag":"TypeConstructor","contents":[["Prim"],"Number"]}]}},"sourceSpan":{"start":[44,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[48,24]}},{"comments":null,"title":"genericInt","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Generic"],"Generic"]},{"tag":"TypeConstructor","contents":[["Prim"],"Int"]}]}},"sourceSpan":{"start":[50,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[54,24]}},{"comments":null,"title":"genericString","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Generic"],"Generic"]},{"tag":"TypeConstructor","contents":[["Prim"],"String"]}]}},"sourceSpan":{"start":[56,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[60,24]}},{"comments":null,"title":"genericChar","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Generic"],"Generic"]},{"tag":"TypeConstructor","contents":[["Prim"],"Char"]}]}},"sourceSpan":{"start":[62,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[66,24]}},{"comments":null,"title":"genericBool","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Generic"],"Generic"]},{"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]}},"sourceSpan":{"start":[68,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[72,24]}},{"comments":null,"title":"genericArray","info":{"declType":"instance","dependencies":[{"constraintClass":[["Data","Generic"],"Generic"],"constraintArgs":[{"tag":"TypeVar","contents":"a"}],"constraintData":null}],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Generic"],"Generic"]},{"tag":"ParensInType","contents":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Array"]},{"tag":"TypeVar","contents":"a"}]}}]}},"sourceSpan":{"start":[74,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[81,24]}},{"comments":null,"title":"genericUnit","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Generic"],"Generic"]},{"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}},"sourceSpan":{"start":[83,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[87,24]}},{"comments":null,"title":"genericVoid","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Generic"],"Generic"]},{"tag":"TypeConstructor","contents":[["Data","Void"],"Void"]}]}},"sourceSpan":{"start":[89,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[92,24]}},{"comments":null,"title":"genericTuple","info":{"declType":"instance","dependencies":[{"constraintClass":[["Data","Generic"],"Generic"],"constraintArgs":[{"tag":"TypeVar","contents":"a"}],"constraintData":null},{"constraintClass":[["Data","Generic"],"Generic"],"constraintArgs":[{"tag":"TypeVar","contents":"b"}],"constraintData":null}],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Generic"],"Generic"]},{"tag":"ParensInType","contents":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Tuple"],"Tuple"]},{"tag":"TypeVar","contents":"a"}]},{"tag":"TypeVar","contents":"b"}]}}]}},"sourceSpan":{"start":[94,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[114,24]}},{"comments":null,"title":"genericList","info":{"declType":"instance","dependencies":[{"constraintClass":[["Data","Generic"],"Generic"],"constraintArgs":[{"tag":"TypeVar","contents":"a"}],"constraintData":null}],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Generic"],"Generic"]},{"tag":"ParensInType","contents":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","List","Types"],"List"]},{"tag":"TypeVar","contents":"a"}]}}]}},"sourceSpan":{"start":[116,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[141,24]}},{"comments":null,"title":"genericNonEmptyList","info":{"declType":"instance","dependencies":[{"constraintClass":[["Data","Generic"],"Generic"],"constraintArgs":[{"tag":"TypeVar","contents":"a"}],"constraintData":null}],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Generic"],"Generic"]},{"tag":"ParensInType","contents":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","List","Types"],"NonEmptyList"]},{"tag":"TypeVar","contents":"a"}]}}]}},"sourceSpan":{"start":[143,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[158,24]}},{"comments":null,"title":"genericMaybe","info":{"declType":"instance","dependencies":[{"constraintClass":[["Data","Generic"],"Generic"],"constraintArgs":[{"tag":"TypeVar","contents":"a"}],"constraintData":null}],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Generic"],"Generic"]},{"tag":"ParensInType","contents":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Maybe"],"Maybe"]},{"tag":"TypeVar","contents":"a"}]}}]}},"sourceSpan":{"start":[160,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[178,24]}},{"comments":null,"title":"genericEither","info":{"declType":"instance","dependencies":[{"constraintClass":[["Data","Generic"],"Generic"],"constraintArgs":[{"tag":"TypeVar","contents":"a"}],"constraintData":null},{"constraintClass":[["Data","Generic"],"Generic"],"constraintArgs":[{"tag":"TypeVar","contents":"b"}],"constraintData":null}],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Generic"],"Generic"]},{"tag":"ParensInType","contents":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Either"],"Either"]},{"tag":"TypeVar","contents":"a"}]},{"tag":"TypeVar","contents":"b"}]}}]}},"sourceSpan":{"start":[180,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[200,24]}},{"comments":null,"title":"genericIdentity","info":{"declType":"instance","dependencies":[{"constraintClass":[["Data","Generic"],"Generic"],"constraintArgs":[{"tag":"TypeVar","contents":"a"}],"constraintData":null}],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Generic"],"Generic"]},{"tag":"ParensInType","contents":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Identity"],"Identity"]},{"tag":"TypeVar","contents":"a"}]}}]}},"sourceSpan":{"start":[202,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[215,24]}},{"comments":null,"title":"genericOrdering","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Generic"],"Generic"]},{"tag":"TypeConstructor","contents":[["Data","Ordering"],"Ordering"]}]}},"sourceSpan":{"start":[217,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[233,17]}},{"comments":null,"title":"genericNonEmpty","info":{"declType":"instance","dependencies":[{"constraintClass":[["Data","Generic"],"Generic"],"constraintArgs":[{"tag":"ParensInType","contents":{"tag":"TypeApp","contents":[{"tag":"TypeVar","contents":"f"},{"tag":"TypeVar","contents":"a"}]}}],"constraintData":null},{"constraintClass":[["Data","Generic"],"Generic"],"constraintArgs":[{"tag":"TypeVar","contents":"a"}],"constraintData":null}],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Generic"],"Generic"]},{"tag":"ParensInType","contents":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","NonEmpty"],"NonEmpty"]},{"tag":"TypeVar","contents":"f"}]},{"tag":"TypeVar","contents":"a"}]}}]}},"sourceSpan":{"start":[235,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[255,24]}}],"comments":"The Generic typeclass provides methods for sending data to/from spine\nrepresentations, as well as querying about the signatures of spine\nrepresentations.\n\nFor standard data structures, you can simply write\n`derive instance genericFoo :: Generic Foo` in the module they are\ndeclared, and the instance methods will be filled in for you.\n","title":"Generic","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[39,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[42,39]}},{"children":[{"comments":null,"title":"SProd","info":{"arguments":[{"tag":"TypeConstructor","contents":[["Prim"],"String"]},{"tag":"ParensInType","contents":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Array"]},{"tag":"ParensInType","contents":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]},{"tag":"TypeConstructor","contents":[["Data","Generic"],"GenericSpine"]}]}}]}}],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"SRecord","info":{"arguments":[{"tag":"ParensInType","contents":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Array"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"tag":"RCons","contents":["recLabel",{"tag":"TypeConstructor","contents":[["Prim"],"String"]},{"tag":"RCons","contents":["recValue",{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]},{"tag":"TypeConstructor","contents":[["Data","Generic"],"GenericSpine"]}]},{"tag":"REmpty"}]}]}]}]}}],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"SNumber","info":{"arguments":[{"tag":"TypeConstructor","contents":[["Prim"],"Number"]}],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"SBoolean","info":{"arguments":[{"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"SInt","info":{"arguments":[{"tag":"TypeConstructor","contents":[["Prim"],"Int"]}],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"SString","info":{"arguments":[{"tag":"TypeConstructor","contents":[["Prim"],"String"]}],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"SChar","info":{"arguments":[{"tag":"TypeConstructor","contents":[["Prim"],"Char"]}],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"SArray","info":{"arguments":[{"tag":"ParensInType","contents":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Array"]},{"tag":"ParensInType","contents":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]},{"tag":"TypeConstructor","contents":[["Data","Generic"],"GenericSpine"]}]}}]}}],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"SUnit","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"showGenericSpine","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Show"],"Show"]},{"tag":"TypeConstructor","contents":[["Data","Generic"],"GenericSpine"]}]}},"sourceSpan":{"start":[270,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[284,97]}},{"comments":null,"title":"eqGenericSpine","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Eq"],"Eq"]},{"tag":"TypeConstructor","contents":[["Data","Generic"],"GenericSpine"]}]}},"sourceSpan":{"start":[290,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[301,17]}},{"comments":null,"title":"ordGenericSpine","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"tag":"TypeConstructor","contents":[["Data","Generic"],"GenericSpine"]}]}},"sourceSpan":{"start":[303,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[336,27]}}],"comments":"A GenericSpine is a universal representation of an arbitrary data\nstructure (that does not contain function arrows).\n","title":"GenericSpine","info":{"declType":"data","dataDeclType":"data","typeArguments":[]},"sourceSpan":{"start":[259,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[268,10]}},{"children":[{"comments":null,"title":"SigProd","info":{"arguments":[{"tag":"TypeConstructor","contents":[["Prim"],"String"]},{"tag":"ParensInType","contents":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Array"]},{"tag":"TypeConstructor","contents":[["Data","Generic"],"DataConstructor"]}]}}],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"SigRecord","info":{"arguments":[{"tag":"ParensInType","contents":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Array"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"tag":"RCons","contents":["recLabel",{"tag":"TypeConstructor","contents":[["Prim"],"String"]},{"tag":"RCons","contents":["recValue",{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]},{"tag":"TypeConstructor","contents":[["Data","Generic"],"GenericSignature"]}]},{"tag":"REmpty"}]}]}]}]}}],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"SigNumber","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"SigBoolean","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"SigInt","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"SigString","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"SigChar","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"SigArray","info":{"arguments":[{"tag":"ParensInType","contents":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]},{"tag":"TypeConstructor","contents":[["Data","Generic"],"GenericSignature"]}]}}],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"SigUnit","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"eqGenericSignature","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Eq"],"Eq"]},{"tag":"TypeConstructor","contents":[["Data","Generic"],"GenericSignature"]}]}},"sourceSpan":{"start":[351,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[362,17]}},{"comments":null,"title":"showGenericSignature","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Show"],"Show"]},{"tag":"TypeConstructor","contents":[["Data","Generic"],"GenericSignature"]}]}},"sourceSpan":{"start":[364,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[365,23]}}],"comments":"A GenericSignature is a universal representation of the structure of an\narbitrary data structure (that does not contain function arrows).\n","title":"GenericSignature","info":{"declType":"data","dataDeclType":"data","typeArguments":[]},"sourceSpan":{"start":[340,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[349,12]}},{"children":[],"comments":"Identifies a data constructor.\n","title":"DataConstructor","info":{"arguments":[],"declType":"typeSynonym","type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"tag":"RCons","contents":["sigConstructor",{"tag":"TypeConstructor","contents":[["Prim"],"String"]},{"tag":"RCons","contents":["sigValues",{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Array"]},{"tag":"ParensInType","contents":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]},{"tag":"TypeConstructor","contents":[["Data","Generic"],"GenericSignature"]}]}}]},{"tag":"REmpty"}]}]}]}},"sourceSpan":{"start":[368,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[371,4]}},{"children":[],"comments":null,"title":"showDataConstructor","info":{"declType":"value","type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeConstructor","contents":[["Data","Generic"],"DataConstructor"]}]},{"tag":"TypeConstructor","contents":[["Prim"],"String"]}]}},"sourceSpan":{"start":[378,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[378,49]}},{"children":[],"comments":null,"title":"showSignature","info":{"declType":"value","type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeConstructor","contents":[["Data","Generic"],"GenericSignature"]}]},{"tag":"TypeConstructor","contents":[["Prim"],"String"]}]}},"sourceSpan":{"start":[384,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[384,44]}},{"children":[],"comments":"Checks that the spine follows the structure defined by the signature\n","title":"isValidSpine","info":{"declType":"value","type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeConstructor","contents":[["Data","Generic"],"GenericSignature"]}]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeConstructor","contents":[["Data","Generic"],"GenericSpine"]}]},{"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]}]}},"sourceSpan":{"start":[429,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[429,60]}},{"children":[],"comments":"This function can be used as the default instance for Show for any\ninstance of Generic\n","title":"gShow","info":{"declType":"value","type":{"tag":"ForAll","contents":["a",{"tag":"ConstrainedType","contents":[{"constraintClass":[["Data","Generic"],"Generic"],"constraintArgs":[{"tag":"TypeVar","contents":"a"}],"constraintData":null},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeVar","contents":"a"}]},{"tag":"TypeConstructor","contents":[["Prim"],"String"]}]}]},null]}},"sourceSpan":{"start":[457,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[457,44]}},{"children":[],"comments":"This function can be used as an implementation of the `eq` function of `Eq`\nfor any type with a `Generic` instance.\n\n**Note**: It is preferrable to use `derive instance` for `Eq` instances\nrather than relying on `gEq`, where possible.\n","title":"gEq","info":{"declType":"value","type":{"tag":"ForAll","contents":["a",{"tag":"ConstrainedType","contents":[{"constraintClass":[["Data","Generic"],"Generic"],"constraintArgs":[{"tag":"TypeVar","contents":"a"}],"constraintData":null},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeVar","contents":"a"}]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeVar","contents":"a"}]},{"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]}]}]},null]}},"sourceSpan":{"start":[487,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[487,48]}},{"children":[],"comments":"This function can be used as an implementation of the `compare` function\nof `Ord` for any type with a `Generic` instance.\n\n**Note**: It is preferrable to use `derive instance` for `Ord` instances\nrather than relying on `gCompare`, where possible.\n","title":"gCompare","info":{"declType":"value","type":{"tag":"ForAll","contents":["a",{"tag":"ConstrainedType","contents":[{"constraintClass":[["Data","Generic"],"Generic"],"constraintArgs":[{"tag":"TypeVar","contents":"a"}],"constraintData":null},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeVar","contents":"a"}]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeVar","contents":"a"}]},{"tag":"TypeConstructor","contents":[["Data","Ordering"],"Ordering"]}]}]}]},null]}},"sourceSpan":{"start":[495,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[495,54]}}]}],"resolvedDependencies":{"purescript-proxy":"2.0.0","purescript-newtype":"2.0.0","purescript-control":"3.0.0","purescript-either":"3.0.0","purescript-arrays":"4.0.1","purescript-maybe":"3.0.0","purescript-unfoldable":"3.0.0","purescript-invariant":"3.0.0","purescript-lazy":"3.0.0","purescript-monoid":"3.0.0","purescript-foldable-traversable":"3.0.0","purescript-tailrec":"3.0.0","purescript-prelude":"3.0.0","purescript-st":"3.0.0","purescript-bifunctors":"3.0.0","purescript-nonempty":"4.0.0","purescript-unsafe-coerce":"3.0.0","purescript-eff":"3.1.0","purescript-tuples":"4.0.0","purescript-partial":"1.2.0","purescript-strings":"3.0.0","purescript-identity":"3.0.0","purescript-lists":"4.0.1"},"version":"4.0.0","github":["purescript","purescript-generics"],"versionTag":"v4.0.0","moduleMap":{"Data.BooleanAlgebra":"purescript-prelude","Data.Ring":"purescript-prelude","Data.NonEmpty":"purescript-nonempty","Control.Monad.Eff.Unsafe":"purescript-eff","Data.Bifunctor.Flip":"purescript-bifunctors","Data.Ord":"purescript-prelude","Data.Monoid.Dual":"purescript-monoid","Control.Monad.Rec.Class":"purescript-tailrec","Data.Bitraversable":"purescript-foldable-traversable","Data.Boolean":"purescript-prelude","Control.Biapplicative":"purescript-bifunctors","Type.Proxy":"purescript-proxy","Data.Array.ST.Iterator":"purescript-arrays","Data.Bounded":"purescript-prelude","Data.Show":"purescript-prelude","Data.Bifunctor.Clown":"purescript-bifunctors","Data.Foldable":"purescript-foldable-traversable","Control.Apply":"purescript-prelude","Data.Tuple.Nested":"purescript-tuples","Control.Monad":"purescript-prelude","Data.Lazy":"purescript-lazy","Data.Monoid":"purescript-monoid","Control.Monad.Eff.Uncurried":"purescript-eff","Data.Maybe.First":"purescript-maybe","Control.Bind":"purescript-prelude","Data.Monoid.Additive":"purescript-monoid","Data.String.Regex":"purescript-strings","Data.HeytingAlgebra":"purescript-prelude","Control.Alt":"purescript-control","Data.List.ZipList":"purescript-lists","Data.Ord.Unsafe":"purescript-prelude","Data.Semigroup":"purescript-prelude","Control.Monad.Eff":"purescript-eff","Data.Tuple":"purescript-tuples","Control.Biapply":"purescript-bifunctors","Control.Alternative":"purescript-control","Data.Semiring":"purescript-prelude","Data.CommutativeRing":"purescript-prelude","Data.NaturalTransformation":"purescript-prelude","Data.Monoid.Conj":"purescript-monoid","Data.Unfoldable":"purescript-unfoldable","Control.Monad.ST":"purescript-st","Data.List.Types":"purescript-lists","Data.Functor":"purescript-prelude","Unsafe.Coerce":"purescript-unsafe-coerce","Data.List.Lazy.Types":"purescript-lists","Control.Category":"purescript-prelude","Data.Maybe":"purescript-maybe","Data.String.Regex.Unsafe":"purescript-strings","Control.Comonad":"purescript-control","Data.Function":"purescript-prelude","Data.List":"purescript-lists","Data.Field":"purescript-prelude","Data.List.Lazy":"purescript-lists","Data.EuclideanRing":"purescript-prelude","Data.Functor.Invariant":"purescript-invariant","Data.String.Unsafe":"purescript-strings","Prelude":"purescript-prelude","Partial.Unsafe":"purescript-partial","Data.Array":"purescript-arrays","Data.Bifunctor.Product":"purescript-bifunctors","Control.Extend":"purescript-control","Control.Lazy":"purescript-control","Data.Eq":"purescript-prelude","Data.Either.Nested":"purescript-either","Data.Newtype":"purescript-newtype","Data.Bifunctor":"purescript-bifunctors","Data.Monoid.Disj":"purescript-monoid","Data.Array.Partial":"purescript-arrays","Data.String.CaseInsensitive":"purescript-strings","Control.MonadPlus":"purescript-control","Data.Void":"purescript-prelude","Control.MonadZero":"purescript-control","Data.Bifunctor.Joker":"purescript-bifunctors","Data.Bifunctor.Wrap":"purescript-bifunctors","Data.Maybe.Last":"purescript-maybe","Data.Unit":"purescript-prelude","Data.List.NonEmpty":"purescript-lists","Data.List.Lazy.NonEmpty":"purescript-lists","Data.Ordering":"purescript-prelude","Data.Identity":"purescript-identity","Data.String":"purescript-strings","Control.Plus":"purescript-control","Control.Monad.Eff.Class":"purescript-eff","Partial":"purescript-partial","Data.Monoid.Multiplicative":"purescript-monoid","Data.Array.ST":"purescript-arrays","Control.Semigroupoid":"purescript-prelude","Data.Monoid.Alternate":"purescript-monoid","Data.Char":"purescript-strings","Data.Bifunctor.Join":"purescript-bifunctors","Data.Bifoldable":"purescript-foldable-traversable","Data.Monoid.Endo":"purescript-monoid","Data.List.Partial":"purescript-lists","Data.String.Regex.Flags":"purescript-strings","Data.Either":"purescript-either","Control.Applicative":"purescript-prelude","Data.Traversable":"purescript-foldable-traversable"},"compilerVersion":"0.11.3"} \ No newline at end of file
diff --git a/tests/json-compat/v0.11.3/symbols-3.0.0.json b/tests/json-compat/v0.11.3/symbols-3.0.0.json
new file mode 100644
index 0000000..c54aa75
--- /dev/null
+++ b/tests/json-compat/v0.11.3/symbols-3.0.0.json
@@ -0,0 +1 @@
+{"uploader":"paf31","packageMeta":{"homepage":"https://github.com/purescript/purescript-symbols","repository":{"url":"git://github.com/purescript/purescript-symbols.git","type":"git"},"ignore":["**/.*","bower_components","node_modules","output","test","bower.json","package.json"],"dependencies":{"purescript-prelude":"^3.0.0","purescript-unsafe-coerce":"^3.0.0"},"name":"purescript-symbols","license":["MIT"],"description":"Utilities for working with type-level strings"},"tagTime":"2017-03-26T00:59:23+0000","modules":[{"reExports":[],"name":"Data.Symbol","comments":null,"declarations":[{"children":[{"comments":null,"title":"SProxy","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null}],"comments":"A value-level proxy for a type-level symbol.\n","title":"SProxy","info":{"declType":"data","dataDeclType":"data","typeArguments":[["sym",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}]]},"sourceSpan":{"start":[12,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/symbols/v3.0.0/src/Data/Symbol.purs","end":[12,37]}},{"children":[{"comments":null,"title":"reflectSymbol","info":{"declType":"typeClassMember","type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"SProxy"]},{"tag":"TypeVar","contents":"sym"}]}]},{"tag":"TypeConstructor","contents":[["Prim"],"String"]}]}},"sourceSpan":null},{"comments":null,"title":"isSymbolTypeConcat","info":{"declType":"instance","dependencies":[{"constraintClass":[["Data","Symbol"],"IsSymbol"],"constraintArgs":[{"tag":"TypeVar","contents":"left"}],"constraintData":null},{"constraintClass":[["Data","Symbol"],"IsSymbol"],"constraintArgs":[{"tag":"TypeVar","contents":"right"}],"constraintData":null}],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"IsSymbol"]},{"tag":"ParensInType","contents":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"TypeConcat"]},{"tag":"TypeVar","contents":"left"}]},{"tag":"TypeVar","contents":"right"}]}}]}},"sourceSpan":{"start":[18,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/symbols/v3.0.0/src/Data/Symbol.purs","end":[19,100]}}],"comments":"A class for known symbols\n","title":"IsSymbol","info":{"fundeps":[],"arguments":[["sym",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[15,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/symbols/v3.0.0/src/Data/Symbol.purs","end":[16,40]}},{"children":[],"comments":null,"title":"reifySymbol","info":{"declType":"value","type":{"tag":"ForAll","contents":["r",{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeConstructor","contents":[["Prim"],"String"]}]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"ParensInType","contents":{"tag":"ForAll","contents":["sym",{"tag":"ConstrainedType","contents":[{"constraintClass":[["Data","Symbol"],"IsSymbol"],"constraintArgs":[{"tag":"TypeVar","contents":"sym"}],"constraintData":null},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"SProxy"]},{"tag":"TypeVar","contents":"sym"}]}]},{"tag":"TypeVar","contents":"r"}]}]},null]}}]},{"tag":"TypeVar","contents":"r"}]}]},null]}},"sourceSpan":{"start":[21,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/symbols/v3.0.0/src/Data/Symbol.purs","end":[21,86]}}]}],"resolvedDependencies":{"purescript-prelude":"3.0.0","purescript-unsafe-coerce":"3.0.0"},"version":"3.0.0","github":["purescript","purescript-symbols"],"versionTag":"v3.0.0","moduleMap":{"Data.BooleanAlgebra":"purescript-prelude","Data.Ring":"purescript-prelude","Data.Ord":"purescript-prelude","Data.Boolean":"purescript-prelude","Data.Bounded":"purescript-prelude","Data.Show":"purescript-prelude","Control.Apply":"purescript-prelude","Control.Monad":"purescript-prelude","Control.Bind":"purescript-prelude","Data.HeytingAlgebra":"purescript-prelude","Data.Ord.Unsafe":"purescript-prelude","Data.Semigroup":"purescript-prelude","Data.Semiring":"purescript-prelude","Data.CommutativeRing":"purescript-prelude","Data.NaturalTransformation":"purescript-prelude","Data.Functor":"purescript-prelude","Unsafe.Coerce":"purescript-unsafe-coerce","Control.Category":"purescript-prelude","Data.Function":"purescript-prelude","Data.Field":"purescript-prelude","Data.EuclideanRing":"purescript-prelude","Prelude":"purescript-prelude","Data.Eq":"purescript-prelude","Data.Void":"purescript-prelude","Data.Unit":"purescript-prelude","Data.Ordering":"purescript-prelude","Control.Semigroupoid":"purescript-prelude","Control.Applicative":"purescript-prelude"},"compilerVersion":"0.11.3"} \ No newline at end of file
diff --git a/tests/json-compat/v0.12.1/typelevel-prelude-3.0.0.json b/tests/json-compat/v0.12.1/typelevel-prelude-3.0.0.json
new file mode 100644
index 0000000..b6d54ad
--- /dev/null
+++ b/tests/json-compat/v0.12.1/typelevel-prelude-3.0.0.json
@@ -0,0 +1 @@
+{"uploader":"hdgarrood","packageMeta":{"homepage":"https://github.com/purescript/purescript-typelevel-prelude","repository":{"url":"git://github.com/purescript/purescript-typelevel-prelude.git","type":"git"},"ignore":["**/.*","bower_components","node_modules","output","bower.json","package.json"],"dependencies":{"purescript-proxy":"^3.0.0","purescript-type-equality":"^3.0.0","purescript-prelude":"^4.0.0"},"name":"purescript-typelevel-prelude","license":["BSD-3-Clause"],"description":"Types and kinds for basic type-level programming"},"tagTime":"2018-05-22T23:33:44+0000","modules":[{"reExports":[],"name":"Type.Data.Boolean","comments":null,"declarations":[{"children":[],"comments":null,"title":"Boolean","info":{"declType":"kind"},"sourceSpan":{"start":[21,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[21,28]}},{"children":[{"comments":null,"title":"isBooleanTrue","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"IsBoolean"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]}},"sourceSpan":{"start":[32,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[32,41]}},{"comments":null,"title":"andTrue","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"And"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]},{"tag":"TypeVar","contents":"rhs"}]},{"tag":"TypeVar","contents":"rhs"}]}},"sourceSpan":{"start":[45,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[45,37]}},{"comments":null,"title":"orTrue","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"Or"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]},{"tag":"TypeVar","contents":"rhs"}]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]}},"sourceSpan":{"start":[56,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[56,36]}},{"comments":null,"title":"notTrue","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"Not"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]}},"sourceSpan":{"start":[66,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[66,35]}},{"comments":null,"title":"notFalse","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"Not"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]}},"sourceSpan":{"start":[67,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[67,36]}},{"comments":null,"title":"ifTrue","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"If"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]},{"tag":"TypeVar","contents":"onTrue"}]},{"tag":"TypeVar","contents":"onFalse"}]},{"tag":"TypeVar","contents":"onTrue"}]}},"sourceSpan":{"start":[78,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[78,49]}}],"comments":null,"title":"True","info":{"kind":{"tag":"NamedKind","contents":[["Type","Data","Boolean"],"Boolean"]},"declType":"externData"},"sourceSpan":{"start":[22,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[22,36]}},{"children":[{"comments":null,"title":"isBooleanFalse","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"IsBoolean"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]}},"sourceSpan":{"start":[33,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[33,43]}},{"comments":null,"title":"andFalse","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"And"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]},{"tag":"TypeVar","contents":"rhs"}]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]}},"sourceSpan":{"start":[46,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[46,41]}},{"comments":null,"title":"orFalse","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"Or"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]},{"tag":"TypeVar","contents":"rhs"}]},{"tag":"TypeVar","contents":"rhs"}]}},"sourceSpan":{"start":[57,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[57,37]}},{"comments":null,"title":"notTrue","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"Not"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]}},"sourceSpan":{"start":[66,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[66,35]}},{"comments":null,"title":"notFalse","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"Not"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]}},"sourceSpan":{"start":[67,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[67,36]}},{"comments":null,"title":"ifFalse","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"If"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]},{"tag":"TypeVar","contents":"onTrue"}]},{"tag":"TypeVar","contents":"onFalse"}]},{"tag":"TypeVar","contents":"onFalse"}]}},"sourceSpan":{"start":[79,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[79,52]}}],"comments":null,"title":"False","info":{"kind":{"tag":"NamedKind","contents":[["Type","Data","Boolean"],"Boolean"]},"declType":"externData"},"sourceSpan":{"start":[23,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[23,37]}},{"children":[{"comments":null,"title":"BProxy","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null}],"comments":"Value proxy for `Boolean` types\n","title":"BProxy","info":{"declType":"data","dataDeclType":"data","typeArguments":[["bool",{"tag":"NamedKind","contents":[["Type","Data","Boolean"],"Boolean"]}]]},"sourceSpan":{"start":[26,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[26,39]}},{"children":[{"comments":null,"title":"reflectBoolean","info":{"declType":"typeClassMember","type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"BProxy"]},{"tag":"TypeVar","contents":"bool"}]}]},{"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]}},"sourceSpan":{"start":[30,3],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[30,43]}},{"comments":null,"title":"isBooleanTrue","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"IsBoolean"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]}},"sourceSpan":{"start":[32,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[32,41]}},{"comments":null,"title":"isBooleanFalse","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"IsBoolean"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]}},"sourceSpan":{"start":[33,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[33,43]}}],"comments":"Class for reflecting a type level `Boolean` at the value level\n","title":"IsBoolean","info":{"fundeps":[],"arguments":[["bool",{"tag":"NamedKind","contents":[["Type","Data","Boolean"],"Boolean"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[29,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[30,43]}},{"children":[],"comments":"Use a value level `Boolean` as a type-level `Boolean`\n","title":"reifyBoolean","info":{"declType":"value","type":{"tag":"ForAll","contents":["r",{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"ParensInType","contents":{"tag":"ForAll","contents":["o",{"tag":"ConstrainedType","contents":[{"constraintClass":[["Type","Data","Boolean"],"IsBoolean"],"constraintArgs":[{"tag":"TypeVar","contents":"o"}],"constraintData":null},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"BProxy"]},{"tag":"TypeVar","contents":"o"}]}]},{"tag":"TypeVar","contents":"r"}]}]},null]}}]},{"tag":"TypeVar","contents":"r"}]}]},null]}},"sourceSpan":{"start":[36,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[36,83]}},{"children":[{"comments":null,"title":"andTrue","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"And"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]},{"tag":"TypeVar","contents":"rhs"}]},{"tag":"TypeVar","contents":"rhs"}]}},"sourceSpan":{"start":[45,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[45,37]}},{"comments":null,"title":"andFalse","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"And"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]},{"tag":"TypeVar","contents":"rhs"}]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]}},"sourceSpan":{"start":[46,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[46,41]}}],"comments":"And two `Boolean` types together\n","title":"And","info":{"fundeps":[[["lhs","rhs"],["output"]]],"arguments":[["lhs",{"tag":"NamedKind","contents":[["Type","Data","Boolean"],"Boolean"]}],["rhs",{"tag":"NamedKind","contents":[["Type","Data","Boolean"],"Boolean"]}],["output",{"tag":"NamedKind","contents":[["Type","Data","Boolean"],"Boolean"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[41,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[44,28]}},{"children":[],"comments":null,"title":"and","info":{"declType":"value","type":{"tag":"ForAll","contents":["o",{"tag":"ForAll","contents":["r",{"tag":"ForAll","contents":["l",{"tag":"ConstrainedType","contents":[{"constraintClass":[["Type","Data","Boolean"],"And"],"constraintArgs":[{"tag":"TypeVar","contents":"l"},{"tag":"TypeVar","contents":"r"},{"tag":"TypeVar","contents":"o"}],"constraintData":null},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"BProxy"]},{"tag":"TypeVar","contents":"l"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"BProxy"]},{"tag":"TypeVar","contents":"r"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"BProxy"]},{"tag":"TypeVar","contents":"o"}]}]}]}]},null]},null]},null]}},"sourceSpan":{"start":[48,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[48,67]}},{"children":[{"comments":null,"title":"orTrue","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"Or"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]},{"tag":"TypeVar","contents":"rhs"}]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]}},"sourceSpan":{"start":[56,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[56,36]}},{"comments":null,"title":"orFalse","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"Or"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]},{"tag":"TypeVar","contents":"rhs"}]},{"tag":"TypeVar","contents":"rhs"}]}},"sourceSpan":{"start":[57,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[57,37]}}],"comments":"Or two `Boolean` types together\n","title":"Or","info":{"fundeps":[[["lhs","rhs"],["output"]]],"arguments":[["lhs",{"tag":"NamedKind","contents":[["Type","Data","Boolean"],"Boolean"]}],["rhs",{"tag":"NamedKind","contents":[["Type","Data","Boolean"],"Boolean"]}],["output",{"tag":"NamedKind","contents":[["Type","Data","Boolean"],"Boolean"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[52,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[55,27]}},{"children":[],"comments":null,"title":"or","info":{"declType":"value","type":{"tag":"ForAll","contents":["o",{"tag":"ForAll","contents":["r",{"tag":"ForAll","contents":["l",{"tag":"ConstrainedType","contents":[{"constraintClass":[["Type","Data","Boolean"],"Or"],"constraintArgs":[{"tag":"TypeVar","contents":"l"},{"tag":"TypeVar","contents":"r"},{"tag":"TypeVar","contents":"o"}],"constraintData":null},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"BProxy"]},{"tag":"TypeVar","contents":"l"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"BProxy"]},{"tag":"TypeVar","contents":"r"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"BProxy"]},{"tag":"TypeVar","contents":"o"}]}]}]}]},null]},null]},null]}},"sourceSpan":{"start":[59,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[59,65]}},{"children":[{"comments":null,"title":"notTrue","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"Not"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]}},"sourceSpan":{"start":[66,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[66,35]}},{"comments":null,"title":"notFalse","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"Not"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]}},"sourceSpan":{"start":[67,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[67,36]}}],"comments":"Not a `Boolean`\n","title":"Not","info":{"fundeps":[[["bool"],["output"]]],"arguments":[["bool",{"tag":"NamedKind","contents":[["Type","Data","Boolean"],"Boolean"]}],["output",{"tag":"NamedKind","contents":[["Type","Data","Boolean"],"Boolean"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[63,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[65,25]}},{"children":[],"comments":null,"title":"not","info":{"declType":"value","type":{"tag":"ForAll","contents":["o",{"tag":"ForAll","contents":["i",{"tag":"ConstrainedType","contents":[{"constraintClass":[["Type","Data","Boolean"],"Not"],"constraintArgs":[{"tag":"TypeVar","contents":"i"},{"tag":"TypeVar","contents":"o"}],"constraintData":null},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"BProxy"]},{"tag":"TypeVar","contents":"i"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"BProxy"]},{"tag":"TypeVar","contents":"o"}]}]}]},null]},null]}},"sourceSpan":{"start":[69,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[69,51]}},{"children":[{"comments":null,"title":"ifTrue","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"If"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]},{"tag":"TypeVar","contents":"onTrue"}]},{"tag":"TypeVar","contents":"onFalse"}]},{"tag":"TypeVar","contents":"onTrue"}]}},"sourceSpan":{"start":[78,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[78,49]}},{"comments":null,"title":"ifFalse","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"If"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]},{"tag":"TypeVar","contents":"onTrue"}]},{"tag":"TypeVar","contents":"onFalse"}]},{"tag":"TypeVar","contents":"onFalse"}]}},"sourceSpan":{"start":[79,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[79,52]}}],"comments":"If - dispatch based on a boolean\n","title":"If","info":{"fundeps":[[["bool","onTrue","onFalse"],["output"]]],"arguments":[["bool",{"tag":"NamedKind","contents":[["Type","Data","Boolean"],"Boolean"]}],["onTrue",{"tag":"NamedKind","contents":[["Prim"],"Type"]}],["onFalse",{"tag":"NamedKind","contents":[["Prim"],"Type"]}],["output",{"tag":"NamedKind","contents":[["Prim"],"Type"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[73,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[77,39]}},{"children":[],"comments":null,"title":"if_","info":{"declType":"value","type":{"tag":"ForAll","contents":["o",{"tag":"ForAll","contents":["e",{"tag":"ForAll","contents":["t",{"tag":"ForAll","contents":["b",{"tag":"ConstrainedType","contents":[{"constraintClass":[["Type","Data","Boolean"],"If"],"constraintArgs":[{"tag":"TypeVar","contents":"b"},{"tag":"TypeVar","contents":"t"},{"tag":"TypeVar","contents":"e"},{"tag":"TypeVar","contents":"o"}],"constraintData":null},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"BProxy"]},{"tag":"TypeVar","contents":"b"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"tag":"TypeVar","contents":"t"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"tag":"TypeVar","contents":"e"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"tag":"TypeVar","contents":"o"}]}]}]}]}]},null]},null]},null]},null]}},"sourceSpan":{"start":[81,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[81,79]}}]},{"reExports":[{"moduleName":{"package":null,"item":["Prim","Ordering"]},"declarations":[{"children":[],"comments":"The 'less than' ordering type.\n","title":"LT","info":{"kind":{"tag":"NamedKind","contents":[["Prim","Ordering"],"Ordering"]},"declType":"externData"},"sourceSpan":null},{"children":[],"comments":"The 'greater than' ordering type.\n","title":"GT","info":{"kind":{"tag":"NamedKind","contents":[["Prim","Ordering"],"Ordering"]},"declType":"externData"},"sourceSpan":null},{"children":[],"comments":"The 'equal to' ordering type.\n","title":"EQ","info":{"kind":{"tag":"NamedKind","contents":[["Prim","Ordering"],"Ordering"]},"declType":"externData"},"sourceSpan":null},{"children":[],"comments":"The `Ordering` kind represents the three possibilites of comparing two\ntypes of the same kind: `LT` (less than), `EQ` (equal to), and\n`GT` (greater than).\n","title":"Ordering","info":{"declType":"kind"},"sourceSpan":null}]}],"name":"Type.Data.Ordering","comments":null,"declarations":[{"children":[{"comments":null,"title":"OProxy","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null}],"comments":"Value proxy for `Ordering` types\n","title":"OProxy","info":{"declType":"data","dataDeclType":"data","typeArguments":[["ordering",{"tag":"NamedKind","contents":[["Prim","Ordering"],"Ordering"]}]]},"sourceSpan":{"start":[20,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[20,44]}},{"children":[{"comments":null,"title":"reflectOrdering","info":{"declType":"typeClassMember","type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"OProxy"]},{"tag":"TypeVar","contents":"ordering"}]}]},{"tag":"TypeConstructor","contents":[["Data","Ordering"],"Ordering"]}]}},"sourceSpan":{"start":[24,3],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[24,49]}},{"comments":null,"title":"isOrderingLT","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"IsOrdering"]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"LT"]}]}},"sourceSpan":{"start":[26,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[26,39]}},{"comments":null,"title":"isOrderingEQ","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"IsOrdering"]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"EQ"]}]}},"sourceSpan":{"start":[27,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[27,39]}},{"comments":null,"title":"isOrderingGT","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"IsOrdering"]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"GT"]}]}},"sourceSpan":{"start":[28,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[28,39]}}],"comments":"Class for reflecting a type level `Ordering` at the value level\n","title":"IsOrdering","info":{"fundeps":[],"arguments":[["ordering",{"tag":"NamedKind","contents":[["Prim","Ordering"],"Ordering"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[23,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[24,49]}},{"children":[],"comments":"Use a value level `Ordering` as a type-level `Ordering`\n","title":"reifyOrdering","info":{"declType":"value","type":{"tag":"ForAll","contents":["r",{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeConstructor","contents":[["Data","Ordering"],"Ordering"]}]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"ParensInType","contents":{"tag":"ForAll","contents":["o",{"tag":"ConstrainedType","contents":[{"constraintClass":[["Type","Data","Ordering"],"IsOrdering"],"constraintArgs":[{"tag":"TypeVar","contents":"o"}],"constraintData":null},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"OProxy"]},{"tag":"TypeVar","contents":"o"}]}]},{"tag":"TypeVar","contents":"r"}]}]},null]}}]},{"tag":"TypeVar","contents":"r"}]}]},null]}},"sourceSpan":{"start":[31,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[31,86]}},{"children":[{"comments":null,"title":"appendOrderingLT","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"Append"]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"LT"]}]},{"tag":"TypeVar","contents":"rhs"}]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"LT"]}]}},"sourceSpan":{"start":[42,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[42,46]}},{"comments":null,"title":"appendOrderingEQ","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"Append"]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"EQ"]}]},{"tag":"TypeVar","contents":"rhs"}]},{"tag":"TypeVar","contents":"rhs"}]}},"sourceSpan":{"start":[43,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[43,47]}},{"comments":null,"title":"appendOrderingGT","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"Append"]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"GT"]}]},{"tag":"TypeVar","contents":"rhs"}]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"GT"]}]}},"sourceSpan":{"start":[44,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[44,46]}}],"comments":"Append two `Ordering` types together\nReflective of the semigroup for value level `Ordering`\n","title":"Append","info":{"fundeps":[[["lhs"],["rhs","output"]]],"arguments":[["lhs",{"tag":"NamedKind","contents":[["Prim","Ordering"],"Ordering"]}],["rhs",{"tag":"NamedKind","contents":[["Prim","Ordering"],"Ordering"]}],["output",{"tag":"NamedKind","contents":[["Prim","Ordering"],"Ordering"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[38,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[41,31]}},{"children":[],"comments":null,"title":"append","info":{"declType":"value","type":{"tag":"ForAll","contents":["o",{"tag":"ForAll","contents":["r",{"tag":"ForAll","contents":["l",{"tag":"ConstrainedType","contents":[{"constraintClass":[["Type","Data","Ordering"],"Append"],"constraintArgs":[{"tag":"TypeVar","contents":"l"},{"tag":"TypeVar","contents":"r"},{"tag":"TypeVar","contents":"o"}],"constraintData":null},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"OProxy"]},{"tag":"TypeVar","contents":"l"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"OProxy"]},{"tag":"TypeVar","contents":"r"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"OProxy"]},{"tag":"TypeVar","contents":"o"}]}]}]}]},null]},null]},null]}},"sourceSpan":{"start":[46,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[46,73]}},{"children":[{"comments":null,"title":"invertOrderingLT","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"Invert"]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"LT"]}]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"GT"]}]}},"sourceSpan":{"start":[53,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[53,42]}},{"comments":null,"title":"invertOrderingEQ","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"Invert"]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"EQ"]}]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"EQ"]}]}},"sourceSpan":{"start":[54,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[54,42]}},{"comments":null,"title":"invertOrderingGT","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"Invert"]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"GT"]}]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"LT"]}]}},"sourceSpan":{"start":[55,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[55,42]}}],"comments":"Invert an `Ordering`\n","title":"Invert","info":{"fundeps":[[["ordering"],["result"]]],"arguments":[["ordering",{"tag":"NamedKind","contents":[["Prim","Ordering"],"Ordering"]}],["result",{"tag":"NamedKind","contents":[["Prim","Ordering"],"Ordering"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[50,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[52,32]}},{"children":[],"comments":null,"title":"invert","info":{"declType":"value","type":{"tag":"ForAll","contents":["o",{"tag":"ForAll","contents":["i",{"tag":"ConstrainedType","contents":[{"constraintClass":[["Type","Data","Ordering"],"Invert"],"constraintArgs":[{"tag":"TypeVar","contents":"i"},{"tag":"TypeVar","contents":"o"}],"constraintData":null},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"OProxy"]},{"tag":"TypeVar","contents":"i"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"OProxy"]},{"tag":"TypeVar","contents":"o"}]}]}]},null]},null]}},"sourceSpan":{"start":[57,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[57,57]}},{"children":[{"comments":null,"title":"equalsEQEQ","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"Equals"]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"EQ"]}]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"EQ"]}]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]}},"sourceSpan":{"start":[65,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[65,41]}},{"comments":null,"title":"equalsLTLT","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"Equals"]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"LT"]}]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"LT"]}]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]}},"sourceSpan":{"start":[66,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[66,41]}},{"comments":null,"title":"equalsGTGT","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"Equals"]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"GT"]}]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"GT"]}]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]}},"sourceSpan":{"start":[67,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[67,41]}},{"comments":null,"title":"equalsEQLT","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"Equals"]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"EQ"]}]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"LT"]}]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]}},"sourceSpan":{"start":[68,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[68,42]}},{"comments":null,"title":"equalsEQGT","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"Equals"]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"EQ"]}]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"GT"]}]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]}},"sourceSpan":{"start":[69,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[69,42]}},{"comments":null,"title":"equalsLTEQ","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"Equals"]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"LT"]}]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"EQ"]}]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]}},"sourceSpan":{"start":[70,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[70,42]}},{"comments":null,"title":"equalsLTGT","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"Equals"]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"LT"]}]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"GT"]}]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]}},"sourceSpan":{"start":[71,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[71,42]}},{"comments":null,"title":"equalsGTLT","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"Equals"]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"GT"]}]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"LT"]}]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]}},"sourceSpan":{"start":[72,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[72,42]}},{"comments":null,"title":"equalsGTEQ","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"Equals"]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"GT"]}]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"EQ"]}]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]}},"sourceSpan":{"start":[73,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[73,42]}}],"comments":null,"title":"Equals","info":{"fundeps":[[["lhs","rhs"],["out"]]],"arguments":[["lhs",{"tag":"NamedKind","contents":[["Prim","Ordering"],"Ordering"]}],["rhs",{"tag":"NamedKind","contents":[["Prim","Ordering"],"Ordering"]}],["out",{"tag":"NamedKind","contents":[["Type","Data","Boolean"],"Boolean"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[60,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[63,28]}},{"children":[],"comments":null,"title":"equals","info":{"declType":"value","type":{"tag":"ForAll","contents":["o",{"tag":"ForAll","contents":["r",{"tag":"ForAll","contents":["l",{"tag":"ConstrainedType","contents":[{"constraintClass":[["Type","Data","Ordering"],"Equals"],"constraintArgs":[{"tag":"TypeVar","contents":"l"},{"tag":"TypeVar","contents":"r"},{"tag":"TypeVar","contents":"o"}],"constraintData":null},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"OProxy"]},{"tag":"TypeVar","contents":"l"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"OProxy"]},{"tag":"TypeVar","contents":"r"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"BProxy"]},{"tag":"TypeVar","contents":"o"}]}]}]}]},null]},null]},null]}},"sourceSpan":{"start":[75,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[75,73]}}]},{"reExports":[{"moduleName":{"package":"purescript-prelude","item":["Data","Symbol"]},"declarations":[{"children":[{"comments":null,"title":"SProxy","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null}],"comments":"A value-level proxy for a type-level symbol.\n","title":"SProxy","info":{"declType":"data","dataDeclType":"data","typeArguments":[["sym",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}]]},"sourceSpan":{"start":[9,1],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-prelude/src/Data/Symbol.purs","end":[9,37]}},{"children":[{"comments":null,"title":"reflectSymbol","info":{"declType":"typeClassMember","type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"SProxy"]},{"tag":"TypeVar","contents":"sym"}]}]},{"tag":"TypeConstructor","contents":[["Prim"],"String"]}]}},"sourceSpan":{"start":[13,3],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-prelude/src/Data/Symbol.purs","end":[13,40]}}],"comments":"A class for known symbols\n","title":"IsSymbol","info":{"fundeps":[],"arguments":[["sym",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[12,1],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-prelude/src/Data/Symbol.purs","end":[13,40]}},{"children":[],"comments":null,"title":"reifySymbol","info":{"declType":"value","type":{"tag":"ForAll","contents":["r",{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeConstructor","contents":[["Prim"],"String"]}]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"ParensInType","contents":{"tag":"ForAll","contents":["sym",{"tag":"ConstrainedType","contents":[{"constraintClass":[["Data","Symbol"],"IsSymbol"],"constraintArgs":[{"tag":"TypeVar","contents":"sym"}],"constraintData":null},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"SProxy"]},{"tag":"TypeVar","contents":"sym"}]}]},{"tag":"TypeVar","contents":"r"}]}]},null]}}]},{"tag":"TypeVar","contents":"r"}]}]},null]}},"sourceSpan":{"start":[18,1],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-prelude/src/Data/Symbol.purs","end":[18,86]}}]},{"moduleName":{"package":null,"item":["Prim","Symbol"]},"declarations":[{"children":[],"comments":"Compiler solved type class for appending `Symbol`s together.\n","title":"Append","info":{"fundeps":[[["left","right"],["appended"]],[["right","appended"],["left"]],[["appended","left"],["right"]]],"arguments":[["left",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}],["right",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}],["appended",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":null},{"children":[],"comments":"Compiler solved type class for comparing two `Symbol`s.\nProduces an `Ordering`.\n","title":"Compare","info":{"fundeps":[[["left","right"],["ordering"]]],"arguments":[["left",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}],["right",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}],["ordering",{"tag":"NamedKind","contents":[["Prim","Ordering"],"Ordering"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":null},{"children":[],"comments":"Compiler solved type class for either splitting up a symbol into its\nhead and tail or for combining a head and tail into a new symbol.\nRequires the head to be a single character and the combined string\ncannot be empty.\n","title":"Cons","info":{"fundeps":[[["head","tail"],["symbol"]],[["symbol"],["head","tail"]]],"arguments":[["head",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}],["tail",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}],["symbol",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":null}]}],"name":"Type.Data.Symbol","comments":null,"declarations":[{"children":[],"comments":null,"title":"append","info":{"declType":"value","type":{"tag":"ForAll","contents":["o",{"tag":"ForAll","contents":["r",{"tag":"ForAll","contents":["l",{"tag":"ConstrainedType","contents":[{"constraintClass":[["Prim","Symbol"],"Append"],"constraintArgs":[{"tag":"TypeVar","contents":"l"},{"tag":"TypeVar","contents":"r"},{"tag":"TypeVar","contents":"o"}],"constraintData":null},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"SProxy"]},{"tag":"TypeVar","contents":"l"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"SProxy"]},{"tag":"TypeVar","contents":"r"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"SProxy"]},{"tag":"TypeVar","contents":"o"}]}]}]}]},null]},null]},null]}},"sourceSpan":{"start":[20,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Symbol.purs","end":[20,73]}},{"children":[],"comments":null,"title":"compare","info":{"declType":"value","type":{"tag":"ForAll","contents":["o",{"tag":"ForAll","contents":["r",{"tag":"ForAll","contents":["l",{"tag":"ConstrainedType","contents":[{"constraintClass":[["Prim","Symbol"],"Compare"],"constraintArgs":[{"tag":"TypeVar","contents":"l"},{"tag":"TypeVar","contents":"r"},{"tag":"TypeVar","contents":"o"}],"constraintData":null},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"SProxy"]},{"tag":"TypeVar","contents":"l"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"SProxy"]},{"tag":"TypeVar","contents":"r"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"OProxy"]},{"tag":"TypeVar","contents":"o"}]}]}]}]},null]},null]},null]}},"sourceSpan":{"start":[17,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Symbol.purs","end":[17,75]}},{"children":[],"comments":null,"title":"uncons","info":{"declType":"value","type":{"tag":"ForAll","contents":["s",{"tag":"ForAll","contents":["t",{"tag":"ForAll","contents":["h",{"tag":"ConstrainedType","contents":[{"constraintClass":[["Prim","Symbol"],"Cons"],"constraintArgs":[{"tag":"TypeVar","contents":"h"},{"tag":"TypeVar","contents":"t"},{"tag":"TypeVar","contents":"s"}],"constraintData":null},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"SProxy"]},{"tag":"TypeVar","contents":"s"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"tag":"RCons","contents":["head",{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"SProxy"]},{"tag":"TypeVar","contents":"h"}]},{"tag":"RCons","contents":["tail",{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"SProxy"]},{"tag":"TypeVar","contents":"t"}]},{"tag":"REmpty"}]}]}]}]}]},null]},null]},null]}},"sourceSpan":{"start":[23,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Symbol.purs","end":[23,87]}},{"children":[{"comments":null,"title":"equalsSymbol","info":{"declType":"instance","dependencies":[{"constraintClass":[["Prim","Symbol"],"Compare"],"constraintArgs":[{"tag":"TypeVar","contents":"lhs"},{"tag":"TypeVar","contents":"rhs"},{"tag":"TypeVar","contents":"ord"}],"constraintData":null},{"constraintClass":[["Type","Data","Ordering"],"Equals"],"constraintArgs":[{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"EQ"]},{"tag":"TypeVar","contents":"ord"},{"tag":"TypeVar","contents":"out"}],"constraintData":null}],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Symbol"],"Equals"]},{"tag":"TypeVar","contents":"lhs"}]},{"tag":"TypeVar","contents":"rhs"}]},{"tag":"TypeVar","contents":"out"}]}},"sourceSpan":{"start":[31,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Symbol.purs","end":[34,24]}}],"comments":null,"title":"Equals","info":{"fundeps":[[["lhs","rhs"],["out"]]],"arguments":[["lhs",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}],["rhs",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}],["out",{"tag":"NamedKind","contents":[["Type","Data","Boolean"],"Boolean"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[26,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Symbol.purs","end":[29,28]}},{"children":[],"comments":null,"title":"equals","info":{"declType":"value","type":{"tag":"ForAll","contents":["o",{"tag":"ForAll","contents":["r",{"tag":"ForAll","contents":["l",{"tag":"ConstrainedType","contents":[{"constraintClass":[["Type","Data","Symbol"],"Equals"],"constraintArgs":[{"tag":"TypeVar","contents":"l"},{"tag":"TypeVar","contents":"r"},{"tag":"TypeVar","contents":"o"}],"constraintData":null},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"SProxy"]},{"tag":"TypeVar","contents":"l"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"SProxy"]},{"tag":"TypeVar","contents":"r"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"BProxy"]},{"tag":"TypeVar","contents":"o"}]}]}]}]},null]},null]},null]}},"sourceSpan":{"start":[36,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Symbol.purs","end":[36,73]}}]},{"reExports":[{"moduleName":{"package":null,"item":["Type","Data","Boolean"]},"declarations":[{"children":[{"comments":null,"title":"isBooleanTrue","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"IsBoolean"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]}},"sourceSpan":{"start":[32,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[32,41]}},{"comments":null,"title":"andTrue","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"And"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]},{"tag":"TypeVar","contents":"rhs"}]},{"tag":"TypeVar","contents":"rhs"}]}},"sourceSpan":{"start":[45,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[45,37]}},{"comments":null,"title":"orTrue","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"Or"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]},{"tag":"TypeVar","contents":"rhs"}]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]}},"sourceSpan":{"start":[56,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[56,36]}},{"comments":null,"title":"notTrue","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"Not"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]}},"sourceSpan":{"start":[66,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[66,35]}},{"comments":null,"title":"notFalse","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"Not"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]}},"sourceSpan":{"start":[67,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[67,36]}},{"comments":null,"title":"ifTrue","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"If"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]},{"tag":"TypeVar","contents":"onTrue"}]},{"tag":"TypeVar","contents":"onFalse"}]},{"tag":"TypeVar","contents":"onTrue"}]}},"sourceSpan":{"start":[78,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[78,49]}}],"comments":null,"title":"True","info":{"kind":{"tag":"NamedKind","contents":[["Type","Data","Boolean"],"Boolean"]},"declType":"externData"},"sourceSpan":{"start":[22,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[22,36]}},{"children":[{"comments":null,"title":"isBooleanFalse","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"IsBoolean"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]}},"sourceSpan":{"start":[33,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[33,43]}},{"comments":null,"title":"andFalse","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"And"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]},{"tag":"TypeVar","contents":"rhs"}]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]}},"sourceSpan":{"start":[46,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[46,41]}},{"comments":null,"title":"orFalse","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"Or"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]},{"tag":"TypeVar","contents":"rhs"}]},{"tag":"TypeVar","contents":"rhs"}]}},"sourceSpan":{"start":[57,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[57,37]}},{"comments":null,"title":"notTrue","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"Not"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]}},"sourceSpan":{"start":[66,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[66,35]}},{"comments":null,"title":"notFalse","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"Not"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]}},"sourceSpan":{"start":[67,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[67,36]}},{"comments":null,"title":"ifFalse","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"If"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]},{"tag":"TypeVar","contents":"onTrue"}]},{"tag":"TypeVar","contents":"onFalse"}]},{"tag":"TypeVar","contents":"onFalse"}]}},"sourceSpan":{"start":[79,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[79,52]}}],"comments":null,"title":"False","info":{"kind":{"tag":"NamedKind","contents":[["Type","Data","Boolean"],"Boolean"]},"declType":"externData"},"sourceSpan":{"start":[23,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[23,37]}},{"children":[{"comments":null,"title":"BProxy","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null}],"comments":"Value proxy for `Boolean` types\n","title":"BProxy","info":{"declType":"data","dataDeclType":"data","typeArguments":[["bool",{"tag":"NamedKind","contents":[["Type","Data","Boolean"],"Boolean"]}]]},"sourceSpan":{"start":[26,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[26,39]}},{"children":[{"comments":null,"title":"reflectBoolean","info":{"declType":"typeClassMember","type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"BProxy"]},{"tag":"TypeVar","contents":"bool"}]}]},{"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]}},"sourceSpan":{"start":[30,3],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[30,43]}},{"comments":null,"title":"isBooleanTrue","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"IsBoolean"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]}},"sourceSpan":{"start":[32,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[32,41]}},{"comments":null,"title":"isBooleanFalse","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"IsBoolean"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]}},"sourceSpan":{"start":[33,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[33,43]}}],"comments":"Class for reflecting a type level `Boolean` at the value level\n","title":"IsBoolean","info":{"fundeps":[],"arguments":[["bool",{"tag":"NamedKind","contents":[["Type","Data","Boolean"],"Boolean"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[29,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[30,43]}},{"children":[],"comments":"Use a value level `Boolean` as a type-level `Boolean`\n","title":"reifyBoolean","info":{"declType":"value","type":{"tag":"ForAll","contents":["r",{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"ParensInType","contents":{"tag":"ForAll","contents":["o",{"tag":"ConstrainedType","contents":[{"constraintClass":[["Type","Data","Boolean"],"IsBoolean"],"constraintArgs":[{"tag":"TypeVar","contents":"o"}],"constraintData":null},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"BProxy"]},{"tag":"TypeVar","contents":"o"}]}]},{"tag":"TypeVar","contents":"r"}]}]},null]}}]},{"tag":"TypeVar","contents":"r"}]}]},null]}},"sourceSpan":{"start":[36,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[36,83]}},{"children":[],"comments":null,"title":"Boolean","info":{"declType":"kind"},"sourceSpan":{"start":[21,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[21,28]}}]},{"moduleName":{"package":null,"item":["Type","Data","Ordering"]},"declarations":[{"children":[{"comments":null,"title":"OProxy","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null}],"comments":"Value proxy for `Ordering` types\n","title":"OProxy","info":{"declType":"data","dataDeclType":"data","typeArguments":[["ordering",{"tag":"NamedKind","contents":[["Prim","Ordering"],"Ordering"]}]]},"sourceSpan":{"start":[20,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[20,44]}},{"children":[],"comments":"The 'less than' ordering type.\n","title":"LT","info":{"kind":{"tag":"NamedKind","contents":[["Prim","Ordering"],"Ordering"]},"declType":"externData"},"sourceSpan":null},{"children":[],"comments":"The 'greater than' ordering type.\n","title":"GT","info":{"kind":{"tag":"NamedKind","contents":[["Prim","Ordering"],"Ordering"]},"declType":"externData"},"sourceSpan":null},{"children":[],"comments":"The 'equal to' ordering type.\n","title":"EQ","info":{"kind":{"tag":"NamedKind","contents":[["Prim","Ordering"],"Ordering"]},"declType":"externData"},"sourceSpan":null},{"children":[{"comments":null,"title":"reflectOrdering","info":{"declType":"typeClassMember","type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"OProxy"]},{"tag":"TypeVar","contents":"ordering"}]}]},{"tag":"TypeConstructor","contents":[["Data","Ordering"],"Ordering"]}]}},"sourceSpan":{"start":[24,3],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[24,49]}},{"comments":null,"title":"isOrderingLT","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"IsOrdering"]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"LT"]}]}},"sourceSpan":{"start":[26,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[26,39]}},{"comments":null,"title":"isOrderingEQ","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"IsOrdering"]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"EQ"]}]}},"sourceSpan":{"start":[27,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[27,39]}},{"comments":null,"title":"isOrderingGT","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"IsOrdering"]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"GT"]}]}},"sourceSpan":{"start":[28,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[28,39]}}],"comments":"Class for reflecting a type level `Ordering` at the value level\n","title":"IsOrdering","info":{"fundeps":[],"arguments":[["ordering",{"tag":"NamedKind","contents":[["Prim","Ordering"],"Ordering"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[23,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[24,49]}},{"children":[],"comments":"Use a value level `Ordering` as a type-level `Ordering`\n","title":"reifyOrdering","info":{"declType":"value","type":{"tag":"ForAll","contents":["r",{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeConstructor","contents":[["Data","Ordering"],"Ordering"]}]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"ParensInType","contents":{"tag":"ForAll","contents":["o",{"tag":"ConstrainedType","contents":[{"constraintClass":[["Type","Data","Ordering"],"IsOrdering"],"constraintArgs":[{"tag":"TypeVar","contents":"o"}],"constraintData":null},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"OProxy"]},{"tag":"TypeVar","contents":"o"}]}]},{"tag":"TypeVar","contents":"r"}]}]},null]}}]},{"tag":"TypeVar","contents":"r"}]}]},null]}},"sourceSpan":{"start":[31,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[31,86]}},{"children":[],"comments":"The `Ordering` kind represents the three possibilites of comparing two\ntypes of the same kind: `LT` (less than), `EQ` (equal to), and\n`GT` (greater than).\n","title":"Ordering","info":{"declType":"kind"},"sourceSpan":null}]},{"moduleName":{"package":null,"item":["Type","Data","Symbol"]},"declarations":[{"children":[{"comments":null,"title":"SProxy","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null}],"comments":"A value-level proxy for a type-level symbol.\n","title":"SProxy","info":{"declType":"data","dataDeclType":"data","typeArguments":[["sym",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}]]},"sourceSpan":{"start":[9,1],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-prelude/src/Data/Symbol.purs","end":[9,37]}},{"children":[],"comments":"Compiler solved type class for appending `Symbol`s together.\n","title":"Append","info":{"fundeps":[[["left","right"],["appended"]],[["right","appended"],["left"]],[["appended","left"],["right"]]],"arguments":[["left",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}],["right",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}],["appended",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":null},{"children":[],"comments":"Compiler solved type class for comparing two `Symbol`s.\nProduces an `Ordering`.\n","title":"Compare","info":{"fundeps":[[["left","right"],["ordering"]]],"arguments":[["left",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}],["right",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}],["ordering",{"tag":"NamedKind","contents":[["Prim","Ordering"],"Ordering"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":null},{"children":[{"comments":null,"title":"reflectSymbol","info":{"declType":"typeClassMember","type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"SProxy"]},{"tag":"TypeVar","contents":"sym"}]}]},{"tag":"TypeConstructor","contents":[["Prim"],"String"]}]}},"sourceSpan":{"start":[13,3],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-prelude/src/Data/Symbol.purs","end":[13,40]}}],"comments":"A class for known symbols\n","title":"IsSymbol","info":{"fundeps":[],"arguments":[["sym",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[12,1],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-prelude/src/Data/Symbol.purs","end":[13,40]}},{"children":[],"comments":null,"title":"reifySymbol","info":{"declType":"value","type":{"tag":"ForAll","contents":["r",{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeConstructor","contents":[["Prim"],"String"]}]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"ParensInType","contents":{"tag":"ForAll","contents":["sym",{"tag":"ConstrainedType","contents":[{"constraintClass":[["Data","Symbol"],"IsSymbol"],"constraintArgs":[{"tag":"TypeVar","contents":"sym"}],"constraintData":null},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"SProxy"]},{"tag":"TypeVar","contents":"sym"}]}]},{"tag":"TypeVar","contents":"r"}]}]},null]}}]},{"tag":"TypeVar","contents":"r"}]}]},null]}},"sourceSpan":{"start":[18,1],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-prelude/src/Data/Symbol.purs","end":[18,86]}},{"children":[],"comments":null,"title":"compare","info":{"declType":"value","type":{"tag":"ForAll","contents":["o",{"tag":"ForAll","contents":["r",{"tag":"ForAll","contents":["l",{"tag":"ConstrainedType","contents":[{"constraintClass":[["Prim","Symbol"],"Compare"],"constraintArgs":[{"tag":"TypeVar","contents":"l"},{"tag":"TypeVar","contents":"r"},{"tag":"TypeVar","contents":"o"}],"constraintData":null},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"SProxy"]},{"tag":"TypeVar","contents":"l"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"SProxy"]},{"tag":"TypeVar","contents":"r"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"OProxy"]},{"tag":"TypeVar","contents":"o"}]}]}]}]},null]},null]},null]}},"sourceSpan":{"start":[17,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Symbol.purs","end":[17,75]}},{"children":[],"comments":null,"title":"append","info":{"declType":"value","type":{"tag":"ForAll","contents":["o",{"tag":"ForAll","contents":["r",{"tag":"ForAll","contents":["l",{"tag":"ConstrainedType","contents":[{"constraintClass":[["Prim","Symbol"],"Append"],"constraintArgs":[{"tag":"TypeVar","contents":"l"},{"tag":"TypeVar","contents":"r"},{"tag":"TypeVar","contents":"o"}],"constraintData":null},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"SProxy"]},{"tag":"TypeVar","contents":"l"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"SProxy"]},{"tag":"TypeVar","contents":"r"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"SProxy"]},{"tag":"TypeVar","contents":"o"}]}]}]}]},null]},null]},null]}},"sourceSpan":{"start":[20,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Symbol.purs","end":[20,73]}}]},{"moduleName":{"package":"purescript-type-equality","item":["Type","Equality"]},"declarations":[{"children":[{"comments":null,"title":"to","info":{"declType":"typeClassMember","type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeVar","contents":"a"}]},{"tag":"TypeVar","contents":"b"}]}},"sourceSpan":{"start":[18,3],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-type-equality/src/Type/Equality.purs","end":[18,15]}},{"comments":null,"title":"from","info":{"declType":"typeClassMember","type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeVar","contents":"b"}]},{"tag":"TypeVar","contents":"a"}]}},"sourceSpan":{"start":[19,3],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-type-equality/src/Type/Equality.purs","end":[19,17]}},{"comments":null,"title":"refl","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Equality"],"TypeEquals"]},{"tag":"TypeVar","contents":"a"}]},{"tag":"TypeVar","contents":"a"}]}},"sourceSpan":{"start":[21,1],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-type-equality/src/Type/Equality.purs","end":[21,32]}}],"comments":"This type class asserts that types `a` and `b`\nare equal.\n\nThe functional dependencies and the single\ninstance below will force the two type arguments\nto unify when either one is known.\n\nNote: any instance will necessarily overlap with\n`refl` below, so instances of this class should\nnot be defined in libraries.\n","title":"TypeEquals","info":{"fundeps":[[["a"],["b"]],[["b"],["a"]]],"arguments":[["a",null],["b",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[17,1],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-type-equality/src/Type/Equality.purs","end":[19,17]}}]},{"moduleName":{"package":"purescript-proxy","item":["Type","Proxy"]},"declarations":[{"children":[{"comments":null,"title":"Proxy","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"eqProxy","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Eq"],"Eq"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[56,8],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-proxy/src/Type/Proxy.purs","end":[56,40]}},{"comments":null,"title":"functorProxy","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Functor"],"Functor"]},{"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]}]}},"sourceSpan":{"start":[58,8],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-proxy/src/Type/Proxy.purs","end":[58,46]}},{"comments":null,"title":"ordProxy","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[60,8],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-proxy/src/Type/Proxy.purs","end":[60,42]}},{"comments":null,"title":"applicativeProxy","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Control","Applicative"],"Applicative"]},{"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]}]}},"sourceSpan":{"start":[62,1],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-proxy/src/Type/Proxy.purs","end":[62,47]}},{"comments":null,"title":"applyProxy","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Control","Apply"],"Apply"]},{"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]}]}},"sourceSpan":{"start":[65,1],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-proxy/src/Type/Proxy.purs","end":[65,35]}},{"comments":null,"title":"bindProxy","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Control","Bind"],"Bind"]},{"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]}]}},"sourceSpan":{"start":[68,1],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-proxy/src/Type/Proxy.purs","end":[68,33]}},{"comments":null,"title":"booleanAlgebraProxy","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","BooleanAlgebra"],"BooleanAlgebra"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[71,1],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-proxy/src/Type/Proxy.purs","end":[71,57]}},{"comments":null,"title":"boundedProxy","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Bounded"],"Bounded"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[73,1],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-proxy/src/Type/Proxy.purs","end":[73,43]}},{"comments":null,"title":"commutativeRingProxy","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","CommutativeRing"],"CommutativeRing"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[77,1],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-proxy/src/Type/Proxy.purs","end":[77,59]}},{"comments":null,"title":"discardProxy","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Control","Bind"],"Discard"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[79,1],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-proxy/src/Type/Proxy.purs","end":[79,43]}},{"comments":null,"title":"heytingAlgebraProxy","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","HeytingAlgebra"],"HeytingAlgebra"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[82,1],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-proxy/src/Type/Proxy.purs","end":[82,57]}},{"comments":null,"title":"monadProxy","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Control","Monad"],"Monad"]},{"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]}]}},"sourceSpan":{"start":[90,1],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-proxy/src/Type/Proxy.purs","end":[90,35]}},{"comments":null,"title":"ringProxy","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Ring"],"Ring"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[92,1],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-proxy/src/Type/Proxy.purs","end":[92,37]}},{"comments":null,"title":"semigroupProxy","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Semigroup"],"Semigroup"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[95,1],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-proxy/src/Type/Proxy.purs","end":[95,47]}},{"comments":null,"title":"semiringProxy","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[98,1],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-proxy/src/Type/Proxy.purs","end":[98,45]}},{"comments":null,"title":"showProxy","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Show"],"Show"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[104,1],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-proxy/src/Type/Proxy.purs","end":[104,37]}}],"comments":"Value proxy for kind `Type` types.\n","title":"Proxy","info":{"declType":"data","dataDeclType":"data","typeArguments":[["a",null]]},"sourceSpan":{"start":[54,1],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-proxy/src/Type/Proxy.purs","end":[54,21]}}]},{"moduleName":{"package":null,"item":["Type","Row"]},"declarations":[{"children":[{"comments":null,"title":"RProxy","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null}],"comments":null,"title":"RProxy","info":{"declType":"data","dataDeclType":"data","typeArguments":[["row",{"tag":"Row","contents":{"tag":"NamedKind","contents":[["Prim"],"Type"]}}]]},"sourceSpan":{"start":[21,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row.purs","end":[21,37]}},{"children":[{"comments":null,"title":"RLProxy","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null}],"comments":null,"title":"RLProxy","info":{"declType":"data","dataDeclType":"data","typeArguments":[["rowList",{"tag":"NamedKind","contents":[["Prim","RowList"],"RowList"]}]]},"sourceSpan":{"start":[23,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row.purs","end":[23,44]}},{"children":[],"comments":"The Lacks type class asserts that a label does not occur in a given row.\n","title":"Lacks","info":{"fundeps":[],"arguments":[["label",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}],["row",{"tag":"Row","contents":{"tag":"NamedKind","contents":[["Prim"],"Type"]}}]],"declType":"typeClass","superclasses":[]},"sourceSpan":null},{"children":[{"comments":null,"title":"listToRowNil","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Row"],"ListToRow"]},{"tag":"TypeConstructor","contents":[["Prim","RowList"],"Nil"]}]},{"tag":"REmpty"}]}},"sourceSpan":{"start":[31,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row.purs","end":[32,22]}},{"comments":null,"title":"listToCons","info":{"declType":"instance","dependencies":[{"constraintClass":[["Type","Row"],"ListToRow"],"constraintArgs":[{"tag":"TypeVar","contents":"tail"},{"tag":"TypeVar","contents":"tailRow"}],"constraintData":null},{"constraintClass":[["Prim","Row"],"Cons"],"constraintArgs":[{"tag":"TypeVar","contents":"label"},{"tag":"TypeVar","contents":"ty"},{"tag":"TypeVar","contents":"tailRow"},{"tag":"TypeVar","contents":"row"}],"constraintData":null}],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Row"],"ListToRow"]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim","RowList"],"Cons"]},{"tag":"TypeVar","contents":"label"}]},{"tag":"TypeVar","contents":"ty"}]},{"tag":"TypeVar","contents":"tail"}]}]},{"tag":"TypeVar","contents":"row"}]}},"sourceSpan":{"start":[34,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row.purs","end":[37,40]}}],"comments":"Convert a RowList to a row of types.\nThe inverse of this operation is `RowToList`.\n","title":"ListToRow","info":{"fundeps":[[["list"],["row"]]],"arguments":[["list",{"tag":"NamedKind","contents":[["Prim","RowList"],"RowList"]}],["row",{"tag":"Row","contents":{"tag":"NamedKind","contents":[["Prim"],"Type"]}}]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[27,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row.purs","end":[29,28]}},{"children":[],"comments":"Compiler solved type class for generating a `RowList` from a closed row\nof types. Entries are sorted by label and duplicates are preserved in\nthe order they appeared in the row.\n","title":"RowToList","info":{"fundeps":[[["row"],["list"]]],"arguments":[["row",{"tag":"Row","contents":{"tag":"NamedKind","contents":[["Prim"],"Type"]}}],["list",{"tag":"NamedKind","contents":[["Prim","RowList"],"RowList"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":null},{"children":[],"comments":"The Union type class is used to compute the union of two rows of types\n(left-biased, including duplicates).\n\nThe third type argument represents the union of the first two.\n","title":"Union","info":{"fundeps":[[["left","right"],["union"]],[["right","union"],["left"]],[["union","left"],["right"]]],"arguments":[["left",{"tag":"Row","contents":{"tag":"NamedKind","contents":[["Prim"],"Type"]}}],["right",{"tag":"Row","contents":{"tag":"NamedKind","contents":[["Prim"],"Type"]}}],["union",{"tag":"Row","contents":{"tag":"NamedKind","contents":[["Prim"],"Type"]}}]],"declType":"typeClass","superclasses":[]},"sourceSpan":null}]}],"name":"Type.Prelude","comments":null,"declarations":[]},{"reExports":[{"moduleName":{"package":null,"item":["Prim","Row"]},"declarations":[{"children":[],"comments":"The Cons type class is a 4-way relation which asserts that one row of\ntypes can be obtained from another by inserting a new label/type pair on\nthe left.\n","title":"Cons","info":{"fundeps":[[["label","a","tail"],["row"]],[["label","row"],["a","tail"]]],"arguments":[["label",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}],["a",{"tag":"NamedKind","contents":[["Prim"],"Type"]}],["tail",{"tag":"Row","contents":{"tag":"NamedKind","contents":[["Prim"],"Type"]}}],["row",{"tag":"Row","contents":{"tag":"NamedKind","contents":[["Prim"],"Type"]}}]],"declType":"typeClass","superclasses":[]},"sourceSpan":null},{"children":[],"comments":"The Lacks type class asserts that a label does not occur in a given row.\n","title":"Lacks","info":{"fundeps":[],"arguments":[["label",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}],["row",{"tag":"Row","contents":{"tag":"NamedKind","contents":[["Prim"],"Type"]}}]],"declType":"typeClass","superclasses":[]},"sourceSpan":null},{"children":[],"comments":"The Nub type class is used to remove duplicate labels from rows.\n","title":"Nub","info":{"fundeps":[[["original"],["nubbed"]]],"arguments":[["original",{"tag":"Row","contents":{"tag":"NamedKind","contents":[["Prim"],"Type"]}}],["nubbed",{"tag":"Row","contents":{"tag":"NamedKind","contents":[["Prim"],"Type"]}}]],"declType":"typeClass","superclasses":[]},"sourceSpan":null},{"children":[],"comments":"The Union type class is used to compute the union of two rows of types\n(left-biased, including duplicates).\n\nThe third type argument represents the union of the first two.\n","title":"Union","info":{"fundeps":[[["left","right"],["union"]],[["right","union"],["left"]],[["union","left"],["right"]]],"arguments":[["left",{"tag":"Row","contents":{"tag":"NamedKind","contents":[["Prim"],"Type"]}}],["right",{"tag":"Row","contents":{"tag":"NamedKind","contents":[["Prim"],"Type"]}}],["union",{"tag":"Row","contents":{"tag":"NamedKind","contents":[["Prim"],"Type"]}}]],"declType":"typeClass","superclasses":[]},"sourceSpan":null}]},{"moduleName":{"package":null,"item":["Prim","RowList"]},"declarations":[{"children":[],"comments":"The empty `RowList`.\n","title":"Nil","info":{"kind":{"tag":"NamedKind","contents":[["Prim","RowList"],"RowList"]},"declType":"externData"},"sourceSpan":null},{"children":[],"comments":"Constructs a new `RowList` from a label, a type, and an existing tail\n`RowList`. E.g: `Cons \"x\" Int (Cons \"y\" Int Nil)`.\n","title":"Cons","info":{"kind":{"tag":"FunKind","contents":[{"tag":"NamedKind","contents":[["Prim"],"Symbol"]},{"tag":"FunKind","contents":[{"tag":"NamedKind","contents":[["Prim"],"Type"]},{"tag":"FunKind","contents":[{"tag":"NamedKind","contents":[["Prim","RowList"],"RowList"]},{"tag":"NamedKind","contents":[["Prim","RowList"],"RowList"]}]}]}]},"declType":"externData"},"sourceSpan":null},{"children":[],"comments":"Compiler solved type class for generating a `RowList` from a closed row\nof types. Entries are sorted by label and duplicates are preserved in\nthe order they appeared in the row.\n","title":"RowToList","info":{"fundeps":[[["row"],["list"]]],"arguments":[["row",{"tag":"Row","contents":{"tag":"NamedKind","contents":[["Prim"],"Type"]}}],["list",{"tag":"NamedKind","contents":[["Prim","RowList"],"RowList"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":null},{"children":[],"comments":"A type level list representation of a row of types.\n","title":"RowList","info":{"declType":"kind"},"sourceSpan":null}]}],"name":"Type.Row","comments":null,"declarations":[{"children":[{"comments":null,"title":"RProxy","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null}],"comments":null,"title":"RProxy","info":{"declType":"data","dataDeclType":"data","typeArguments":[["row",{"tag":"Row","contents":{"tag":"NamedKind","contents":[["Prim"],"Type"]}}]]},"sourceSpan":{"start":[21,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row.purs","end":[21,37]}},{"children":[{"comments":null,"title":"RLProxy","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null}],"comments":null,"title":"RLProxy","info":{"declType":"data","dataDeclType":"data","typeArguments":[["rowList",{"tag":"NamedKind","contents":[["Prim","RowList"],"RowList"]}]]},"sourceSpan":{"start":[23,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row.purs","end":[23,44]}},{"children":[{"comments":null,"title":"listToRowNil","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Row"],"ListToRow"]},{"tag":"TypeConstructor","contents":[["Prim","RowList"],"Nil"]}]},{"tag":"REmpty"}]}},"sourceSpan":{"start":[31,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row.purs","end":[32,22]}},{"comments":null,"title":"listToCons","info":{"declType":"instance","dependencies":[{"constraintClass":[["Type","Row"],"ListToRow"],"constraintArgs":[{"tag":"TypeVar","contents":"tail"},{"tag":"TypeVar","contents":"tailRow"}],"constraintData":null},{"constraintClass":[["Prim","Row"],"Cons"],"constraintArgs":[{"tag":"TypeVar","contents":"label"},{"tag":"TypeVar","contents":"ty"},{"tag":"TypeVar","contents":"tailRow"},{"tag":"TypeVar","contents":"row"}],"constraintData":null}],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Row"],"ListToRow"]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim","RowList"],"Cons"]},{"tag":"TypeVar","contents":"label"}]},{"tag":"TypeVar","contents":"ty"}]},{"tag":"TypeVar","contents":"tail"}]}]},{"tag":"TypeVar","contents":"row"}]}},"sourceSpan":{"start":[34,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row.purs","end":[37,40]}}],"comments":"Convert a RowList to a row of types.\nThe inverse of this operation is `RowToList`.\n","title":"ListToRow","info":{"fundeps":[[["list"],["row"]]],"arguments":[["list",{"tag":"NamedKind","contents":[["Prim","RowList"],"RowList"]}],["row",{"tag":"Row","contents":{"tag":"NamedKind","contents":[["Prim"],"Type"]}}]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[27,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row.purs","end":[29,28]}},{"children":[{"comments":null,"title":"rowListRemoveNil","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Row"],"RowListRemove"]},{"tag":"TypeVar","contents":"label"}]},{"tag":"TypeConstructor","contents":[["Prim","RowList"],"Nil"]}]},{"tag":"TypeConstructor","contents":[["Prim","RowList"],"Nil"]}]}},"sourceSpan":{"start":[45,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row.purs","end":[46,33]}},{"comments":null,"title":"rowListRemoveCons","info":{"declType":"instance","dependencies":[{"constraintClass":[["Type","Row"],"RowListRemove"],"constraintArgs":[{"tag":"TypeVar","contents":"label"},{"tag":"TypeVar","contents":"tail"},{"tag":"TypeVar","contents":"tailOutput"}],"constraintData":null},{"constraintClass":[["Type","Data","Symbol"],"Equals"],"constraintArgs":[{"tag":"TypeVar","contents":"label"},{"tag":"TypeVar","contents":"key"},{"tag":"TypeVar","contents":"eq"}],"constraintData":null},{"constraintClass":[["Type","Data","Boolean"],"If"],"constraintArgs":[{"tag":"TypeVar","contents":"eq"},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Row"],"RLProxy"]},{"tag":"TypeVar","contents":"tailOutput"}]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Row"],"RLProxy"]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim","RowList"],"Cons"]},{"tag":"TypeVar","contents":"key"}]},{"tag":"TypeVar","contents":"head"}]},{"tag":"TypeVar","contents":"tailOutput"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Row"],"RLProxy"]},{"tag":"TypeVar","contents":"output"}]}],"constraintData":null}],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Row"],"RowListRemove"]},{"tag":"TypeVar","contents":"label"}]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim","RowList"],"Cons"]},{"tag":"TypeVar","contents":"key"}]},{"tag":"TypeVar","contents":"head"}]},{"tag":"TypeVar","contents":"tail"}]}]},{"tag":"TypeVar","contents":"output"}]}},"sourceSpan":{"start":[48,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row.purs","end":[56,53]}}],"comments":"Remove all occurences of a given label from a RowList\n","title":"RowListRemove","info":{"fundeps":[[["label","input"],["output"]]],"arguments":[["label",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}],["input",{"tag":"NamedKind","contents":[["Prim","RowList"],"RowList"]}],["output",{"tag":"NamedKind","contents":[["Prim","RowList"],"RowList"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[40,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row.purs","end":[43,44]}},{"children":[{"comments":null,"title":"rowListSetImpl","info":{"declType":"instance","dependencies":[{"constraintClass":[["Type","Equality"],"TypeEquals"],"constraintArgs":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"SProxy"]},{"tag":"TypeVar","contents":"label"}]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"SProxy"]},{"tag":"TypeVar","contents":"label'"}]}],"constraintData":null},{"constraintClass":[["Type","Equality"],"TypeEquals"],"constraintArgs":[{"tag":"TypeVar","contents":"typ"},{"tag":"TypeVar","contents":"typ'"}],"constraintData":null},{"constraintClass":[["Type","Row"],"RowListRemove"],"constraintArgs":[{"tag":"TypeVar","contents":"label"},{"tag":"TypeVar","contents":"input"},{"tag":"TypeVar","contents":"lacking"}],"constraintData":null}],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Row"],"RowListSet"]},{"tag":"TypeVar","contents":"label"}]},{"tag":"TypeVar","contents":"typ"}]},{"tag":"TypeVar","contents":"input"}]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim","RowList"],"Cons"]},{"tag":"TypeVar","contents":"label'"}]},{"tag":"TypeVar","contents":"typ'"}]},{"tag":"TypeVar","contents":"lacking"}]}]}},"sourceSpan":{"start":[65,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row.purs","end":[69,59]}}],"comments":"Add a label to a RowList after removing other occurences.\n","title":"RowListSet","info":{"fundeps":[[["label","typ","input"],["output"]]],"arguments":[["label",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}],["typ",{"tag":"NamedKind","contents":[["Prim"],"Type"]}],["input",{"tag":"NamedKind","contents":[["Prim","RowList"],"RowList"]}],["output",{"tag":"NamedKind","contents":[["Prim","RowList"],"RowList"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[59,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row.purs","end":[63,45]}},{"children":[{"comments":null,"title":"rowListNubNil","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Row"],"RowListNub"]},{"tag":"TypeConstructor","contents":[["Prim","RowList"],"Nil"]}]},{"tag":"TypeConstructor","contents":[["Prim","RowList"],"Nil"]}]}},"sourceSpan":{"start":[76,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row.purs","end":[77,24]}},{"comments":null,"title":"rowListNubCons","info":{"declType":"instance","dependencies":[{"constraintClass":[["Type","Equality"],"TypeEquals"],"constraintArgs":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"SProxy"]},{"tag":"TypeVar","contents":"label"}]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"SProxy"]},{"tag":"TypeVar","contents":"label'"}]}],"constraintData":null},{"constraintClass":[["Type","Equality"],"TypeEquals"],"constraintArgs":[{"tag":"TypeVar","contents":"head"},{"tag":"TypeVar","contents":"head'"}],"constraintData":null},{"constraintClass":[["Type","Equality"],"TypeEquals"],"constraintArgs":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Row"],"RLProxy"]},{"tag":"TypeVar","contents":"nubbed"}]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Row"],"RLProxy"]},{"tag":"TypeVar","contents":"nubbed'"}]}],"constraintData":null},{"constraintClass":[["Type","Row"],"RowListRemove"],"constraintArgs":[{"tag":"TypeVar","contents":"label"},{"tag":"TypeVar","contents":"tail"},{"tag":"TypeVar","contents":"removed"}],"constraintData":null},{"constraintClass":[["Type","Row"],"RowListNub"],"constraintArgs":[{"tag":"TypeVar","contents":"removed"},{"tag":"TypeVar","contents":"nubbed"}],"constraintData":null}],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Row"],"RowListNub"]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim","RowList"],"Cons"]},{"tag":"TypeVar","contents":"label"}]},{"tag":"TypeVar","contents":"head"}]},{"tag":"TypeVar","contents":"tail"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim","RowList"],"Cons"]},{"tag":"TypeVar","contents":"label'"}]},{"tag":"TypeVar","contents":"head'"}]},{"tag":"TypeVar","contents":"nubbed'"}]}]}},"sourceSpan":{"start":[79,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row.purs","end":[85,67]}}],"comments":"Remove label duplicates, keeps earlier occurrences.\n","title":"RowListNub","info":{"fundeps":[[["input"],["output"]]],"arguments":[["input",{"tag":"NamedKind","contents":[["Prim","RowList"],"RowList"]}],["output",{"tag":"NamedKind","contents":[["Prim","RowList"],"RowList"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[72,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row.purs","end":[74,35]}},{"children":[{"comments":null,"title":"rowListAppendNil","info":{"declType":"instance","dependencies":[{"constraintClass":[["Type","Equality"],"TypeEquals"],"constraintArgs":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Row"],"RLProxy"]},{"tag":"TypeVar","contents":"rhs"}]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Row"],"RLProxy"]},{"tag":"TypeVar","contents":"out"}]}],"constraintData":null}],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Row"],"RowListAppend"]},{"tag":"TypeConstructor","contents":[["Prim","RowList"],"Nil"]}]},{"tag":"TypeVar","contents":"rhs"}]},{"tag":"TypeVar","contents":"out"}]}},"sourceSpan":{"start":[93,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row.purs","end":[95,31]}},{"comments":null,"title":"rowListAppendCons","info":{"declType":"instance","dependencies":[{"constraintClass":[["Type","Row"],"RowListAppend"],"constraintArgs":[{"tag":"TypeVar","contents":"tail"},{"tag":"TypeVar","contents":"rhs"},{"tag":"TypeVar","contents":"out'"}],"constraintData":null},{"constraintClass":[["Type","Equality"],"TypeEquals"],"constraintArgs":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Row"],"RLProxy"]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim","RowList"],"Cons"]},{"tag":"TypeVar","contents":"label"}]},{"tag":"TypeVar","contents":"head"}]},{"tag":"TypeVar","contents":"out'"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Row"],"RLProxy"]},{"tag":"TypeVar","contents":"out"}]}],"constraintData":null}],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Row"],"RowListAppend"]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim","RowList"],"Cons"]},{"tag":"TypeVar","contents":"label"}]},{"tag":"TypeVar","contents":"head"}]},{"tag":"TypeVar","contents":"tail"}]}]},{"tag":"TypeVar","contents":"rhs"}]},{"tag":"TypeVar","contents":"out"}]}},"sourceSpan":{"start":[97,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row.purs","end":[100,50]}}],"comments":null,"title":"RowListAppend","info":{"fundeps":[[["lhs","rhs"],["out"]]],"arguments":[["lhs",{"tag":"NamedKind","contents":[["Prim","RowList"],"RowList"]}],["rhs",{"tag":"NamedKind","contents":[["Prim","RowList"],"RowList"]}],["out",{"tag":"NamedKind","contents":[["Prim","RowList"],"RowList"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[88,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row.purs","end":[91,37]}},{"children":[],"comments":"Type application for rows.\n","title":"RowApply","info":{"arguments":[["f",{"tag":"FunKind","contents":[{"tag":"Row","contents":{"tag":"NamedKind","contents":[["Prim"],"Type"]}},{"tag":"Row","contents":{"tag":"NamedKind","contents":[["Prim"],"Type"]}}]}],["a",{"tag":"Row","contents":{"tag":"NamedKind","contents":[["Prim"],"Type"]}}]],"declType":"typeSynonym","type":{"tag":"TypeApp","contents":[{"tag":"TypeVar","contents":"f"},{"tag":"TypeVar","contents":"a"}]}},"sourceSpan":{"start":[103,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row.purs","end":[103,58]}},{"children":[],"comments":"Applies a type alias of open rows to a set of rows. The primary use case\nthis operator is as convenient sugar for combining open rows without\nparentheses.\n```purescript\ntype Rows1 r = (a :: Int, b :: String | r)\ntype Rows2 r = (c :: Boolean | r)\ntype Rows3 r = (Rows1 + Rows2 + r)\ntype Rows4 r = (d :: String | Rows1 + Rows2 + r)\n```\n","title":"type (+)","info":{"declType":"alias","alias":[["Type","Row"],{"Left":"RowApply"}],"fixity":{"associativity":"infixr","precedence":0}},"sourceSpan":{"start":[114,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row.purs","end":[114,27]}}]},{"reExports":[],"name":"Type.Row.Homogeneous","comments":null,"declarations":[{"children":[{"comments":null,"title":"homogeneous","info":{"declType":"instance","dependencies":[{"constraintClass":[["Prim","RowList"],"RowToList"],"constraintArgs":[{"tag":"TypeVar","contents":"row"},{"tag":"TypeVar","contents":"fields"}],"constraintData":null},{"constraintClass":[["Type","Row","Homogeneous"],"HomogeneousRowList"],"constraintArgs":[{"tag":"TypeVar","contents":"fields"},{"tag":"TypeVar","contents":"fieldType"}],"constraintData":null}],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Row","Homogeneous"],"Homogeneous"]},{"tag":"TypeVar","contents":"row"}]},{"tag":"TypeVar","contents":"fieldType"}]}},"sourceSpan":{"start":[11,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row/Homogeneous.purs","end":[14,31]}}],"comments":"Ensure that every field in a row has the same type.\n","title":"Homogeneous","info":{"fundeps":[[["row"],["fieldType"]]],"arguments":[["row",{"tag":"Row","contents":{"tag":"NamedKind","contents":[["Prim"],"Type"]}}],["fieldType",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[10,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row/Homogeneous.purs","end":[10,63]}},{"children":[{"comments":null,"title":"homogeneousRowListCons","info":{"declType":"instance","dependencies":[{"constraintClass":[["Type","Row","Homogeneous"],"HomogeneousRowList"],"constraintArgs":[{"tag":"TypeVar","contents":"tail"},{"tag":"TypeVar","contents":"fieldType"}],"constraintData":null},{"constraintClass":[["Type","Equality"],"TypeEquals"],"constraintArgs":[{"tag":"TypeVar","contents":"fieldType"},{"tag":"TypeVar","contents":"fieldType2"}],"constraintData":null}],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Row","Homogeneous"],"HomogeneousRowList"]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim","RowList"],"Cons"]},{"tag":"TypeVar","contents":"symbol"}]},{"tag":"TypeVar","contents":"fieldType"}]},{"tag":"TypeVar","contents":"tail"}]}]},{"tag":"TypeVar","contents":"fieldType2"}]}},"sourceSpan":{"start":[17,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row/Homogeneous.purs","end":[20,64]}},{"comments":null,"title":"homogeneousRowListNil","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Row","Homogeneous"],"HomogeneousRowList"]},{"tag":"TypeConstructor","contents":[["Prim","RowList"],"Nil"]}]},{"tag":"TypeVar","contents":"fieldType"}]}},"sourceSpan":{"start":[21,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row/Homogeneous.purs","end":[21,58]}}],"comments":null,"title":"HomogeneousRowList","info":{"fundeps":[[["rowList"],["fieldType"]]],"arguments":[["rowList",{"tag":"NamedKind","contents":[["Prim","RowList"],"RowList"]}],["fieldType",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[16,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row/Homogeneous.purs","end":[16,79]}}]}],"resolvedDependencies":{"purescript-proxy":"3.0.0","purescript-type-equality":"3.0.0","purescript-prelude":"4.1.0"},"version":"3.0.0","github":["purescript","purescript-typelevel-prelude"],"versionTag":"v3.0.0","moduleMap":{"Data.BooleanAlgebra":"purescript-prelude","Data.Ring":"purescript-prelude","Data.Ord":"purescript-prelude","Type.Data.Row":"purescript-prelude","Data.Monoid.Dual":"purescript-prelude","Data.Boolean":"purescript-prelude","Type.Proxy":"purescript-proxy","Data.Bounded":"purescript-prelude","Data.Show":"purescript-prelude","Control.Apply":"purescript-prelude","Control.Monad":"purescript-prelude","Data.Monoid":"purescript-prelude","Control.Bind":"purescript-prelude","Data.Monoid.Additive":"purescript-prelude","Data.Symbol":"purescript-prelude","Data.HeytingAlgebra":"purescript-prelude","Type.Data.RowList":"purescript-prelude","Data.Ord.Unsafe":"purescript-prelude","Data.Semigroup":"purescript-prelude","Type.Equality":"purescript-type-equality","Data.Semiring":"purescript-prelude","Data.CommutativeRing":"purescript-prelude","Data.NaturalTransformation":"purescript-prelude","Data.Monoid.Conj":"purescript-prelude","Data.Functor":"purescript-prelude","Control.Category":"purescript-prelude","Data.Function":"purescript-prelude","Data.Field":"purescript-prelude","Data.EuclideanRing":"purescript-prelude","Data.Semigroup.Last":"purescript-prelude","Data.Semigroup.First":"purescript-prelude","Prelude":"purescript-prelude","Data.Eq":"purescript-prelude","Data.Monoid.Disj":"purescript-prelude","Data.Void":"purescript-prelude","Data.DivisionRing":"purescript-prelude","Data.Unit":"purescript-prelude","Data.Ordering":"purescript-prelude","Data.Monoid.Multiplicative":"purescript-prelude","Control.Semigroupoid":"purescript-prelude","Data.Monoid.Endo":"purescript-prelude","Control.Applicative":"purescript-prelude","Record.Unsafe":"purescript-prelude"},"compilerVersion":"0.12.1"}
diff --git a/tests/purs/failing/TypedHole2.purs b/tests/purs/failing/TypedHole2.purs
new file mode 100644
index 0000000..2e6cd66
--- /dev/null
+++ b/tests/purs/failing/TypedHole2.purs
@@ -0,0 +1,8 @@
+-- @shouldFailWith HoleInferredType
+module Main where
+
+import Prelude
+import Effect (Effect)
+
+main :: Effect ?ummm
+main = pure unit
diff --git a/tests/purs/passing/3481.purs b/tests/purs/passing/3481.purs
new file mode 100644
index 0000000..32d4751
--- /dev/null
+++ b/tests/purs/passing/3481.purs
@@ -0,0 +1,7 @@
+module Main where
+
+import Effect.Console (log)
+
+message = { "0": { "1": "Done" }}
+
+main = log message."0"."1"
diff --git a/tests/purs/passing/InheritMultipleSuperClasses.purs b/tests/purs/passing/InheritMultipleSuperClasses.purs
new file mode 100644
index 0000000..8709965
--- /dev/null
+++ b/tests/purs/passing/InheritMultipleSuperClasses.purs
@@ -0,0 +1,25 @@
+module Main where
+
+import Prelude
+import Effect.Console (log)
+
+class (Functor f, Functor g) <= Eg1 f g
+
+f1 :: forall f g. Eg1 f g => f ~> f
+f1 = map identity -- Err, No type class instance was found for Functor f
+
+g1 :: forall f g. Eg1 f g => g ~> g
+g1 = map identity -- ok
+
+
+class (Functor g, Functor f) <= Eg2 f g
+
+f2 :: forall f g. Eg2 f g => f ~> f
+f2 = map identity -- ok
+
+g2 :: forall f g. Eg2 f g => g ~> g
+g2 = map identity -- Err, No type class instance was found for Functor g
+
+
+main = log "Done"
+
diff --git a/tests/purs/passing/PartialTCO.purs b/tests/purs/passing/PartialTCO.purs
new file mode 100644
index 0000000..87589e7
--- /dev/null
+++ b/tests/purs/passing/PartialTCO.purs
@@ -0,0 +1,13 @@
+module Main where
+
+import Prelude
+import Effect.Console (log)
+import Partial.Unsafe (unsafePartial)
+
+main = do
+ let _ = unsafePartial partialTCO true 1000000
+ log "Done"
+
+partialTCO :: Partial => Boolean -> Int -> Int
+partialTCO true 0 = 0
+partialTCO true n = partialTCO true (n - 1)
diff --git a/tests/purs/passing/QualifiedAdo.purs b/tests/purs/passing/QualifiedAdo.purs
new file mode 100644
index 0000000..5764abf
--- /dev/null
+++ b/tests/purs/passing/QualifiedAdo.purs
@@ -0,0 +1,19 @@
+module Main where
+
+import Prelude
+import Effect.Console (log)
+import IxApplicative as Ix
+
+testIApplicative :: forall f a. Ix.IxApplicative f => f a a String
+testIApplicative = Ix.ado
+ a <- Ix.pure "test"
+ b <- Ix.pure "test"
+ in (a <> b)
+
+testApplicative :: forall f. Applicative f => f String
+testApplicative = ado
+ a <- pure "test"
+ b <- pure "test"
+ in (a <> b)
+
+main = log "Done"
diff --git a/tests/purs/passing/QualifiedAdo/IxApplicative.purs b/tests/purs/passing/QualifiedAdo/IxApplicative.purs
new file mode 100644
index 0000000..656cb9c
--- /dev/null
+++ b/tests/purs/passing/QualifiedAdo/IxApplicative.purs
@@ -0,0 +1,8 @@
+module IxApplicative where
+
+class IxFunctor f where
+ map ∷ forall a b x y. (a -> b) -> f x y a -> f x y b
+
+class IxFunctor f <= IxApplicative f where
+ pure ∷ forall a x y. a -> f x y a
+ apply ∷ forall a b x y z. f x y (a -> b) -> f y z a -> f x z b
diff --git a/tests/purs/passing/QualifiedDo.purs b/tests/purs/passing/QualifiedDo.purs
new file mode 100644
index 0000000..5395138
--- /dev/null
+++ b/tests/purs/passing/QualifiedDo.purs
@@ -0,0 +1,19 @@
+module Main where
+
+import Prelude
+import Effect.Console (log)
+import IxMonad as Ix
+
+testIMonad :: forall m a. Ix.IxMonad m => m a a String
+testIMonad = Ix.do
+ a <- Ix.pure "test"
+ b <- Ix.pure "test"
+ Ix.pure (a <> b)
+
+testMonad :: forall m. Monad m => m String
+testMonad = do
+ a <- pure "test"
+ b <- pure "test"
+ pure (a <> b)
+
+main = log "Done"
diff --git a/tests/purs/passing/QualifiedDo/IxMonad.purs b/tests/purs/passing/QualifiedDo/IxMonad.purs
new file mode 100644
index 0000000..8caf015
--- /dev/null
+++ b/tests/purs/passing/QualifiedDo/IxMonad.purs
@@ -0,0 +1,5 @@
+module IxMonad where
+
+class IxMonad m where
+ pure ∷ forall a x y. a -> m x y a
+ bind ∷ forall a b x y z. m x y a -> (a -> m y z b) -> m x z b
diff --git a/tests/purs/psci/Multiline.purs b/tests/purs/psci/Multiline.purs
index 86f0dcf..c12f543 100644
--- a/tests/purs/psci/Multiline.purs
+++ b/tests/purs/psci/Multiline.purs
@@ -1,5 +1,7 @@
+-- @paste
import Prelude
import Data.Array
+-- @paste
-- @paste
fac :: Int -> Int
diff --git a/tests/purs/warning/WildcardInferredType.purs b/tests/purs/warning/WildcardInferredType.purs
index 3662384..da42213 100644
--- a/tests/purs/warning/WildcardInferredType.purs
+++ b/tests/purs/warning/WildcardInferredType.purs
@@ -1,10 +1,7 @@
-- @shouldWarnWith WildcardInferredType
-- @shouldWarnWith WildcardInferredType
--- @shouldWarnWith WildcardInferredType
--- @shouldWarnWith WildcardInferredType
module Main where
-x :: Int
x = 0 :: _
y :: _
@@ -15,9 +12,3 @@ z =
let n :: _
n = 0
in n
-
-w :: Int
-w = n
- where
- n :: _
- n = 0
diff --git a/tests/purs/warning/WildcardInferredType2.purs b/tests/purs/warning/WildcardInferredType2.purs
new file mode 100644
index 0000000..441a326
--- /dev/null
+++ b/tests/purs/warning/WildcardInferredType2.purs
@@ -0,0 +1,14 @@
+-- @shouldWarnWith WildcardInferredType
+module Main where
+
+x :: _
+x = 42
+
+y :: Int
+y = 42 :: _
+
+z :: Int
+z = n
+ where
+ n :: _
+ n = 42 \ No newline at end of file
diff --git a/tests/support/psci/InteractivePrint.purs b/tests/support/psci/InteractivePrint.purs
new file mode 100644
index 0000000..4dc364f
--- /dev/null
+++ b/tests/support/psci/InteractivePrint.purs
@@ -0,0 +1,11 @@
+-- A module for testing the :print feature for configuring the function used
+-- for printing repl results
+module InteractivePrint where
+
+import Prelude
+import Effect (Effect)
+import Effect.Console (log)
+import Unsafe.Coerce (unsafeCoerce)
+
+unsafeEval :: forall a. a -> Effect Unit
+unsafeEval = log <<< unsafeCoerce