summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilFreeman <>2015-02-03 17:05:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2015-02-03 17:05:00 (GMT)
commit20ed2828110ec7ebc926a7ca29ea4af8b2ef2eb4 (patch)
treef53ca2716554ccd4d3577d0b08e375cfae5ae715
parentc043a13adaa53d90afe00f792c9a7ff2521a5b38 (diff)
version 0.6.4.10.6.4.1
-rw-r--r--LICENSE70
-rw-r--r--examples/failing/DuplicateDeclarationsInLet.purs9
-rw-r--r--examples/failing/NewtypeMultiArgs.purs2
-rw-r--r--examples/failing/NewtypeMultiCtor.purs2
-rw-r--r--examples/failing/SkolemEscape2.purs2
-rw-r--r--examples/failing/UnknownType.purs2
-rw-r--r--examples/passing/810.purs11
-rw-r--r--examples/passing/BindersInFunctions.purs12
-rw-r--r--examples/passing/BindingGroups.purs4
-rw-r--r--examples/passing/CheckSynonymBug.purs10
-rw-r--r--examples/passing/Comparisons.purs14
-rw-r--r--examples/passing/Conditional.purs2
-rw-r--r--examples/passing/Console.purs2
-rw-r--r--examples/passing/DeepArrayBinder.purs10
-rw-r--r--examples/passing/DeepCase.purs4
-rw-r--r--examples/passing/Dollar.purs2
-rw-r--r--examples/passing/EmptyDataDecls.purs20
-rw-r--r--examples/passing/EmptyRow.purs2
-rw-r--r--examples/passing/ExternRaw.purs27
-rw-r--r--examples/passing/FFI.purs10
-rw-r--r--examples/passing/FinalTagless.purs2
-rw-r--r--examples/passing/FunctionScope.purs10
-rw-r--r--examples/passing/Functions2.purs8
-rw-r--r--examples/passing/Guards.purs4
-rw-r--r--examples/passing/HoistError.purs12
-rw-r--r--examples/passing/JSReserved.purs4
-rw-r--r--examples/passing/KindedType.purs2
-rw-r--r--examples/passing/Let.purs14
-rw-r--r--examples/passing/Monad.purs4
-rw-r--r--examples/passing/MutRec.purs2
-rw-r--r--examples/passing/MutRec2.purs2
-rw-r--r--examples/passing/MutRec3.purs2
-rw-r--r--examples/passing/NamedPatterns.purs2
-rw-r--r--examples/passing/Newtype.purs6
-rw-r--r--examples/passing/NewtypeWithRecordUpdate.purs15
-rw-r--r--examples/passing/ObjectSynonym.purs2
-rw-r--r--examples/passing/ObjectUpdate2.purs2
-rw-r--r--examples/passing/Objects.purs2
-rw-r--r--examples/passing/OperatorAssociativity.purs24
-rw-r--r--examples/passing/Operators.purs10
-rw-r--r--examples/passing/OptimizerBug.purs2
-rw-r--r--examples/passing/PartialFunction.purs18
-rw-r--r--examples/passing/Patterns.purs6
-rw-r--r--examples/passing/Person.purs14
-rw-r--r--examples/passing/Rank2Data.purs2
-rw-r--r--examples/passing/Rank2TypeSynonym.purs4
-rw-r--r--examples/passing/Rank2Types.purs2
-rw-r--r--examples/passing/Recursion.purs2
-rw-r--r--examples/passing/Sequence.purs4
-rw-r--r--examples/passing/ShadowedRename.purs12
-rw-r--r--examples/passing/ShadowedTCOLet.purs6
-rw-r--r--examples/passing/SignedNumericLiterals.purs4
-rw-r--r--examples/passing/Superclasses3.purs2
-rw-r--r--examples/passing/TailCall.purs4
-rw-r--r--examples/passing/TopLevelCase.purs2
-rw-r--r--examples/passing/TypeClassImport.purs6
-rw-r--r--examples/passing/TypeClassMemberOrderChange.purs2
-rw-r--r--examples/passing/TypeDecl.purs2
-rw-r--r--examples/passing/TypeSynonyms.purs4
-rw-r--r--examples/passing/TypeWildcardsRecordExtension.purs2
-rw-r--r--examples/passing/Where.purs12
-rw-r--r--examples/passing/s.purs2
-rw-r--r--psc-docs/Main.hs8
-rw-r--r--psc-make/Main.hs18
-rw-r--r--psc/Main.hs22
-rw-r--r--psci/Parser.hs8
-rw-r--r--purescript.cabal4
-rw-r--r--src/Language/PureScript/AST/SourcePos.hs4
-rw-r--r--src/Language/PureScript/CodeGen/Externs.hs13
-rw-r--r--src/Language/PureScript/CodeGen/JS.hs4
-rw-r--r--src/Language/PureScript/Comments.hs4
-rw-r--r--src/Language/PureScript/CoreFn/Ann.hs2
-rw-r--r--src/Language/PureScript/Parser.hs2
-rw-r--r--src/Language/PureScript/Parser/Lexer.hs60
-rw-r--r--src/Language/PureScript/Pretty/JS.hs8
-rw-r--r--src/Language/PureScript/Pretty/Types.hs2
-rw-r--r--src/Language/PureScript/Sugar/BindingGroups.hs6
-rw-r--r--src/Language/PureScript/Sugar/Names.hs7
-rw-r--r--src/Language/PureScript/TypeChecker.hs2
-rw-r--r--src/Language/PureScript/TypeChecker/Types.hs19
-rw-r--r--src/Language/PureScript/TypeChecker/Unify.hs2
-rw-r--r--tests/Main.hs4
82 files changed, 373 insertions, 286 deletions
diff --git a/LICENSE b/LICENSE
index 3bb98e7..cbb46c0 100644
--- a/LICENSE
+++ b/LICENSE
@@ -41,43 +41,43 @@ PureScript uses the following Haskell library packages. Their license files foll
base LICENSE file:
This library (libraries/base) is derived from code from several
- sources:
-
+ sources:
+
* Code from the GHC project which is largely (c) The University of
Glasgow, and distributable under a BSD-style license (see below),
-
+
* Code from the Haskell 98 Report which is (c) Simon Peyton Jones
and freely redistributable (but see the full license for
restrictions).
-
+
* Code from the Haskell Foreign Function Interface specification,
which is (c) Manuel M. T. Chakravarty and freely redistributable
(but see the full license for restrictions).
-
+
The full text of these licenses is reproduced below. All of the
licenses are BSD-style or compatible.
-
+
-----------------------------------------------------------------------------
-
+
The Glasgow Haskell Compiler License
-
- Copyright 2004, The University Court of the University of Glasgow.
+
+ 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:
-
+
- 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.
-
+ 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
@@ -90,14 +90,14 @@ base LICENSE file:
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.
-
+
-----------------------------------------------------------------------------
-
+
Code derived from the document "Report on the Programming Language
Haskell 98", is distributed under the following license:
-
+
Copyright (c) 2002 Simon Peyton Jones
-
+
The authors intend this Report to belong to the entire Haskell
community, and so we grant permission to copy and distribute it for
any purpose, provided that it is reproduced in its entirety,
@@ -105,15 +105,15 @@ base LICENSE file:
copied and distributed for any purpose, provided that the modified
version is clearly presented as such, and that it does not claim to
be a definition of the Haskell 98 Language.
-
+
-----------------------------------------------------------------------------
-
+
Code derived from the document "The Haskell 98 Foreign Function
Interface, An Addendum to the Haskell 98 Report" is distributed under
the following license:
-
+
Copyright (c) 2002 Manuel M. T. Chakravarty
-
+
The authors intend this Report to belong to the entire Haskell
community, and so we grant permission to copy and distribute it for
any purpose, provided that it is reproduced in its entirety,
@@ -121,9 +121,9 @@ base LICENSE file:
copied and distributed for any purpose, provided that the modified
version is clearly presented as such, and that it does not claim to
be a definition of the Haskell 98 Foreign Function Interface.
-
+
-----------------------------------------------------------------------------
-
+
containers LICENSE file:
The Glasgow Haskell Compiler License
@@ -161,7 +161,7 @@ containers LICENSE file:
directory LICENSE file:
This library (libraries/base) is derived from code from two
- sources:
+ sources:
* Code from the GHC project which is largely (c) The University of
Glasgow, and distributable under a BSD-style license (see below),
@@ -177,7 +177,7 @@ directory LICENSE file:
The Glasgow Haskell Compiler License
- Copyright 2004, The University Court of the University of Glasgow.
+ Copyright 2004, The University Court of the University of Glasgow.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -185,14 +185,14 @@ directory LICENSE file:
- 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.
+ 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,
@@ -451,7 +451,7 @@ pattern-arrows LICENSE file:
process LICENSE file:
This library (libraries/process) is derived from code from two
- sources:
+ sources:
* Code from the GHC project which is largely (c) The University of
Glasgow, and distributable under a BSD-style license (see below),
@@ -467,7 +467,7 @@ process LICENSE file:
The Glasgow Haskell Compiler License
- Copyright 2004, The University Court of the University of Glasgow.
+ Copyright 2004, The University Court of the University of Glasgow.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -475,14 +475,14 @@ process LICENSE file:
- 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.
+ 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,
diff --git a/examples/failing/DuplicateDeclarationsInLet.purs b/examples/failing/DuplicateDeclarationsInLet.purs
new file mode 100644
index 0000000..a1dd634
--- /dev/null
+++ b/examples/failing/DuplicateDeclarationsInLet.purs
@@ -0,0 +1,9 @@
+module Main where
+
+foo = a
+ where
+ a :: Number
+ a = 1
+
+ a :: Number
+ a = 2
diff --git a/examples/failing/NewtypeMultiArgs.purs b/examples/failing/NewtypeMultiArgs.purs
index 1c48962..d658755 100644
--- a/examples/failing/NewtypeMultiArgs.purs
+++ b/examples/failing/NewtypeMultiArgs.purs
@@ -1,3 +1,3 @@
module Main where
-newtype Thing = Thing String Boolean \ No newline at end of file
+newtype Thing = Thing String Boolean
diff --git a/examples/failing/NewtypeMultiCtor.purs b/examples/failing/NewtypeMultiCtor.purs
index 9f6a341..89a9184 100644
--- a/examples/failing/NewtypeMultiCtor.purs
+++ b/examples/failing/NewtypeMultiCtor.purs
@@ -1,3 +1,3 @@
module Main where
-newtype Thing = Thing String | Other \ No newline at end of file
+newtype Thing = Thing String | Other
diff --git a/examples/failing/SkolemEscape2.purs b/examples/failing/SkolemEscape2.purs
index 48bb9f0..eb1ae72 100644
--- a/examples/failing/SkolemEscape2.purs
+++ b/examples/failing/SkolemEscape2.purs
@@ -6,4 +6,4 @@ import Control.Monad.ST
test _ = do
r <- runST (newSTRef 0)
- return 0
+ return 0
diff --git a/examples/failing/UnknownType.purs b/examples/failing/UnknownType.purs
index b3b0038..4d969aa 100644
--- a/examples/failing/UnknownType.purs
+++ b/examples/failing/UnknownType.purs
@@ -1,4 +1,4 @@
module Main where
test :: Number -> Something
-test = {} \ No newline at end of file
+test = {}
diff --git a/examples/passing/810.purs b/examples/passing/810.purs
new file mode 100644
index 0000000..d1ba729
--- /dev/null
+++ b/examples/passing/810.purs
@@ -0,0 +1,11 @@
+module Main where
+
+data Maybe a = Nothing | Just a
+
+test :: forall a. Maybe a -> Maybe a
+test m = o.x
+ where
+ o = case m of Nothing -> { x : Nothing }
+ Just a -> { x : Just a }
+
+main = Debug.Trace.trace "Done"
diff --git a/examples/passing/BindersInFunctions.purs b/examples/passing/BindersInFunctions.purs
index 3ded5f2..56ee2b4 100644
--- a/examples/passing/BindersInFunctions.purs
+++ b/examples/passing/BindersInFunctions.purs
@@ -5,12 +5,14 @@ import Prelude
tail = \(_:xs) -> xs
foreign import error
- "function error(msg) {\
- \ throw msg;\
- \}" :: forall a. String -> a
+ """
+ function error(msg) {
+ throw msg;
+ }
+ """ :: forall a. String -> a
-main =
+main =
let ts = tail [1, 2, 3] in
- if ts == [2, 3]
+ if ts == [2, 3]
then Debug.Trace.trace "Done"
else error "Incorrect result from 'tails'."
diff --git a/examples/passing/BindingGroups.purs b/examples/passing/BindingGroups.purs
index e35da8a..dfc30e5 100644
--- a/examples/passing/BindingGroups.purs
+++ b/examples/passing/BindingGroups.purs
@@ -1,6 +1,6 @@
module Main where
-
-foo = bar
+
+foo = bar
where bar r = r + 1
r = foo 2
diff --git a/examples/passing/CheckSynonymBug.purs b/examples/passing/CheckSynonymBug.purs
index c449634..bab0b8e 100644
--- a/examples/passing/CheckSynonymBug.purs
+++ b/examples/passing/CheckSynonymBug.purs
@@ -2,12 +2,14 @@ module Main where
import Prelude
- type Foo a = [a]
+ type Foo a = [a]
foreign import length
- "function length(a) {\
- \ return a.length;\
- \}" :: forall a. [a] -> Number
+ """
+ function length(a) {
+ return a.length;
+ }
+ """ :: forall a. [a] -> Number
foo _ = length ([] :: Foo Number)
diff --git a/examples/passing/Comparisons.purs b/examples/passing/Comparisons.purs
index e8eb34c..4fb768d 100644
--- a/examples/passing/Comparisons.purs
+++ b/examples/passing/Comparisons.purs
@@ -6,12 +6,14 @@ import Debug.Trace
foreign import data Assert :: !
foreign import assert
- "function assert(x) {\
- \ return function () {\
- \ if (!x) throw new Error('assertion failed');\
- \ return {};\
- \ };\
- \};" :: forall e. Boolean -> Eff (assert :: Assert | e) Unit
+ """
+ function assert(x) {
+ return function() {
+ if (!x) throw new Error('assertion failed');
+ return {};
+ };
+ }
+ """ :: forall e. Boolean -> Eff (assert :: Assert | e) Unit
main = do
assert (1 < 2)
diff --git a/examples/passing/Conditional.purs b/examples/passing/Conditional.purs
index 759aeb3..f20768e 100644
--- a/examples/passing/Conditional.purs
+++ b/examples/passing/Conditional.purs
@@ -2,7 +2,7 @@ module Main where
import Prelude ()
- fns = \f -> if f true then f else \x -> x
+ fns = \f -> if f true then f else \x -> x
not = \x -> if x then false else true
diff --git a/examples/passing/Console.purs b/examples/passing/Console.purs
index a0f8a1f..dfb2d21 100644
--- a/examples/passing/Console.purs
+++ b/examples/passing/Console.purs
@@ -9,5 +9,5 @@ replicateM_ 0 _ = return {}
replicateM_ n act = do
act
replicateM_ (n - 1) act
-
+
main = replicateM_ 10 (trace "Hello World!")
diff --git a/examples/passing/DeepArrayBinder.purs b/examples/passing/DeepArrayBinder.purs
index 5ed5726..8ad3253 100644
--- a/examples/passing/DeepArrayBinder.purs
+++ b/examples/passing/DeepArrayBinder.purs
@@ -6,10 +6,12 @@ match2 :: [Number] -> Number
match2 (x : y : xs) = x * y + match2 xs
match2 _ = 0
-foreign import explode
- "function explode() {\
- \ throw new Error('Incorrect result');\
- \}" :: forall eff a. Eff eff a
+foreign import explode
+ """
+ function explode() {
+ throw new Error('Incorrect result');
+ }
+ """ :: forall eff a. Eff eff a
main = case match2 [1, 2, 3, 4, 5, 6, 7, 8, 9] of
100 -> Debug.Trace.trace "Done"
diff --git a/examples/passing/DeepCase.purs b/examples/passing/DeepCase.purs
index ba0275c..2e41310 100644
--- a/examples/passing/DeepCase.purs
+++ b/examples/passing/DeepCase.purs
@@ -4,9 +4,9 @@ import Debug.Trace
import Control.Monad.Eff
import Control.Monad.ST
-f x y =
+f x y =
let
- g = case y of
+ g = case y of
0 -> x
x -> 1 + x * x
in g + x + y
diff --git a/examples/passing/Dollar.purs b/examples/passing/Dollar.purs
index c2e7c2b..6d51499 100644
--- a/examples/passing/Dollar.purs
+++ b/examples/passing/Dollar.purs
@@ -12,5 +12,5 @@ id x = x
test1 x = id $ id $ id $ id $ x
test2 x = id id $ id x
-
+
main = Debug.Trace.trace "Done"
diff --git a/examples/passing/EmptyDataDecls.purs b/examples/passing/EmptyDataDecls.purs
index f84508d..41a0319 100644
--- a/examples/passing/EmptyDataDecls.purs
+++ b/examples/passing/EmptyDataDecls.purs
@@ -11,19 +11,23 @@ nil :: forall a. ArrayBox Z a
nil = ArrayBox []
foreign import concat
- "function concat(l1) {\
- \ return function (l2) {\
- \ return l1.concat(l2);\
- \ };\
- \}" :: forall a. [a] -> [a] -> [a]
+ """
+ function concat(l1) {
+ return function(l2) {
+ return l1.concat(l2);
+ };
+ }
+ """ :: forall a. [a] -> [a] -> [a]
cons' :: forall a n. a -> ArrayBox n a -> ArrayBox (S n) a
cons' x (ArrayBox xs) = ArrayBox $ concat [x] xs
foreign import error
- "function error(msg) {\
- \ throw msg;\
- \}" :: forall a. String -> a
+ """
+ function error(msg) {
+ throw msg;
+ }
+ """ :: forall a. String -> a
main = case cons' 1 $ cons' 2 $ cons' 3 nil of
ArrayBox [1, 2, 3] -> Debug.Trace.trace "Done"
diff --git a/examples/passing/EmptyRow.purs b/examples/passing/EmptyRow.purs
index c91c930..1e9bdb9 100644
--- a/examples/passing/EmptyRow.purs
+++ b/examples/passing/EmptyRow.purs
@@ -1,6 +1,6 @@
module Main where
-data Foo r = Foo { | r }
+data Foo r = Foo { | r }
test :: Foo ()
test = Foo {}
diff --git a/examples/passing/ExternRaw.purs b/examples/passing/ExternRaw.purs
index 23009ef..376c5af 100644
--- a/examples/passing/ExternRaw.purs
+++ b/examples/passing/ExternRaw.purs
@@ -1,13 +1,26 @@
module Main where
-foreign import first "function first(xs) { return xs[0]; }" :: forall a. [a] -> a
+foreign import first
+ """
+ function first(xs) {
+ return xs[0];
+ }
+ """ :: forall a. [a] -> a
-foreign import loop "function loop() { while (true) {} }" :: forall a. a
+foreign import loop
+ """
+ function loop() {
+ while (true) {}
+ }
+ """ :: forall a. a
-foreign import concat "function concat(xs) { \
- \ return function(ys) { \
- \ return xs.concat(ys); \
- \ };\
- \}" :: forall a. [a] -> [a] -> [a]
+foreign import concat
+ """
+ function concat(xs) {
+ return function(ys) {
+ return xs.concat(ys);
+ };
+ }
+ """ :: forall a. [a] -> [a] -> [a]
main = Debug.Trace.trace "Done"
diff --git a/examples/passing/FFI.purs b/examples/passing/FFI.purs
index 0b8370a..f508cb1 100644
--- a/examples/passing/FFI.purs
+++ b/examples/passing/FFI.purs
@@ -1,9 +1,11 @@
module Main where
-foreign import foo
- "function foo(s) {\
- \ return s;\
- \}" :: String -> String
+foreign import foo
+ """
+ function foo(s) {
+ return s;
+ }
+ """ :: String -> String
bar :: String -> String
bar _ = foo "test"
diff --git a/examples/passing/FinalTagless.purs b/examples/passing/FinalTagless.purs
index bab7c97..1eb53e0 100644
--- a/examples/passing/FinalTagless.purs
+++ b/examples/passing/FinalTagless.purs
@@ -5,7 +5,7 @@ import Prelude
class E e where
num :: Number -> e Number
add :: e Number -> e Number -> e Number
-
+
type Expr a = forall e. (E e) => e a
data Id a = Id a
diff --git a/examples/passing/FunctionScope.purs b/examples/passing/FunctionScope.purs
index 9552f4f..12941b5 100644
--- a/examples/passing/FunctionScope.purs
+++ b/examples/passing/FunctionScope.purs
@@ -5,10 +5,12 @@ module Main where
mkValue :: Number -> Number
mkValue id = id
- foreign import error
- "function error(msg) {\
- \ throw msg;\
- \}" :: forall a. String -> a
+ foreign import error
+ """
+ function error(msg) {
+ throw msg;
+ }
+ """ :: forall a. String -> a
main = do
let value = mkValue 1
diff --git a/examples/passing/Functions2.purs b/examples/passing/Functions2.purs
index f759358..b046bae 100644
--- a/examples/passing/Functions2.purs
+++ b/examples/passing/Functions2.purs
@@ -6,9 +6,11 @@ module Main where
test = \const _ -> const
foreign import error
- "function error(msg) {\
- \ throw msg;\
- \}" :: forall a. String -> a
+ """
+ function error(msg) {
+ throw msg;
+ }
+ """ :: forall a. String -> a
main = do
let value = test "Done" {}
diff --git a/examples/passing/Guards.purs b/examples/passing/Guards.purs
index 22d4999..b883a4e 100644
--- a/examples/passing/Guards.purs
+++ b/examples/passing/Guards.purs
@@ -21,9 +21,9 @@ module Main where
| otherwise -> m
testIndentation :: Number -> Number -> Number
- testIndentation x y | x > 0
+ testIndentation x y | x > 0
= x + y
- | otherwise
+ | otherwise
= y - x
main = Debug.Trace.trace $ min "Done" "ZZZZ"
diff --git a/examples/passing/HoistError.purs b/examples/passing/HoistError.purs
index 1d9379b..3b371d9 100644
--- a/examples/passing/HoistError.purs
+++ b/examples/passing/HoistError.purs
@@ -4,11 +4,13 @@ import Control.Monad.Eff
import Debug.Trace
foreign import f
- "function f(x) {\
- \ return function () {\
- \ if (x !== 0) throw new Error('x is not 0');\
- \ }\
- \}" :: forall e. Number -> Eff e Number
+ """
+ function f(x) {
+ return function() {
+ if (x !== 0) throw new Error('x is not 0');
+ };
+ }
+ """ :: forall e. Number -> Eff e Number
main = do
let x = 0
diff --git a/examples/passing/JSReserved.purs b/examples/passing/JSReserved.purs
index d109d0a..a3b717a 100644
--- a/examples/passing/JSReserved.purs
+++ b/examples/passing/JSReserved.purs
@@ -4,9 +4,9 @@ module Main where
yield = 0
member = 1
-
+
public = \return -> return
-
+
this catch = catch
main = Debug.Trace.trace "Done"
diff --git a/examples/passing/KindedType.purs b/examples/passing/KindedType.purs
index 5e09b5b..9b16208 100644
--- a/examples/passing/KindedType.purs
+++ b/examples/passing/KindedType.purs
@@ -26,6 +26,6 @@ class Clazz (a :: *) where
def :: a
instance clazzString :: Clazz String where
- def = "test"
+ def = "test"
main = Debug.Trace.trace "Done"
diff --git a/examples/passing/Let.purs b/examples/passing/Let.purs
index ef4ecc6..b839f1b 100644
--- a/examples/passing/Let.purs
+++ b/examples/passing/Let.purs
@@ -4,12 +4,12 @@ import Prelude
import Control.Monad.Eff
import Control.Monad.ST
-test1 x = let
+test1 x = let
y :: Number
- y = x + 1
+ y = x + 1
in y
-test2 x y =
+test2 x y =
let x' = x + 1 in
let y' = y + 1 in
x' + y'
@@ -17,10 +17,10 @@ test2 x y =
test3 = let f x y z = x + y + z in
f 1 2 3
-test4 = let f x [y, z] = x y z in
+test4 = let f x [y, z] = x y z in
f (+) [1, 2]
-test5 = let
+test5 = let
f x | x > 0 = g (x / 2) + 1
f x = 0
g x = f (x - 1) + 1
@@ -42,12 +42,12 @@ test7 = let
in if f true then f 1 else f 2
test8 :: Number -> Number
-test8 x = let
+test8 x = let
go y | (x - 0.1 < y * y) && (y * y < x + 0.1) = y
go y = go $ (y + x / y) / 2
in go x
-test10 _ =
+test10 _ =
let
f x = g x * 3
g x = f x / 2
diff --git a/examples/passing/Monad.purs b/examples/passing/Monad.purs
index d147c53..dcff2ed 100644
--- a/examples/passing/Monad.purs
+++ b/examples/passing/Monad.purs
@@ -17,12 +17,12 @@ module Main where
maybe = { return : Just
, bind : \ma f -> case ma of
Nothing -> Nothing
- Just a -> f a
+ Just a -> f a
}
test :: forall m. Monad m -> m Number
test = \m -> m.bind (m.return 1) (\n1 ->
- m.bind (m.return "Test") (\n2 ->
+ m.bind (m.return "Test") (\n2 ->
m.return n1))
test1 = test id
diff --git a/examples/passing/MutRec.purs b/examples/passing/MutRec.purs
index 80c8939..c3e48bd 100644
--- a/examples/passing/MutRec.purs
+++ b/examples/passing/MutRec.purs
@@ -1,4 +1,4 @@
-module Main where
+module Main where
import Prelude
diff --git a/examples/passing/MutRec2.purs b/examples/passing/MutRec2.purs
index 6f828b0..89b90d0 100644
--- a/examples/passing/MutRec2.purs
+++ b/examples/passing/MutRec2.purs
@@ -1,7 +1,7 @@
module Main where
data A = A B
-
+
data B = B A
foreign import data S :: *
diff --git a/examples/passing/MutRec3.purs b/examples/passing/MutRec3.purs
index 0db2de8..9500826 100644
--- a/examples/passing/MutRec3.purs
+++ b/examples/passing/MutRec3.purs
@@ -1,7 +1,7 @@
module Main where
data A = A B
-
+
data B = B A
foreign import data S :: *
diff --git a/examples/passing/NamedPatterns.purs b/examples/passing/NamedPatterns.purs
index 34a62d4..6755b40 100644
--- a/examples/passing/NamedPatterns.purs
+++ b/examples/passing/NamedPatterns.purs
@@ -1,6 +1,6 @@
module Main where
- foo = \x -> case x of
+ foo = \x -> case x of
y@{ foo = "Foo" } -> y
y -> y
diff --git a/examples/passing/Newtype.purs b/examples/passing/Newtype.purs
index 787a556..2ec371d 100644
--- a/examples/passing/Newtype.purs
+++ b/examples/passing/Newtype.purs
@@ -12,11 +12,11 @@ newtype Box a = Box a
instance showBox :: (Show a) => Show (Box a) where
show (Box x) = "Box " ++ show x
-
+
apply f x = f x
-
+
main = do
print $ Thing "hello"
print $ Box 42
print $ apply Box 9000
- trace "Done" \ No newline at end of file
+ trace "Done"
diff --git a/examples/passing/NewtypeWithRecordUpdate.purs b/examples/passing/NewtypeWithRecordUpdate.purs
new file mode 100644
index 0000000..5d92b45
--- /dev/null
+++ b/examples/passing/NewtypeWithRecordUpdate.purs
@@ -0,0 +1,15 @@
+-- https://github.com/purescript/purescript/issues/812
+
+module Main where
+
+import Debug.Trace
+
+newtype NewType a = NewType (Object a)
+
+rec1 :: Object (a :: Number, b :: Number, c:: Number)
+rec1 = { a: 0, b: 0, c: 0 }
+
+rec2 :: NewType (a :: Number, b :: Number, c :: Number)
+rec2 = NewType (rec1 { a = 1 })
+
+main = trace "Done"
diff --git a/examples/passing/ObjectSynonym.purs b/examples/passing/ObjectSynonym.purs
index 42f1006..8941b87 100644
--- a/examples/passing/ObjectSynonym.purs
+++ b/examples/passing/ObjectSynonym.purs
@@ -10,4 +10,4 @@ type Outer = { inner :: Inner }
outer :: Outer
outer = { inner: inner }
-main = Debug.Trace.trace "Done"
+main = Debug.Trace.trace "Done"
diff --git a/examples/passing/ObjectUpdate2.purs b/examples/passing/ObjectUpdate2.purs
index 98af5d3..cc19b95 100644
--- a/examples/passing/ObjectUpdate2.purs
+++ b/examples/passing/ObjectUpdate2.purs
@@ -7,7 +7,7 @@ foreign import x "var x = {};" :: forall r. X r
blah :: forall r. X r -> X r
blah x = x
-test = blah x
+test = blah x
{ baz = "blah"
}
diff --git a/examples/passing/Objects.purs b/examples/passing/Objects.purs
index 26ab1a9..8e76f4c 100644
--- a/examples/passing/Objects.purs
+++ b/examples/passing/Objects.purs
@@ -31,5 +31,5 @@ module Main where
{ "***": n } -> n
test7 {a: snoog , b : blah } = blah
-
+
main = Debug.Trace.trace "Done"
diff --git a/examples/passing/OperatorAssociativity.purs b/examples/passing/OperatorAssociativity.purs
index ad55243..715be7e 100644
--- a/examples/passing/OperatorAssociativity.purs
+++ b/examples/passing/OperatorAssociativity.purs
@@ -6,20 +6,26 @@ import Debug.Trace
foreign import data Assert :: !
foreign import assert
- "function assert(x) { return function (desc) {\
- \ return function () {\
- \ if (!x) throw new Error('assertion (' + desc + ') failed');\
- \ return {};\
- \ };\
- \};};" :: forall e. Boolean -> String -> Eff (assert :: Assert | e) Unit
+ """
+ function assert(x) {
+ return function(desc) {
+ return function() {
+ if (!x) throw new Error('assertion (' + desc + ') failed');
+ return {};
+ };
+ };
+ }
+ """ :: forall e. Boolean -> String -> Eff (assert :: Assert | e) Unit
bug :: Number -> Number -> Number
bug a b = 0 - (a - b)
foreign import explode
- "function explode() {\
- \ throw new Error('Assertion failed!');\
- \}":: forall eff a. Eff eff a
+ """
+ function explode() {
+ throw new Error('Assertion failed!');
+ }
+ """ :: forall eff a. Eff eff a
main = do
assert (bug 0 2 == 2) "bug 0 2 == 2"
diff --git a/examples/passing/Operators.purs b/examples/passing/Operators.purs
index 69ef6c3..ef5f10b 100644
--- a/examples/passing/Operators.purs
+++ b/examples/passing/Operators.purs
@@ -2,7 +2,7 @@ module Main where
import Control.Monad.Eff
import Debug.Trace
-
+
(?!) :: forall a. a -> a -> a
(?!) x _ = x
@@ -29,7 +29,7 @@ module Main where
test6 = ((\x -> x) `k` 2) 3
- (<+>) :: String -> String -> String
+ (<+>) :: String -> String -> String
(<+>) = \s1 s2 -> s1 ++ s2
test7 = "Hello" <+> "World!"
@@ -39,7 +39,7 @@ module Main where
foo :: String -> String
foo = \s -> s
-
+
test8 = foo @@ "Hello World"
test9 = Main.foo @@ "Hello World"
@@ -52,7 +52,7 @@ module Main where
test11 = [1, 2, 3] ... [4, 5, 6]
test12 (<%>) a b = a <%> b
-
+
test13 = \(<%>) a b -> a <%> b
test14 :: Number -> Number -> Boolean
@@ -61,7 +61,7 @@ module Main where
test15 :: Number -> Number -> Boolean
test15 a b = const false $ a `test14` b
- test16 :: Number -> Number -> Number
+ test16 :: Number -> Number -> Number
test16 x y = x .|. y .&. y
test17 :: Number
diff --git a/examples/passing/OptimizerBug.purs b/examples/passing/OptimizerBug.purs
index a9abe02..dd88e96 100644
--- a/examples/passing/OptimizerBug.purs
+++ b/examples/passing/OptimizerBug.purs
@@ -5,5 +5,5 @@ import Prelude
x a = 1 + y a
y a = x a
-
+
main = Debug.Trace.trace "Done"
diff --git a/examples/passing/PartialFunction.purs b/examples/passing/PartialFunction.purs
index 7342427..3517cb5 100644
--- a/examples/passing/PartialFunction.purs
+++ b/examples/passing/PartialFunction.purs
@@ -1,14 +1,16 @@
module Main where
foreign import testError
- "function testError(f) {\
- \ try {\
- \ return f();\
- \ } catch (e) {\
- \ if (e instanceof Error) return 'success';\
- \ throw new Error('Pattern match failure is not Error');\
- \ }\
- \}" :: (Unit -> Number) -> String
+ """
+ function testError(f) {
+ try {
+ return f();
+ } catch (e) {
+ if (e instanceof Error) return 'success';
+ throw new Error('Pattern match failure is not Error');
+ }
+ }
+ """ :: (Unit -> Number) -> String
fn :: Number -> Number
fn 0 = 0
diff --git a/examples/passing/Patterns.purs b/examples/passing/Patterns.purs
index c09d13e..90fab1b 100644
--- a/examples/passing/Patterns.purs
+++ b/examples/passing/Patterns.purs
@@ -2,7 +2,7 @@ module Main where
import Prelude
- test = \x -> case x of
+ test = \x -> case x of
{ str = "Foo", bool = true } -> true
{ str = "Bar", bool = b } -> b
_ -> false
@@ -17,12 +17,12 @@ module Main where
_ -> 0
- h = \o -> case o of
+ h = \o -> case o of
a@[_,_,_] -> a
_ -> []
isDesc :: [Number] -> Boolean
isDesc [x, y] | x > y = true
isDesc _ = false
-
+
main = Debug.Trace.trace "Done"
diff --git a/examples/passing/Person.purs b/examples/passing/Person.purs
index daaed44..57b52e8 100644
--- a/examples/passing/Person.purs
+++ b/examples/passing/Person.purs
@@ -4,13 +4,15 @@ module Main where
data Person = Person { name :: String, age :: Number }
- foreign import itoa
- "function itoa(n) {\
- \ return n.toString();\
- \}" :: Number -> String
-
+ foreign import itoa
+ """
+ function itoa(n) {
+ return n.toString();
+ }
+ """ :: Number -> String
+
showPerson :: Person -> String
showPerson = \p -> case p of
Person o -> o.name ++ ", aged " ++ itoa(o.age)
-
+
main = Debug.Trace.trace "Done"
diff --git a/examples/passing/Rank2Data.purs b/examples/passing/Rank2Data.purs
index c7ed2e5..fb030b0 100644
--- a/examples/passing/Rank2Data.purs
+++ b/examples/passing/Rank2Data.purs
@@ -25,5 +25,5 @@ module Main where
two = succ zero
four = add two two
fourNumber = runNat four
-
+
main = Debug.Trace.trace "Done"
diff --git a/examples/passing/Rank2TypeSynonym.purs b/examples/passing/Rank2TypeSynonym.purs
index 22539bb..b58ab3d 100644
--- a/examples/passing/Rank2TypeSynonym.purs
+++ b/examples/passing/Rank2TypeSynonym.purs
@@ -3,10 +3,10 @@ module Main where
import Control.Monad.Eff
type Foo a = forall f. (Monad f) => f a
-
+
foo :: forall a. a -> Foo a
foo x = pure x
-
+
bar :: Foo Number
bar = foo 3
diff --git a/examples/passing/Rank2Types.purs b/examples/passing/Rank2Types.purs
index 864abc5..d863050 100644
--- a/examples/passing/Rank2Types.purs
+++ b/examples/passing/Rank2Types.purs
@@ -7,5 +7,5 @@ module Main where
forever :: forall m a b. (forall a b. m a -> (a -> m b) -> m b) -> m a -> m b
forever = \bind action -> bind action $ \_ -> forever bind action
-
+
main = Debug.Trace.trace "Done"
diff --git a/examples/passing/Recursion.purs b/examples/passing/Recursion.purs
index b6d7c1d..54afcbd 100644
--- a/examples/passing/Recursion.purs
+++ b/examples/passing/Recursion.purs
@@ -6,5 +6,5 @@ module Main where
0 -> 1
1 -> 1
n -> fib (n - 1) + fib (n - 2)
-
+
main = Debug.Trace.trace "Done"
diff --git a/examples/passing/Sequence.purs b/examples/passing/Sequence.purs
index 222829d..dd17830 100644
--- a/examples/passing/Sequence.purs
+++ b/examples/passing/Sequence.purs
@@ -4,9 +4,9 @@ import Control.Monad.Eff
class Sequence t where
sequence :: forall m a. (Monad m) => t (m a) -> m (t a)
-
+
instance sequenceArray :: Sequence [] where
sequence [] = pure []
- sequence (x:xs) = (:) <$> x <*> sequence xs
+ sequence (x:xs) = (:) <$> x <*> sequence xs
main = sequence $ [Debug.Trace.trace "Done"]
diff --git a/examples/passing/ShadowedRename.purs b/examples/passing/ShadowedRename.purs
index 1a58db6..ba54b10 100644
--- a/examples/passing/ShadowedRename.purs
+++ b/examples/passing/ShadowedRename.purs
@@ -4,11 +4,13 @@ import Control.Monad.Eff
import Debug.Trace
foreign import f
- "function f(x) {\
- \ return function () {\
- \ if (x !== 2) throw new Error('x is not 2');\
- \ }\
- \}" :: forall e. Number -> Eff e Number
+ """
+ function f(x) {
+ return function() {
+ if (x !== 2) throw new Error('x is not 2');
+ };
+ }
+ """ :: forall e. Number -> Eff e Number
foo foo = let foo_1 = \_ -> foo
foo_2 = foo_1 unit + 1
diff --git a/examples/passing/ShadowedTCOLet.purs b/examples/passing/ShadowedTCOLet.purs
index 5089013..6c567ee 100644
--- a/examples/passing/ShadowedTCOLet.purs
+++ b/examples/passing/ShadowedTCOLet.purs
@@ -1,7 +1,7 @@
module Main where
-f x y z =
- let f 1 2 3 = 1
+f x y z =
+ let f 1 2 3 = 1
in f x z y
-
+
main = Debug.Trace.trace $ show $ f 1 3 2
diff --git a/examples/passing/SignedNumericLiterals.purs b/examples/passing/SignedNumericLiterals.purs
index 24d935e..f5a9004 100644
--- a/examples/passing/SignedNumericLiterals.purs
+++ b/examples/passing/SignedNumericLiterals.purs
@@ -6,10 +6,10 @@ module Main where
y = -0.5
z = 0.5
w = 1
-
+
f :: Number -> Number
f x = -x
test1 = 2 - 1
-
+
main = Debug.Trace.trace "Done"
diff --git a/examples/passing/Superclasses3.purs b/examples/passing/Superclasses3.purs
index bacbd89..28e8d4c 100644
--- a/examples/passing/Superclasses3.purs
+++ b/examples/passing/Superclasses3.purs
@@ -33,7 +33,7 @@ instance applicativeMTrace :: Applicative MTrace where
instance bindMTrace :: Bind MTrace where
(>>=) m f = MTrace (runMTrace m >>= (runMTrace <<< f))
-instance monadMTrace :: Monad MTrace
+instance monadMTrace :: Monad MTrace
instance writerMTrace :: MonadWriter String MTrace where
tell s = MTrace (trace s)
diff --git a/examples/passing/TailCall.purs b/examples/passing/TailCall.purs
index 56e93cc..dbc3046 100644
--- a/examples/passing/TailCall.purs
+++ b/examples/passing/TailCall.purs
@@ -9,7 +9,7 @@ test n (x:xs) = test (n + x) xs
loop :: forall a. Number -> a
loop x = loop (x + 1)
-notATailCall = \x ->
+notATailCall = \x ->
(\notATailCall -> notATailCall x) (\x -> x)
-
+
main = Debug.Trace.print (test 0 [1, 2, 3])
diff --git a/examples/passing/TopLevelCase.purs b/examples/passing/TopLevelCase.purs
index 5421032..2c938d0 100644
--- a/examples/passing/TopLevelCase.purs
+++ b/examples/passing/TopLevelCase.purs
@@ -14,5 +14,5 @@ module Main where
data A = A
parseTest A 0 = 0
-
+
main = Debug.Trace.trace "Done"
diff --git a/examples/passing/TypeClassImport.purs b/examples/passing/TypeClassImport.purs
index 4ddcaea..9423941 100644
--- a/examples/passing/TypeClassImport.purs
+++ b/examples/passing/TypeClassImport.purs
@@ -7,9 +7,9 @@ foreign import data C :: *
foreign import t "var t = null;" :: T
foreign import inst """
- var inst = {
- show: function(t) {
- return 'Done';
+ var inst = {
+ show: function(t) {
+ return 'Done';
}
}""" :: C
diff --git a/examples/passing/TypeClassMemberOrderChange.purs b/examples/passing/TypeClassMemberOrderChange.purs
index ccf98a2..2d7744d 100644
--- a/examples/passing/TypeClassMemberOrderChange.purs
+++ b/examples/passing/TypeClassMemberOrderChange.purs
@@ -3,7 +3,7 @@ module Main where
class Test a where
fn :: a -> a -> a
val :: a
-
+
instance testBoolean :: Test Boolean where
val = true
fn x y = y
diff --git a/examples/passing/TypeDecl.purs b/examples/passing/TypeDecl.purs
index 8b6eb29..b7c7296 100644
--- a/examples/passing/TypeDecl.purs
+++ b/examples/passing/TypeDecl.purs
@@ -8,5 +8,5 @@ module Main where
iterate :: forall a. Number -> (a -> a) -> a -> a
iterate 0 f a = a
iterate n f a = iterate (n - 1) f (f a)
-
+
main = Debug.Trace.trace "Done"
diff --git a/examples/passing/TypeSynonyms.purs b/examples/passing/TypeSynonyms.purs
index 8d04444..f4f812b 100644
--- a/examples/passing/TypeSynonyms.purs
+++ b/examples/passing/TypeSynonyms.purs
@@ -1,6 +1,6 @@
module Main where
- type Lens a b =
+ type Lens a b =
{ get :: a -> b
, set :: a -> b -> a
}
@@ -14,7 +14,7 @@ module Main where
type Pair a b = { fst :: a, snd :: b }
fst :: forall a b. Lens (Pair a b) a
- fst =
+ fst =
{ get: \p -> p.fst
, set: \p a -> { fst: a, snd: p.snd }
}
diff --git a/examples/passing/TypeWildcardsRecordExtension.purs b/examples/passing/TypeWildcardsRecordExtension.purs
index ea6c01a..ecab817 100644
--- a/examples/passing/TypeWildcardsRecordExtension.purs
+++ b/examples/passing/TypeWildcardsRecordExtension.purs
@@ -1,5 +1,5 @@
module Main where
-
+
foo :: forall a. {b :: Number | a} -> {b :: Number | _}
foo f = f
diff --git a/examples/passing/Where.purs b/examples/passing/Where.purs
index d63d774..ff0b4d4 100644
--- a/examples/passing/Where.purs
+++ b/examples/passing/Where.purs
@@ -7,24 +7,24 @@ import Control.Monad.ST
test1 x = y
where
y :: Number
- y = x + 1
+ y = x + 1
test2 x y = x' + y'
where
x' = x + 1
y' = y + 1
-
+
test3 = f 1 2 3
where f x y z = x + y + z
-
+
test4 = f (+) [1, 2]
where f x [y, z] = x y z
-
+
test5 = g 10
- where
+ where
f x | x > 0 = g (x / 2) + 1
f x = 0
g x = f (x - 1) + 1
@@ -35,7 +35,7 @@ test6 = if f true then f 1 else f 2
test7 :: Number -> Number
test7 x = go x
- where
+ where
go y | (x - 0.1 < y * y) && (y * y < x + 0.1) = y
go y = go $ (y + x / y) / 2
diff --git a/examples/passing/s.purs b/examples/passing/s.purs
index 1281767..fe33bf4 100644
--- a/examples/passing/s.purs
+++ b/examples/passing/s.purs
@@ -1,5 +1,5 @@
module Main where
s = \x y z -> x z (y z)
-
+
main = Debug.Trace.trace "Done"
diff --git a/psc-docs/Main.hs b/psc-docs/Main.hs
index 9cc11da..0aeb9bd 100644
--- a/psc-docs/Main.hs
+++ b/psc-docs/Main.hs
@@ -136,7 +136,7 @@ renderDeclaration n _ (P.ExternDataDeclaration name kind) =
renderDeclaration n _ (P.TypeSynonymDeclaration name args ty) = do
let
typeApp = foldl P.TypeApp (P.TypeConstructor (P.Qualified Nothing name)) (map toTypeVar args)
- typeName = prettyPrintType' typeApp
+ typeName = prettyPrintType' typeApp
atIndent n $ "type " ++ typeName ++ " = " ++ prettyPrintType' ty
renderDeclaration n exps (P.TypeClassDeclaration name args implies ds) = do
let impliesText = case implies of
@@ -161,7 +161,7 @@ renderComments :: Int -> [P.Comment] -> Docs
renderComments n cs = mapM_ (atIndent n) ls
where
ls = concatMap toLines cs
-
+
toLines (P.LineComment s) = [s]
toLines (P.BlockComment s) = lines s
@@ -217,7 +217,7 @@ inputFile = strArgument $
<> help "The input .purs file(s)"
includeHeirarcy :: Parser Bool
-includeHeirarcy = switch $
+includeHeirarcy = switch $
long "hierarchy-images"
<> help "Include markdown for type class hierarchy images in the output."
@@ -232,6 +232,6 @@ main = execParser opts >>= docgen
infoModList = fullDesc <> headerInfo <> footerInfo
headerInfo = header "psc-docs - Generate Markdown documentation from PureScript extern files"
footerInfo = footer $ "psc-docs " ++ showVersion Paths.version
-
+
version :: Parser (a -> a)
version = abortOption (InfoMsg (showVersion Paths.version)) $ long "version" <> help "Show the version number" <> hidden
diff --git a/psc-make/Main.hs b/psc-make/Main.hs
index efd2dc9..3912e8e 100644
--- a/psc-make/Main.hs
+++ b/psc-make/Main.hs
@@ -111,12 +111,12 @@ outputDirectory = strOption $
<> help "The output directory"
noTco :: Parser Bool
-noTco = switch $
+noTco = switch $
long "no-tco"
<> help "Disable tail call optimizations"
noPrelude :: Parser Bool
-noPrelude = switch $
+noPrelude = switch $
long "no-prelude"
<> help "Omit the Prelude"
@@ -137,15 +137,15 @@ verboseErrors = switch $
<> help "Display verbose error messages"
noPrefix :: Parser Bool
-noPrefix = switch $
+noPrefix = switch $
short 'p'
<> long "no-prefix"
<> help "Do not include comment header"
options :: Parser (P.Options P.Make)
-options = P.Options <$> noPrelude
- <*> noTco
+options = P.Options <$> noPrelude
+ <*> noTco
<*> noMagicDo
<*> pure Nothing
<*> noOpts
@@ -153,9 +153,9 @@ options = P.Options <$> noPrelude
<*> pure P.MakeOptions
pscMakeOptions :: Parser PSCMakeOptions
-pscMakeOptions = PSCMakeOptions <$> many inputFile
- <*> outputDirectory
- <*> options
+pscMakeOptions = PSCMakeOptions <$> many inputFile
+ <*> outputDirectory
+ <*> options
<*> (not <$> noPrefix)
main :: IO ()
@@ -165,6 +165,6 @@ main = execParser opts >>= compile
infoModList = fullDesc <> headerInfo <> footerInfo
headerInfo = header "psc-make - Compiles PureScript to Javascript"
footerInfo = footer $ "psc-make " ++ showVersion Paths.version
-
+
version :: Parser (a -> a)
version = abortOption (InfoMsg (showVersion Paths.version)) $ long "version" <> help "Show the version number" <> hidden
diff --git a/psc/Main.hs b/psc/Main.hs
index 0171391..0e42118 100644
--- a/psc/Main.hs
+++ b/psc/Main.hs
@@ -115,25 +115,25 @@ runMain = optional $ noArgs <|> withArgs
where
defaultVal = "Main"
noArgs = flag' defaultVal (long "main")
- withArgs = strOption $
+ withArgs = strOption $
long "main"
<> help (concat [
"Generate code to run the main method in the specified module. ",
"(no argument: \"", defaultVal, "\")"
])
-
+
noMagicDo :: Parser Bool
noMagicDo = switch $
long "no-magic-do"
<> help "Disable the optimization that overloads the do keyword to generate efficient code specifically for the Eff monad."
-
+
noTco :: Parser Bool
-noTco = switch $
+noTco = switch $
long "no-tco"
<> help "Disable tail call optimizations"
noPrelude :: Parser Bool
-noPrelude = switch $
+noPrelude = switch $
long "no-prelude"
<> help "Omit the Prelude"
@@ -161,22 +161,22 @@ externsFile = optional . strOption $
<> help "The output .e.purs file"
noPrefix :: Parser Bool
-noPrefix = switch $
+noPrefix = switch $
short 'p'
<> long "no-prefix"
<> help "Do not include comment header"
options :: Parser (P.Options P.Compile)
-options = P.Options <$> noPrelude
- <*> noTco
+options = P.Options <$> noPrelude
+ <*> noTco
<*> noMagicDo
<*> runMain
<*> noOpts
<*> verboseErrors
<*> additionalOptions
where
- additionalOptions =
- P.CompileOptions <$> browserNamespace
+ additionalOptions =
+ P.CompileOptions <$> browserNamespace
<*> many dceModule
<*> many codeGenModule
@@ -195,7 +195,7 @@ main = execParser opts >>= compile
infoModList = fullDesc <> headerInfo <> footerInfo
headerInfo = header "psc - Compiles PureScript to Javascript"
footerInfo = footer $ "psc " ++ showVersion Paths.version
-
+
version :: Parser (a -> a)
version = abortOption (InfoMsg (showVersion Paths.version)) $ long "version" <> help "Show the version number" <> hidden
diff --git a/psci/Parser.hs b/psci/Parser.hs
index 6fb4dbe..0d5cd53 100644
--- a/psci/Parser.hs
+++ b/psci/Parser.hs
@@ -34,8 +34,8 @@ import qualified Language.PureScript.Parser.Common as C (mark, same)
-- Parses PSCI metacommands or expressions input from the user.
--
parseCommand :: String -> Either String Command
-parseCommand cmdString =
- case splitCommand cmdString of
+parseCommand cmdString =
+ case splitCommand cmdString of
Just ('?', _) -> return Help
Just ('q', _) -> return Quit
Just ('r', _) -> return Reset
@@ -52,7 +52,7 @@ parseCommand cmdString =
parseRest p s = either (Left . show) Right $ do
ts <- P.lex "" s
P.runTokenParser "" (p <* eof) ts
-
+
trimEnd :: String -> String
trimEnd = reverse . dropWhile isSpace . reverse
@@ -68,7 +68,7 @@ parseCommand cmdString =
--
psciExpression :: P.TokenParser Command
psciExpression = Expression <$> P.parseValue
-
+
-- |
-- PSCI version of @let@.
-- This is essentially let from do-notation.
diff --git a/purescript.cabal b/purescript.cabal
index c531259..3ae0e23 100644
--- a/purescript.cabal
+++ b/purescript.cabal
@@ -1,5 +1,5 @@
name: purescript
-version: 0.6.4
+version: 0.6.4.1
cabal-version: >=1.8
build-type: Simple
license: MIT
@@ -150,7 +150,7 @@ executable psci
ghc-options: -Wall -fno-warn-warnings-deprecations -O2
executable psc-docs
- build-depends: base >=4 && <5, purescript -any,
+ build-depends: base >=4 && <5, purescript -any,
optparse-applicative >= 0.10.0, process -any, mtl -any
main-is: Main.hs
buildable: True
diff --git a/src/Language/PureScript/AST/SourcePos.hs b/src/Language/PureScript/AST/SourcePos.hs
index bc48f19..90b9e94 100644
--- a/src/Language/PureScript/AST/SourcePos.hs
+++ b/src/Language/PureScript/AST/SourcePos.hs
@@ -48,6 +48,6 @@ data SourceSpan = SourceSpan
--
, spanEnd :: SourcePos
} deriving (D.Data, D.Typeable)
-
+
instance Show SourceSpan where
- show sp = spanName sp ++ " " ++ show (spanStart sp) ++ " - " ++ show (spanEnd sp) \ No newline at end of file
+ show sp = spanName sp ++ " " ++ show (spanStart sp) ++ " - " ++ show (spanEnd sp)
diff --git a/src/Language/PureScript/CodeGen/Externs.hs b/src/Language/PureScript/CodeGen/Externs.hs
index 0d9b6a5..5fc401e 100644
--- a/src/Language/PureScript/CodeGen/Externs.hs
+++ b/src/Language/PureScript/CodeGen/Externs.hs
@@ -45,11 +45,18 @@ moduleToPs (Module moduleName ds (Just exts)) env = intercalate "\n" . execWrite
declToPs :: Declaration -> Writer [String] ()
declToPs (ImportDeclaration mn _ _) = tell ["import " ++ show mn ++ " ()"]
- declToPs (FixityDeclaration (Fixity assoc prec) ident) =
- tell [ unwords [ show assoc, show prec, ident ] ]
+ declToPs (FixityDeclaration (Fixity assoc prec) op) =
+ case find exportsOp exts of
+ Nothing -> return ()
+ Just _ -> tell [ unwords [ show assoc, show prec, op ] ]
+ where
+ exportsOp :: DeclarationRef -> Bool
+ exportsOp (PositionedDeclarationRef _ _ r) = exportsOp r
+ exportsOp (ValueRef ident') = ident' == Op op
+ exportsOp _ = False
declToPs (PositionedDeclaration _ com d) = mapM commentToPs com >> declToPs d
declToPs _ = return ()
-
+
commentToPs :: Comment -> Writer [String] ()
commentToPs (LineComment s) = tell ["-- " ++ s]
commentToPs (BlockComment s) = tell ["{- " ++ s ++ " -}"]
diff --git a/src/Language/PureScript/CodeGen/JS.hs b/src/Language/PureScript/CodeGen/JS.hs
index 56dd843..c5305e4 100644
--- a/src/Language/PureScript/CodeGen/JS.hs
+++ b/src/Language/PureScript/CodeGen/JS.hs
@@ -81,7 +81,7 @@ bindToJs mp (NonRec ident val) = return <$> nonRecToJS mp ident val
bindToJs mp (Rec vals) = forM vals (uncurry (nonRecToJS mp))
-- |
--- Generate code in the simplified Javascript intermediate representation for a single non-recursive
+-- Generate code in the simplified Javascript intermediate representation for a single non-recursive
-- declaration.
--
-- The main purpose of this function is to handle code generation for comments.
@@ -92,7 +92,7 @@ nonRecToJS m i e@(extractAnn -> (_, com, _, _)) | not (null com) =
nonRecToJS mp ident val = do
js <- valueToJs mp val
return $ JSVariableIntroduction (identToJs ident) (Just js)
-
+
-- |
-- Generate code in the simplified Javascript intermediate representation for a variable based on a
diff --git a/src/Language/PureScript/Comments.hs b/src/Language/PureScript/Comments.hs
index a1871da..d6249ef 100644
--- a/src/Language/PureScript/Comments.hs
+++ b/src/Language/PureScript/Comments.hs
@@ -18,8 +18,8 @@
module Language.PureScript.Comments where
import qualified Data.Data as D
-
+
data Comment
= LineComment String
| BlockComment String
- deriving (Show, Eq, Ord, D.Data, D.Typeable) \ No newline at end of file
+ deriving (Show, Eq, Ord, D.Data, D.Typeable)
diff --git a/src/Language/PureScript/CoreFn/Ann.hs b/src/Language/PureScript/CoreFn/Ann.hs
index 9bb65fb..d75c84f 100644
--- a/src/Language/PureScript/CoreFn/Ann.hs
+++ b/src/Language/PureScript/CoreFn/Ann.hs
@@ -34,4 +34,4 @@ nullAnn = (Nothing, [], Nothing, Nothing)
-- Remove the comments from an annotation
--
removeComments :: Ann -> Ann
-removeComments (ss, _, ty, meta) = (ss, [], ty, meta) \ No newline at end of file
+removeComments (ss, _, ty, meta) = (ss, [], ty, meta)
diff --git a/src/Language/PureScript/Parser.hs b/src/Language/PureScript/Parser.hs
index 0e081ce..a619466 100644
--- a/src/Language/PureScript/Parser.hs
+++ b/src/Language/PureScript/Parser.hs
@@ -32,4 +32,4 @@ import Language.PureScript.Parser.Types as P
import Language.PureScript.Parser.State as P
import Language.PureScript.Parser.Kinds as P
import Language.PureScript.Parser.Lexer as P
-import Language.PureScript.Parser.Declarations as P \ No newline at end of file
+import Language.PureScript.Parser.Declarations as P
diff --git a/src/Language/PureScript/Parser/Lexer.hs b/src/Language/PureScript/Parser/Lexer.hs
index 945ccef..1585da7 100644
--- a/src/Language/PureScript/Parser/Lexer.hs
+++ b/src/Language/PureScript/Parser/Lexer.hs
@@ -15,7 +15,7 @@
{-# LANGUAGE TupleSections #-}
-module Language.PureScript.Parser.Lexer
+module Language.PureScript.Parser.Lexer
( PositionedToken(..)
, Token()
, TokenParser()
@@ -34,8 +34,8 @@ module Language.PureScript.Parser.Lexer
, squares
, indent
, indentAt
- , larrow
- , rarrow
+ , larrow
+ , rarrow
, lfatArrow
, rfatArrow
, colon
@@ -83,7 +83,7 @@ import Language.PureScript.Comments
import qualified Text.Parsec as P
import qualified Text.Parsec.Token as PT
-
+
data Token
= LParen
| RParen
@@ -112,7 +112,7 @@ data Token
| StringLiteral String
| Number (Either Integer Double)
deriving (Show, Eq, Ord)
-
+
prettyPrintToken :: Token -> String
prettyPrintToken LParen = "("
prettyPrintToken RParen = ")"
@@ -146,19 +146,19 @@ data PositionedToken = PositionedToken
, ptToken :: Token
, ptComments :: [Comment]
} deriving (Eq)
-
+
instance Show PositionedToken where
show = show . ptToken
lex :: FilePath -> String -> Either P.ParseError [PositionedToken]
lex filePath input = P.parse parseTokens filePath input
-
+
parseTokens :: P.Parsec String u [PositionedToken]
parseTokens = whitespace *> P.many parsePositionedToken <* P.skipMany parseComment <* P.eof
whitespace :: P.Parsec String u ()
whitespace = P.skipMany (P.satisfy isSpace)
-
+
parseComment :: P.Parsec String u Comment
parseComment = (BlockComment <$> blockComment <|> LineComment <$> lineComment) <* whitespace
where
@@ -177,11 +177,11 @@ parsePositionedToken = P.try $ do
parseToken :: P.Parsec String u Token
parseToken = P.choice
- [ P.try $ P.string "<-" *> P.notFollowedBy symbolChar *> pure LArrow
+ [ P.try $ P.string "<-" *> P.notFollowedBy symbolChar *> pure LArrow
, P.try $ P.string "<=" *> P.notFollowedBy symbolChar *> pure LFatArrow
- , P.try $ P.string "->" *> P.notFollowedBy symbolChar *> pure RArrow
- , P.try $ P.string "=>" *> P.notFollowedBy symbolChar *> pure RFatArrow
- , P.try $ P.string "::" *> P.notFollowedBy symbolChar *> pure DoubleColon
+ , P.try $ P.string "->" *> P.notFollowedBy symbolChar *> pure RArrow
+ , P.try $ P.string "=>" *> P.notFollowedBy symbolChar *> pure RFatArrow
+ , P.try $ P.string "::" *> P.notFollowedBy symbolChar *> pure DoubleColon
, P.try $ P.char '(' *> pure LParen
, P.try $ P.char ')' *> pure RParen
, P.try $ P.char '{' *> pure LBrace
@@ -196,10 +196,10 @@ parseToken = P.choice
, P.try $ P.char '.' *> P.notFollowedBy symbolChar *> pure Dot
, P.try $ P.char ';' *> P.notFollowedBy symbolChar *> pure Semi
, P.try $ P.char '@' *> P.notFollowedBy symbolChar *> pure At
- , LName <$> parseLName
+ , LName <$> parseLName
, do uName <- parseUName
(guard (validModuleName uName) >> Qualifier uName <$ P.char '.') <|> pure (UName uName)
- , Symbol <$> parseSymbol
+ , Symbol <$> parseSymbol
, StringLiteral <$> parseStringLiteral
, Number <$> parseNumber
] <* whitespace
@@ -207,16 +207,16 @@ parseToken = P.choice
where
parseLName :: P.Parsec String u String
parseLName = (:) <$> identStart <*> P.many identLetter
-
+
parseUName :: P.Parsec String u String
parseUName = (:) <$> P.upper <*> P.many uidentLetter
-
+
parseSymbol :: P.Parsec String u String
parseSymbol = P.many1 symbolChar
-
+
identStart :: P.Parsec String u Char
identStart = P.lower <|> P.oneOf "_"
-
+
identLetter :: P.Parsec String u Char
identLetter = P.alphaNum <|> P.oneOf "_'"
@@ -225,13 +225,13 @@ parseToken = P.choice
symbolChar :: P.Parsec String u Char
symbolChar = P.oneOf opChars
-
+
parseStringLiteral :: P.Parsec String u String
parseStringLiteral = blockString <|> PT.stringLiteral tokenParser
- where
+ where
delimeter = P.try (P.string "\"\"\"")
blockString = delimeter >> P.manyTill P.anyChar delimeter
-
+
parseNumber :: P.Parsec String u (Either Integer Double)
parseNumber = (Right <$> P.try (PT.float tokenParser) <|>
Left <$> P.try (PT.natural tokenParser)) P.<?> "number"
@@ -261,10 +261,10 @@ tokenParser :: PT.GenTokenParser String u Identity
tokenParser = PT.makeTokenParser langDef
type TokenParser a = P.Parsec [PositionedToken] ParseState a
-
+
anyToken :: TokenParser PositionedToken
anyToken = P.token (prettyPrintToken . ptToken) ptSourcePos Just
-
+
token :: (Token -> Maybe a) -> TokenParser a
token f = P.token (prettyPrintToken . ptToken) ptSourcePos (f . ptToken)
@@ -347,7 +347,7 @@ semi :: TokenParser ()
semi = match Semi
at :: TokenParser ()
-at = match At
+at = match At
-- |
-- Parse zero or more values separated by semicolons
@@ -408,7 +408,7 @@ uname' s = token go P.<?> show s
where
go (UName s') | s == s' = Just ()
go _ = Nothing
-
+
symbol :: TokenParser String
symbol = token go P.<?> "symbol"
where
@@ -424,7 +424,7 @@ symbol' s = token go P.<?> show s
go Colon | s == ":" = Just ()
go LFatArrow | s == "<=" = Just ()
go _ = Nothing
-
+
stringLiteral :: TokenParser String
stringLiteral = token go P.<?> "string literal"
where
@@ -448,10 +448,10 @@ identifier = token go P.<?> "identifier"
where
go (LName s) | s `notElem` reservedPsNames = Just s
go _ = Nothing
-
+
validModuleName :: String -> Bool
validModuleName s = not ('_' `elem` s)
-
+
-- |
-- A list of purescript reserved identifiers
--
@@ -479,7 +479,7 @@ reservedPsNames = [ "data"
, "in"
, "where"
]
-
+
reservedTypeNames :: [String]
reservedTypeNames = [ "forall", "where" ]
@@ -488,4 +488,4 @@ reservedTypeNames = [ "forall", "where" ]
--
opChars :: [Char]
opChars = ":!#$%&*+./<=>?@\\^|-~"
-
+
diff --git a/src/Language/PureScript/Pretty/JS.hs b/src/Language/PureScript/Pretty/JS.hs
index 6cda6cb..69d55ba 100644
--- a/src/Language/PureScript/Pretty/JS.hs
+++ b/src/Language/PureScript/Pretty/JS.hs
@@ -135,16 +135,16 @@ literals = mkPattern' match
commentLines :: Comment -> [String]
commentLines (LineComment s) = [s]
commentLines (BlockComment s) = lines s
-
- asLine :: String -> StateT PrinterState Maybe String
+
+ asLine :: String -> StateT PrinterState Maybe String
asLine s = do
i <- currentIndent
return $ i ++ " * " ++ removeComments s ++ "\n"
-
+
removeComments :: String -> String
removeComments ('*' : '/' : s) = removeComments s
removeComments (c : s) = c : removeComments s
-
+
removeComments [] = []
match (JSRaw js) = return js
match _ = mzero
diff --git a/src/Language/PureScript/Pretty/Types.hs b/src/Language/PureScript/Pretty/Types.hs
index 5c8ea9c..445a318 100644
--- a/src/Language/PureScript/Pretty/Types.hs
+++ b/src/Language/PureScript/Pretty/Types.hs
@@ -34,7 +34,7 @@ import Language.PureScript.Environment
typeLiterals :: Pattern () Type String
typeLiterals = mkPattern match
where
- match TypeWildcard = Just "_"
+ match TypeWildcard = Just "_"
match (TypeVar var) = Just var
match (PrettyPrintObject row) = Just $ "{ " ++ prettyPrintRow row ++ " }"
match (PrettyPrintArray ty) = Just $ "[" ++ prettyPrintType ty ++ "]"
diff --git a/src/Language/PureScript/Sugar/BindingGroups.hs b/src/Language/PureScript/Sugar/BindingGroups.hs
index cf44f3b..38841aa 100644
--- a/src/Language/PureScript/Sugar/BindingGroups.hs
+++ b/src/Language/PureScript/Sugar/BindingGroups.hs
@@ -52,12 +52,12 @@ createBindingGroups :: ModuleName -> [Declaration] -> Either ErrorStack [Declara
createBindingGroups moduleName = mapM f <=< handleDecls
where
- (f, _, _) = everywhereOnValuesTopDownM return handleExprs return
-
+ (f, _, _) = everywhereOnValuesTopDownM return handleExprs return
+
handleExprs :: Expr -> Either ErrorStack Expr
handleExprs (Let ds val) = flip Let val <$> handleDecls ds
handleExprs other = return other
-
+
-- |
-- Replace all sets of mutually-recursive declarations with binding groups
--
diff --git a/src/Language/PureScript/Sugar/Names.hs b/src/Language/PureScript/Sugar/Names.hs
index 504bb2c..5f9733d 100644
--- a/src/Language/PureScript/Sugar/Names.hs
+++ b/src/Language/PureScript/Sugar/Names.hs
@@ -219,9 +219,12 @@ renameInModule imports exports (Module mn decls exps) =
updateValue :: (Maybe SourceSpan, [Ident]) -> Expr -> Either ErrorStack ((Maybe SourceSpan, [Ident]), Expr)
updateValue (_, bound) v@(PositionedValue pos' _ _) = return ((Just pos', bound), v)
updateValue (pos, bound) (Abs (Left arg) val') = return ((pos, arg : bound), Abs (Left arg) val')
- updateValue (pos, bound) (Let ds val') =
+ updateValue (pos, bound) (Let ds val') = do
let args = mapMaybe letBoundVariable ds
- in return ((pos, args ++ bound), Let ds val')
+ unless (length (nub args) == length args) $
+ throwError $ maybe id (\p e -> positionError p <> e) pos $ mkErrorStack ("Overlapping names in let binding.") Nothing
+ return ((pos, args ++ bound), Let ds val')
+ where
updateValue (pos, bound) (Var name'@(Qualified Nothing ident)) | ident `notElem` bound =
(,) (pos, bound) <$> (Var <$> updateValueName name' pos)
updateValue (pos, bound) (Var name'@(Qualified (Just _) _)) =
diff --git a/src/Language/PureScript/TypeChecker.hs b/src/Language/PureScript/TypeChecker.hs
index adcbb73..150df69 100644
--- a/src/Language/PureScript/TypeChecker.hs
+++ b/src/Language/PureScript/TypeChecker.hs
@@ -89,7 +89,7 @@ addTypeClass moduleName pn args implies ds =
addTypeClassDictionaries :: [TypeClassDictionaryInScope] -> Check ()
addTypeClassDictionaries entries =
- let mentries = M.fromList [ ((canonicalizeDictionary entry, mn), entry) | entry@TypeClassDictionaryInScope{ tcdName = Qualified mn _ } <- entries ]
+ let mentries = M.fromList [ ((canonicalizeDictionary entry, mn), entry) | entry@TypeClassDictionaryInScope{ tcdName = Qualified mn _ } <- entries ]
in modify $ \st -> st { checkEnv = (checkEnv st) { typeClassDictionaries = (typeClassDictionaries . checkEnv $ st) `M.union` mentries } }
checkDuplicateTypeArguments :: [String] -> Check ()
diff --git a/src/Language/PureScript/TypeChecker/Types.hs b/src/Language/PureScript/TypeChecker/Types.hs
index 0c53c71..22476d5 100644
--- a/src/Language/PureScript/TypeChecker/Types.hs
+++ b/src/Language/PureScript/TypeChecker/Types.hs
@@ -52,6 +52,7 @@ import Language.PureScript.Errors
import Language.PureScript.Kinds
import Language.PureScript.Names
import Language.PureScript.Pretty
+import Language.PureScript.Traversals
import Language.PureScript.TypeChecker.Entailment
import Language.PureScript.TypeChecker.Kinds
import Language.PureScript.TypeChecker.Monad
@@ -271,8 +272,8 @@ infer' v@(Constructor c) = do
env <- getEnv
case M.lookup c (dataConstructors env) of
Nothing -> throwError . strMsg $ "Constructor " ++ show c ++ " is undefined"
- Just (_, _, ty) -> do ty' <- introduceSkolemScope <=< replaceAllTypeSynonyms $ ty
- return $ TypedValue True v ty'
+ Just (_, _, ty) -> do (v', ty') <- sndM (introduceSkolemScope <=< replaceAllTypeSynonyms) <=< instantiatePolyTypeWithUnknowns v $ ty
+ return $ TypedValue True v' ty'
infer' (Case vals binders) = do
ts <- mapM infer vals
ret <- fresh
@@ -565,7 +566,7 @@ check' val kt@(KindedType ty kind) = do
val' <- check' val ty
return $ TypedValue True val' kt
check' (PositionedValue pos _ val) ty =
- rethrowWithPosition pos $ check val ty
+ rethrowWithPosition pos $ check' val ty
check' val ty = throwError $ mkErrorStack ("Expr does not have type " ++ prettyPrintType ty) (Just (ExprError val))
containsTypeSynonyms :: Type -> Bool
@@ -581,18 +582,14 @@ containsTypeSynonyms = everythingOnTypes (||) go where
checkProperties :: [(String, Expr)] -> Type -> Bool -> UnifyT Type Check [(String, Expr)]
checkProperties ps row lax = let (ts, r') = rowToList row in go ps ts r' where
go [] [] REmpty = return []
- go [] [] u@(TUnknown _) = do u =?= REmpty
- return []
+ go [] [] u@(TUnknown _)
+ | lax = return []
+ | otherwise = do u =?= REmpty
+ return []
go [] [] Skolem{} | lax = return []
go [] ((p, _): _) _ | lax = return []
| otherwise = throwError $ mkErrorStack ("Object does not have property " ++ p) (Just (ExprError (ObjectLiteral ps)))
go ((p,_):_) [] REmpty = throwError $ mkErrorStack ("Property " ++ p ++ " is not present in closed object type " ++ prettyPrintRow row) (Just (ExprError (ObjectLiteral ps)))
- go ((p,v):ps') [] u@(TUnknown _) = do
- v'@(TypedValue _ _ ty) <- infer v
- rest <- fresh
- u =?= RCons p ty rest
- ps'' <- go ps' [] rest
- return $ (p, v') : ps''
go ((p,v):ps') ts r =
case lookup p ts of
Nothing -> do
diff --git a/src/Language/PureScript/TypeChecker/Unify.hs b/src/Language/PureScript/TypeChecker/Unify.hs
index 23e9f93..0d919c9 100644
--- a/src/Language/PureScript/TypeChecker/Unify.hs
+++ b/src/Language/PureScript/TypeChecker/Unify.hs
@@ -158,7 +158,7 @@ replaceVarWithUnknown :: String -> Type -> UnifyT Type Check Type
replaceVarWithUnknown ident ty = do
tu <- fresh
return $ replaceTypeVars ident tu ty
-
+
-- |
-- Replace type wildcards with unknowns
--
diff --git a/tests/Main.hs b/tests/Main.hs
index d1b1397..bfc9930 100644
--- a/tests/Main.hs
+++ b/tests/Main.hs
@@ -35,7 +35,7 @@ readInput inputFiles = forM inputFiles $ \inputFile -> do
return (inputFile, text)
loadPrelude :: Either String (String, String, P.Environment)
-loadPrelude =
+loadPrelude =
case P.parseModulesFromFiles id [("", P.prelude)] of
Left parseError -> Left (show parseError)
Right ms -> P.compile (P.defaultCompileOptions { P.optionsAdditional = P.CompileOptions "Tests" [] [] }) (map snd ms) []
@@ -85,7 +85,7 @@ findNodeProcess = runMaybeT . msum $ map (MaybeT . findExecutable) names
main :: IO ()
main = do
- putStrLn "Compiling Prelude"
+ putStrLn "Compiling Prelude"
case loadPrelude of
Left err -> putStrLn err >> exitFailure
Right (preludeJs, exts, _) -> do