git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Merge pull request #829 from davidchambers/whitespace
783802dPhil Freeman
LICENSE+35−35
@@ -41,43 +41,43 @@ PureScript uses the following Haskell library packages. Their license files foll
41base LICENSE file:
41base LICENSE file:
42
42
43 This library (libraries/base) is derived from code from several
43 This library (libraries/base) is derived from code from several
44− sources:
44+ sources:
45−
45+
46 * Code from the GHC project which is largely (c) The University of
46 * Code from the GHC project which is largely (c) The University of
47 Glasgow, and distributable under a BSD-style license (see below),
47 Glasgow, and distributable under a BSD-style license (see below),
48−
48+
49 * Code from the Haskell 98 Report which is (c) Simon Peyton Jones
49 * Code from the Haskell 98 Report which is (c) Simon Peyton Jones
50 and freely redistributable (but see the full license for
50 and freely redistributable (but see the full license for
51 restrictions).
51 restrictions).
52−
52+
53 * Code from the Haskell Foreign Function Interface specification,
53 * Code from the Haskell Foreign Function Interface specification,
54 which is (c) Manuel M. T. Chakravarty and freely redistributable
54 which is (c) Manuel M. T. Chakravarty and freely redistributable
55 (but see the full license for restrictions).
55 (but see the full license for restrictions).
56−
56+
57 The full text of these licenses is reproduced below. All of the
57 The full text of these licenses is reproduced below. All of the
58 licenses are BSD-style or compatible.
58 licenses are BSD-style or compatible.
59−
59+
60 -----------------------------------------------------------------------------
60 -----------------------------------------------------------------------------
61−
61+
62 The Glasgow Haskell Compiler License
62 The Glasgow Haskell Compiler License
63−
63+
64− Copyright 2004, The University Court of the University of Glasgow.
64+ Copyright 2004, The University Court of the University of Glasgow.
65 All rights reserved.
65 All rights reserved.
66−
66+
67 Redistribution and use in source and binary forms, with or without
67 Redistribution and use in source and binary forms, with or without
68 modification, are permitted provided that the following conditions are met:
68 modification, are permitted provided that the following conditions are met:
69−
69+
70 - Redistributions of source code must retain the above copyright notice,
70 - Redistributions of source code must retain the above copyright notice,
71 this list of conditions and the following disclaimer.
71 this list of conditions and the following disclaimer.
72−
72+
73 - Redistributions in binary form must reproduce the above copyright notice,
73 - Redistributions in binary form must reproduce the above copyright notice,
74 this list of conditions and the following disclaimer in the documentation
74 this list of conditions and the following disclaimer in the documentation
75 and/or other materials provided with the distribution.
75 and/or other materials provided with the distribution.
76−
76+
77 - Neither name of the University nor the names of its contributors may be
77 - Neither name of the University nor the names of its contributors may be
78 used to endorse or promote products derived from this software without
78 used to endorse or promote products derived from this software without
79− specific prior written permission.
79+ specific prior written permission.
80−
80+
81 THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
81 THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
82 GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
82 GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
83 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
83 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
@@ -90,14 +90,14 @@ base LICENSE file:
90 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
90 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
91 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
91 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
92 DAMAGE.
92 DAMAGE.
93−
93+
94 -----------------------------------------------------------------------------
94 -----------------------------------------------------------------------------
95−
95+
96 Code derived from the document "Report on the Programming Language
96 Code derived from the document "Report on the Programming Language
97 Haskell 98", is distributed under the following license:
97 Haskell 98", is distributed under the following license:
98−
98+
99 Copyright (c) 2002 Simon Peyton Jones
99 Copyright (c) 2002 Simon Peyton Jones
100−
100+
101 The authors intend this Report to belong to the entire Haskell
101 The authors intend this Report to belong to the entire Haskell
102 community, and so we grant permission to copy and distribute it for
102 community, and so we grant permission to copy and distribute it for
103 any purpose, provided that it is reproduced in its entirety,
103 any purpose, provided that it is reproduced in its entirety,
@@ -105,15 +105,15 @@ base LICENSE file:
105 copied and distributed for any purpose, provided that the modified
105 copied and distributed for any purpose, provided that the modified
106 version is clearly presented as such, and that it does not claim to
106 version is clearly presented as such, and that it does not claim to
107 be a definition of the Haskell 98 Language.
107 be a definition of the Haskell 98 Language.
108−
108+
109 -----------------------------------------------------------------------------
109 -----------------------------------------------------------------------------
110−
110+
111 Code derived from the document "The Haskell 98 Foreign Function
111 Code derived from the document "The Haskell 98 Foreign Function
112 Interface, An Addendum to the Haskell 98 Report" is distributed under
112 Interface, An Addendum to the Haskell 98 Report" is distributed under
113 the following license:
113 the following license:
114−
114+
115 Copyright (c) 2002 Manuel M. T. Chakravarty
115 Copyright (c) 2002 Manuel M. T. Chakravarty
116−
116+
117 The authors intend this Report to belong to the entire Haskell
117 The authors intend this Report to belong to the entire Haskell
118 community, and so we grant permission to copy and distribute it for
118 community, and so we grant permission to copy and distribute it for
119 any purpose, provided that it is reproduced in its entirety,
119 any purpose, provided that it is reproduced in its entirety,
@@ -121,9 +121,9 @@ base LICENSE file:
121 copied and distributed for any purpose, provided that the modified
121 copied and distributed for any purpose, provided that the modified
122 version is clearly presented as such, and that it does not claim to
122 version is clearly presented as such, and that it does not claim to
123 be a definition of the Haskell 98 Foreign Function Interface.
123 be a definition of the Haskell 98 Foreign Function Interface.
124−
124+
125 -----------------------------------------------------------------------------
125 -----------------------------------------------------------------------------
126−
126+
127containers LICENSE file:
127containers LICENSE file:
128
128
129 The Glasgow Haskell Compiler License
129 The Glasgow Haskell Compiler License
@@ -161,7 +161,7 @@ containers LICENSE file:
161directory LICENSE file:
161directory LICENSE file:
162
162
163 This library (libraries/base) is derived from code from two
163 This library (libraries/base) is derived from code from two
164− sources:
164+ sources:
165
165
166 * Code from the GHC project which is largely (c) The University of
166 * Code from the GHC project which is largely (c) The University of
167 Glasgow, and distributable under a BSD-style license (see below),
167 Glasgow, and distributable under a BSD-style license (see below),
@@ -177,7 +177,7 @@ directory LICENSE file:
177
177
178 The Glasgow Haskell Compiler License
178 The Glasgow Haskell Compiler License
179
179
180− Copyright 2004, The University Court of the University of Glasgow.
180+ Copyright 2004, The University Court of the University of Glasgow.
181 All rights reserved.
181 All rights reserved.
182
182
183 Redistribution and use in source and binary forms, with or without
183 Redistribution and use in source and binary forms, with or without
@@ -185,14 +185,14 @@ directory LICENSE file:
185
185
186 - Redistributions of source code must retain the above copyright notice,
186 - Redistributions of source code must retain the above copyright notice,
187 this list of conditions and the following disclaimer.
187 this list of conditions and the following disclaimer.
188−
188+
189 - Redistributions in binary form must reproduce the above copyright notice,
189 - Redistributions in binary form must reproduce the above copyright notice,
190 this list of conditions and the following disclaimer in the documentation
190 this list of conditions and the following disclaimer in the documentation
191 and/or other materials provided with the distribution.
191 and/or other materials provided with the distribution.
192−
192+
193 - Neither name of the University nor the names of its contributors may be
193 - Neither name of the University nor the names of its contributors may be
194 used to endorse or promote products derived from this software without
194 used to endorse or promote products derived from this software without
195− specific prior written permission.
195+ specific prior written permission.
196
196
197 THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
197 THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
198 GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
198 GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
@@ -451,7 +451,7 @@ pattern-arrows LICENSE file:
451process LICENSE file:
451process LICENSE file:
452
452
453 This library (libraries/process) is derived from code from two
453 This library (libraries/process) is derived from code from two
454− sources:
454+ sources:
455
455
456 * Code from the GHC project which is largely (c) The University of
456 * Code from the GHC project which is largely (c) The University of
457 Glasgow, and distributable under a BSD-style license (see below),
457 Glasgow, and distributable under a BSD-style license (see below),
@@ -467,7 +467,7 @@ process LICENSE file:
467
467
468 The Glasgow Haskell Compiler License
468 The Glasgow Haskell Compiler License
469
469
470− Copyright 2004, The University Court of the University of Glasgow.
470+ Copyright 2004, The University Court of the University of Glasgow.
471 All rights reserved.
471 All rights reserved.
472
472
473 Redistribution and use in source and binary forms, with or without
473 Redistribution and use in source and binary forms, with or without
@@ -475,14 +475,14 @@ process LICENSE file:
475
475
476 - Redistributions of source code must retain the above copyright notice,
476 - Redistributions of source code must retain the above copyright notice,
477 this list of conditions and the following disclaimer.
477 this list of conditions and the following disclaimer.
478−
478+
479 - Redistributions in binary form must reproduce the above copyright notice,
479 - Redistributions in binary form must reproduce the above copyright notice,
480 this list of conditions and the following disclaimer in the documentation
480 this list of conditions and the following disclaimer in the documentation
481 and/or other materials provided with the distribution.
481 and/or other materials provided with the distribution.
482−
482+
483 - Neither name of the University nor the names of its contributors may be
483 - Neither name of the University nor the names of its contributors may be
484 used to endorse or promote products derived from this software without
484 used to endorse or promote products derived from this software without
485− specific prior written permission.
485+ specific prior written permission.
486
486
487 THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
487 THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
488 GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
488 GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
RELEASE-0.2.md+13−13
@@ -10,31 +10,31 @@ Many thanks to the [contributors](https://github.com/purescript/purescript/graph
10- RankNTypes
10- RankNTypes
11
11
12 This experimental feature allows polymorphic types (introduced with `forall`) to appear on the left of a function arrow, or as the type of a record field, etc. For example:
12 This experimental feature allows polymorphic types (introduced with `forall`) to appear on the left of a function arrow, or as the type of a record field, etc. For example:
13−
13+
14 rank2 :: (forall a. a -> a) -> Number
14 rank2 :: (forall a. a -> a) -> Number
15 rank2 = \f -> if f true then f 1 else f 2
15 rank2 = \f -> if f true then f 1 else f 2
16−
16+
17- Modules
17- Modules
18- Polymorphic Object Update
18- Polymorphic Object Update
19
19
20 Records now support member update in which the type of the field changes during the update. For example:
20 Records now support member update in which the type of the field changes during the update. For example:
21
21
22 data Wrap a = Wrap a
22 data Wrap a = Wrap a
23−
23+
24 update = \o -> o { prop = Wrap o.prop }
24 update = \o -> o { prop = Wrap o.prop }
25
25
26### Enhancements
26### Enhancements
27
27
28- Naked expressions as statements
28- Naked expressions as statements
29−
29+
30 Naked expressions of type `{}` can now be used as statements.
30 Naked expressions of type `{}` can now be used as statements.
31
31
32- Split code generation into `AST -> JS` and `JS -> String`
32- Split code generation into `AST -> JS` and `JS -> String`
33−
33+
34 JavaScript generation is now split into the generation of a JavaScript AST, and the pretty-printing of that AST. This enables some optimizations, and a better JavaScript pretty-printer.
34 JavaScript generation is now split into the generation of a JavaScript AST, and the pretty-printing of that AST. This enables some optimizations, and a better JavaScript pretty-printer.
35−
35+
36- Syntactic sugar for introducing curried functions
36- Syntactic sugar for introducing curried functions
37−
37+
38 Single-argument functions and multiple-argument functions can now be introduced in the same way:
38 Single-argument functions and multiple-argument functions can now be introduced in the same way:
39
39
40 test = \a (b, c) d -> a + b + c + d
40 test = \a (b, c) d -> a + b + c + d
@@ -42,32 +42,32 @@ Many thanks to the [contributors](https://github.com/purescript/purescript/graph
42- JavaScript optimizations
42- JavaScript optimizations
43
43
44 Some basic dead-variable elimination, inlining and eta-conversion are now performed on the generated JavaScript.
44 Some basic dead-variable elimination, inlining and eta-conversion are now performed on the generated JavaScript.
45−
45+
46- Generate formatted Javascript
46- Generate formatted Javascript
47
47
48 The generated JavaScript is now formatted to be more readable. In particular, newlines get generated, and the correct indentation is used.
48 The generated JavaScript is now formatted to be more readable. In particular, newlines get generated, and the correct indentation is used.
49
49
50- More valid infix operators
50- More valid infix operators
51−
51+
52 The colon and period characters are now valid in infix operator names.
52 The colon and period characters are now valid in infix operator names.
53
53
54### Syntax Changes
54### Syntax Changes
55
55
56- Avoid 'do' keyword for blocks
56- Avoid 'do' keyword for blocks
57−
57+
58 `do` will be used later for Haskell-like monad comprehensions, so its previous use in introducing blocks of statements is now invalid. The `do` keyword is still reserved.
58 `do` will be used later for Haskell-like monad comprehensions, so its previous use in introducing blocks of statements is now invalid. The `do` keyword is still reserved.
59
59
60- Member foreign import syntax
60- Member foreign import syntax
61
61
62− A small syntactic addition to the FFI, to support a common use case.
62+ A small syntactic addition to the FFI, to support a common use case.
63
63
64- Make FFI syntax match Haskell
64- Make FFI syntax match Haskell
65−
65+
66 Use `foreign import` instead of `extern`.
66 Use `foreign import` instead of `extern`.
67
67
68- Make record declaration syntax match Haskell
68- Make record declaration syntax match Haskell
69- Simplify array binders
69- Simplify array binders
70−
70+
71 There are now two types of array binders: cons binders `x : xs -> ...` and array binders `[x, y, z] -> ...` instead of the previously confusing `[x:xs]`.
71 There are now two types of array binders: cons binders `x : xs -> ...` and array binders `[x, y, z] -> ...` instead of the previously confusing `[x:xs]`.
72
72
73- Array indexing syntax is ambiguous
73- Array indexing syntax is ambiguous
RELEASE-0.3.md+8−8
@@ -14,40 +14,40 @@ Many thanks to the [contributors](https://github.com/purescript/purescript/graph
14 sum (x:xs) = x + sum xs
14 sum (x:xs) = x + sum xs
15
15
16- Basic support for type classes has been added. Polymorphic types of the form `forall a. (C a) => ...` will not be inferred but can be checked. Type inference still works if all type class instances can be determined. There is not yet support for functionality like GHC's `FlexibleInstances`, `FlexibleContexts` or `MultiParamTypesClasses`. For example:
16- Basic support for type classes has been added. Polymorphic types of the form `forall a. (C a) => ...` will not be inferred but can be checked. Type inference still works if all type class instances can be determined. There is not yet support for functionality like GHC's `FlexibleInstances`, `FlexibleContexts` or `MultiParamTypesClasses`. For example:
17−
17+
18 class Truthy a where
18 class Truthy a where
19 isTrue :: a -> Boolean
19 isTrue :: a -> Boolean
20−
20+
21 instance Truthy Boolean where
21 instance Truthy Boolean where
22 isTrue b = b
22 isTrue b = b
23−
23+
24 instance Truthy String where
24 instance Truthy String where
25 isTrue "" = false
25 isTrue "" = false
26 isTrue _ = true
26 isTrue _ = true
27−
27+
28 ifThenElse :: forall a b. (Truthy a) => a -> b -> b -> b
28 ifThenElse :: forall a b. (Truthy a) => a -> b -> b -> b
29 ifThenElse a tr fa = if isTrue a then tr else fa
29 ifThenElse a tr fa = if isTrue a then tr else fa
30
30
31- There is now support for `do` notation, using the `Monad` type class from the `Prelude` module. For example:
31- There is now support for `do` notation, using the `Monad` type class from the `Prelude` module. For example:
32
32
33 data Maybe = Nothing | Just a
33 data Maybe = Nothing | Just a
34−
34+
35 instance Prelude.Monad Maybe where
35 instance Prelude.Monad Maybe where
36 ret = Just
36 ret = Just
37 (>>=) Nothing _ = Nothing
37 (>>=) Nothing _ = Nothing
38 (>>=) (Just a) f = f a
38 (>>=) (Just a) f = f a
39−
39+
40 test = do
40 test = do
41 x <- Just 1
41 x <- Just 1
42 y <- Just 2
42 y <- Just 2
43 ret $ x + y
43 ret $ x + y
44−
44+
45- There is now a better story for side-effects. The `Eff` module in the `Prelude` defines a monad `Eff e` where e is a row of effect types. The kind system now defines a new kind `!` of effects. Row polymorphism allows different native effects to be interleaved. For example:
45- There is now a better story for side-effects. The `Eff` module in the `Prelude` defines a monad `Eff e` where e is a row of effect types. The kind system now defines a new kind `!` of effects. Row polymorphism allows different native effects to be interleaved. For example:
46
46
47 test = do
47 test = do
48 trace "Testing"
48 trace "Testing"
49 throwError "Error!"
49 throwError "Error!"
50−
50+
51 has inferred type `forall eff. Eff (trace :: Trace | error :: Error String | eff)`.
51 has inferred type `forall eff. Eff (trace :: Trace | error :: Error String | eff)`.
52 See the `/examples/passing/Eff.purs` file for a more in-depth set of examples.
52 See the `/examples/passing/Eff.purs` file for a more in-depth set of examples.
53 Supported native effects currently include `ST`, `Trace`, `Error` and `DOM` (via the `libraries/jquery` module).
53 Supported native effects currently include `ST`, `Trace`, `Error` and `DOM` (via the `libraries/jquery` module).
RELEASE-0.4.md+8−8
@@ -8,17 +8,17 @@ This release saw major contributions from [a number of new contributors](https:/
8- Try out the latest features [here](http://tryps.functorial.com).
8- Try out the latest features [here](http://tryps.functorial.com).
9
9
10## Breaking Changes
10## Breaking Changes
11−
11+
12- Multiple argument functions are no longer available.
12- Multiple argument functions are no longer available.
13- When used in the browser, PureScript modules are now accessed through `window.PS.<ModuleName>`. The `PS` object name can be changed via the `--browser-namespace` compiler argument.
13- When used in the browser, PureScript modules are now accessed through `window.PS.<ModuleName>`. The `PS` object name can be changed via the `--browser-namespace` compiler argument.
14- The `--run-main` argument has been replaced with `--main` which can now accept a module name in which to find the `main` function.
14- The `--run-main` argument has been replaced with `--main` which can now accept a module name in which to find the `main` function.
15−
15+
16### New Features
16### New Features
17−
17+
18- Dead code elimination. The new compiler argument `--module=` can be used to specify one or more modules that should be kept in the generated code along with their dependencies. If no modules are specified, all code is exported.
18- Dead code elimination. The new compiler argument `--module=` can be used to specify one or more modules that should be kept in the generated code along with their dependencies. If no modules are specified, all code is exported.
19−
19+
20### Enhancements
20### Enhancements
21−
21+
22- The `->` and `[]` types are now usable in type class instances.
22- The `->` and `[]` types are now usable in type class instances.
23- The file path is included in syntax error messages.
23- The file path is included in syntax error messages.
24- Most reserved Javascript names (`return`, `const`, etc) are now usable.
24- Most reserved Javascript names (`return`, `const`, etc) are now usable.
@@ -28,9 +28,9 @@ This release saw major contributions from [a number of new contributors](https:/
28- It is no longer necessary to sort modules in order of dependencies manually.
28- It is no longer necessary to sort modules in order of dependencies manually.
29- Case statements matching data constructors no longer generate unnecessary constructor checks at runtime if there is only a single data constructor.
29- Case statements matching data constructors no longer generate unnecessary constructor checks at runtime if there is only a single data constructor.
30- New optimizer rules were added to inline JavaScript's built-in operators.
30- New optimizer rules were added to inline JavaScript's built-in operators.
31−
31+
32### Bug Fixes
32### Bug Fixes
33−
33+
34- Floats parse correctly.
34- Floats parse correctly.
35- Using data constructors in pattern matches now works properly across modules.
35- Using data constructors in pattern matches now works properly across modules.
36- PureScript modules no longer overwrite global objects with the same name.
36- PureScript modules no longer overwrite global objects with the same name.
@@ -43,7 +43,7 @@ This release saw major contributions from [a number of new contributors](https:/
43- A bug which allowed skolem variables to escape their scope was add (thanks to Brian McKenna).
43- A bug which allowed skolem variables to escape their scope was add (thanks to Brian McKenna).
44- Modules containing mutually recursive type synonyms and data declarations now compile correctly.
44- Modules containing mutually recursive type synonyms and data declarations now compile correctly.
45- A number of bugs in the optimizer were addressed.
45- A number of bugs in the optimizer were addressed.
46−
46+
47### Libraries
47### Libraries
48
48
49- The `Prelude` has been greatly expanded. Definitions for built-in JavaScript operators have been moved into the Prelude.
49- The `Prelude` has been greatly expanded. Definitions for built-in JavaScript operators have been moved into the Prelude.
RELEASE-0.5.md+3−3
@@ -54,7 +54,7 @@
54- The escape check was removed, since it was too restrictive (paf31)
54- The escape check was removed, since it was too restrictive (paf31)
55- The binary operator reordering step was greatly simplified (paf31)
55- The binary operator reordering step was greatly simplified (paf31)
56- The Object type constructor can now be referenced explicitly as `Prim.Object` (with kind `# * -> *`) (paf31)
56- The Object type constructor can now be referenced explicitly as `Prim.Object` (with kind `# * -> *`) (paf31)
57−- Optimizations are now enabled by default and can be disabled with the `--no-tco` and `--no-magic-do` flags (garyb)
57+- Optimizations are now enabled by default and can be disabled with the `--no-tco` and `--no-magic-do` flags (garyb)
58- Unary minus and signed numeric literals are now supported again (paf31, garyb)
58- Unary minus and signed numeric literals are now supported again (paf31, garyb)
59- Type errors have been simplified, the full trace can be enabled with `--verbose-errors` or `-v` (paf31)
59- Type errors have been simplified, the full trace can be enabled with `--verbose-errors` or `-v` (paf31)
60- Error messages now display source positions (paf31, garyb)
60- Error messages now display source positions (paf31, garyb)
@@ -63,7 +63,7 @@
63- `(++)` is now an alias for the Semigroup operator `(<>)` (paf31)
63- `(++)` is now an alias for the Semigroup operator `(<>)` (paf31)
64- Error messages for classes with undefined or missing members have been improved (garyb)
64- Error messages for classes with undefined or missing members have been improved (garyb)
65- The SYB dependency was removed, and traversals rewritten by hand, for a large performance increase (paf31)
65- The SYB dependency was removed, and traversals rewritten by hand, for a large performance increase (paf31)
66−
66+
67### Bug Fixes
67### Bug Fixes
68
68
69- The subsumes relation has been fixed for object types (paf31)
69- The subsumes relation has been fixed for object types (paf31)
@@ -94,6 +94,6 @@
94- The `grunt-purescript` plugin has been updated to provide support for new command line options.
94- The `grunt-purescript` plugin has been updated to provide support for new command line options.
95- There is a new `gulp-purescript` plugin available for compiling with Gulp.
95- There is a new `gulp-purescript` plugin available for compiling with Gulp.
96
96
97−### Documentation
97+### Documentation
98
98
99- There is a new `hierarchy` executable which will generate `.dot` diagrams based on the type class hierarchy of a module. The Prelude docs have been updated to include such a type class diagram. (joneshf)
99- There is a new `hierarchy` executable which will generate `.dot` diagrams based on the type class hierarchy of a module. The Prelude docs have been updated to include such a type class diagram. (joneshf)
RELEASE-0.7.md+6−6
@@ -12,7 +12,7 @@ positive _ = false
12but this is not:
12but this is not:
13
13
14```haskell
14```haskell
15−positive n | n > 0
15+positive n | n > 0
16 = true
16 = true
17positive _ = false
17positive _ = false
18```
18```
@@ -32,20 +32,20 @@ positive _ = false
32
32
33### Breaking Changes
33### Breaking Changes
34
34
35−-
35+-
36
36
37### New Features
37### New Features
38
38
39−-
39+-
40
40
41### Enhancements
41### Enhancements
42
42
43−-
43+-
44
44
45### Libraries
45### Libraries
46
46
47−-
47+-
48
48
49### Documentation
49### Documentation
50
50
51−-
51+-
bundle/README+4−4
@@ -1,9 +1,9 @@
1− ____ ____ _ _
1+ ____ ____ _ _
2−| _ \ _ _ _ __ ___/ ___| ___ _ __(_)_ __ | |_
2+| _ \ _ _ _ __ ___/ ___| ___ _ __(_)_ __ | |_
3| |_) | | | | '__/ _ \___ \ / __| '__| | '_ \| __|
3| |_) | | | | '__/ _ \___ \ / __| '__| | '_ \| __|
4−| __/| |_| | | | __/___) | (__| | | | |_) | |_
4+| __/| |_| | | | __/___) | (__| | | | |_) | |_
5|_| \__,_|_| \___|____/ \___|_| |_| .__/ \__|
5|_| \__,_|_| \___|____/ \___|_| |_| .__/ \__|
6− |_|
6+ |_|
7
7
8Installation Instructions
8Installation Instructions
9-------------------------
9-------------------------
bundle/build.sh+1−1
@@ -4,7 +4,7 @@ SCRIPTPATH=$( cd "$(dirname "$0")" ; pwd -P )
4
4
5OS=$1
5OS=$1
6
6
7−if [ -z $OS ]
7+if [ -z $OS ]
8then
8then
9 echo "Usage: build.sh osname"
9 echo "Usage: build.sh osname"
10 exit 1
10 exit 1
bundle/winbuild.sh+3−3
@@ -26,9 +26,9 @@ cp README build/purescript/
26cp ../LICENSE build/purescript/
26cp ../LICENSE build/purescript/
27
27
28# Make the binary bundle
28# Make the binary bundle
29−pushd build
29+pushd build
30tar -zcvf ../win64.tar.gz purescript
30tar -zcvf ../win64.tar.gz purescript
31−popd
31+popd
32
32
33# Calculate the MD5 hash
33# Calculate the MD5 hash
34md5sum win64.tar.gz > win64.md5
34md5sum win64.tar.gz > win64.md5
@@ -36,5 +36,5 @@ md5sum win64.tar.gz > win64.md5
36# Remove the staging directory
36# Remove the staging directory
37rm -rf build/
37rm -rf build/
38
38
39−popd
39+popd
40
40
examples/failing/NewtypeMultiArgs.purs+1−1
@@ -1,3 +1,3 @@
1module Main where
1module Main where
2
2
3−newtype Thing = Thing String Boolean
3+newtype Thing = Thing String Boolean
examples/failing/NewtypeMultiCtor.purs+1−1
@@ -1,3 +1,3 @@
1module Main where
1module Main where
2
2
3−newtype Thing = Thing String | Other
3+newtype Thing = Thing String | Other
examples/failing/SkolemEscape2.purs+1−1
@@ -6,4 +6,4 @@ import Control.Monad.ST
6
6
7test _ = do
7test _ = do
8 r <- runST (newSTRef 0)
8 r <- runST (newSTRef 0)
9− return 0
9+ return 0
examples/failing/UnknownType.purs+1−1
@@ -1,4 +1,4 @@
1module Main where
1module Main where
2
2
3test :: Number -> Something
3test :: Number -> Something
4−test = {}
4+test = {}
examples/manual/failing/ArgLengthMismatch.purs+1−1
@@ -1,4 +1,4 @@
1module ArgLengthMismatch where
1module ArgLengthMismatch where
2
2
3 f x y = true
3 f x y = true
4− f = false
4+ f = false
examples/manual/failing/ExportExplicit.purs+1−1
@@ -2,4 +2,4 @@
2module M1 (x, y, z) where
2module M1 (x, y, z) where
3
3
4 x = 1
4 x = 1
5− y = 2
5+ y = 2
examples/manual/failing/ExportExplicit1.purs+2−2
@@ -5,9 +5,9 @@ module M1 (X(X)) where
5module Main where
5module Main where
6
6
7 import M1
7 import M1
8−
8+
9 testX = X
9 testX = X
10−
10+
11 -- should fail as Y constructor is not exported from M1
11 -- should fail as Y constructor is not exported from M1
12 testY = Y
12 testY = Y
13
13
examples/manual/failing/ExportExplicit2.purs+1−1
@@ -2,4 +2,4 @@
2module M1 (X(Y)) where
2module M1 (X(Y)) where
3
3
4 data X = X
4 data X = X
5− data Y = Y
5+ data Y = Y
examples/manual/failing/ExportExplicit3.purs+1−1
@@ -6,7 +6,7 @@ module M1 (X(..)) where
6module Main where
6module Main where
7
7
8 import M1
8 import M1
9−
9+
10 -- should fail as Z is not exported from M1
10 -- should fail as Z is not exported from M1
11 testZ = M1.Z
11 testZ = M1.Z
12
12
examples/manual/failing/RedefinedFixity.purs+1−1
@@ -1,6 +1,6 @@
1module RedefinedFixity where
1module RedefinedFixity where
2
2
3 (!?) x y = x + y
3 (!?) x y = x + y
4−
4+
5 infix 2 !?
5 infix 2 !?
6 infix 2 !?
6 infix 2 !?
examples/manual/failing/RequiredHiddenType.purs+2−2
@@ -3,6 +3,6 @@ module Foo (B(..), a, b) where
3
3
4 data A = A
4 data A = A
5 data B = B
5 data B = B
6−
6+
7 a = A
7 a = A
8− b = B
8+ b = B
examples/manual/passing/ExportExplicit.purs+2−2
@@ -3,7 +3,7 @@ module M1 (X(X), Z(..), foo) where
3 data X = X | Y
3 data X = X | Y
4 data Z = Z
4 data Z = Z
5
5
6− foo :: Number
6+ foo :: Number
7 foo = 0
7 foo = 0
8
8
9 bar :: Number
9 bar :: Number
@@ -12,7 +12,7 @@ module M1 (X(X), Z(..), foo) where
12module Main where
12module Main where
13
13
14 import M1
14 import M1
15−
15+
16 testX = X
16 testX = X
17 testZ = Z
17 testZ = Z
18 testFoo = foo
18 testFoo = foo
examples/manual/passing/ExportExplicit2.purs+1−1
@@ -1,6 +1,6 @@
1module M1 (bar) where
1module M1 (bar) where
2
2
3− foo :: Number
3+ foo :: Number
4 foo = 0
4 foo = 0
5
5
6 bar :: Number
6 bar :: Number
examples/manual/passing/Import.purs+1−1
@@ -13,7 +13,7 @@ module M2 where
13 import M1
13 import M1
14
14
15 main = \_ -> foo 42
15 main = \_ -> foo 42
16−
16+
17module Main where
17module Main where
18
18
19main = Debug.Trace.trace "Done"
19main = Debug.Trace.trace "Done"
examples/manual/passing/ImportExplicit.purs+1−1
@@ -7,7 +7,7 @@ module Main where
7
7
8 import M1 (X(..))
8 import M1 (X(..))
9
9
10− testX :: X
10+ testX :: X
11 testX = X
11 testX = X
12 testY = Y
12 testY = Y
13
13
examples/manual/passing/ImportQualified.purs+3−3
@@ -1,5 +1,5 @@
1module M1 where
1module M1 where
2−
2+
3 trace x = x
3 trace x = x
4
4
5module Main where
5module Main where
@@ -8,5 +8,5 @@ module Main where
8 import Control.Monad.Eff
8 import Control.Monad.Eff
9 import M1
9 import M1
10 import qualified Debug.Trace as T
10 import qualified Debug.Trace as T
11−
11+
12− main = T.trace (trace "Done")
12+ main = T.trace (trace "Done")
examples/manual/passing/Module.purs+1−1
@@ -22,7 +22,7 @@ module M2 where
22
22
23 match :: M1.Foo -> String
23 match :: M1.Foo -> String
24 match = \f -> case f of M1.Foo s -> s ++ "foo"
24 match = \f -> case f of M1.Foo s -> s ++ "foo"
25−
25+
26module Main where
26module Main where
27
27
28main = Debug.Trace.trace "Done"
28main = Debug.Trace.trace "Done"
examples/manual/passing/ModuleDeps.purs+1−1
@@ -11,7 +11,7 @@ bar = M3.baz
11module M3 where
11module M3 where
12
12
13baz = 1
13baz = 1
14−
14+
15module Main where
15module Main where
16
16
17main = Debug.Trace.trace "Done"
17main = Debug.Trace.trace "Done"
examples/passing/BindersInFunctions.purs+2−2
@@ -11,8 +11,8 @@ foreign import error
11 }
11 }
12 """ :: forall a. String -> a
12 """ :: forall a. String -> a
13
13
14−main =
14+main =
15 let ts = tail [1, 2, 3] in
15 let ts = tail [1, 2, 3] in
16− if ts == [2, 3]
16+ if ts == [2, 3]
17 then Debug.Trace.trace "Done"
17 then Debug.Trace.trace "Done"
18 else error "Incorrect result from 'tails'."
18 else error "Incorrect result from 'tails'."
examples/passing/BindingGroups.purs+2−2
@@ -1,6 +1,6 @@
1module Main where
1module Main where
2−
2+
3−foo = bar
3+foo = bar
4 where bar r = r + 1
4 where bar r = r + 1
5
5
6r = foo 2
6r = foo 2
examples/passing/CheckSynonymBug.purs+1−1
@@ -2,7 +2,7 @@ module Main where
2
2
3 import Prelude
3 import Prelude
4
4
5− type Foo a = [a]
5+ type Foo a = [a]
6
6
7 foreign import length
7 foreign import length
8 """
8 """
examples/passing/Conditional.purs+1−1
@@ -2,7 +2,7 @@ module Main where
2
2
3 import Prelude ()
3 import Prelude ()
4
4
5− fns = \f -> if f true then f else \x -> x
5+ fns = \f -> if f true then f else \x -> x
6
6
7 not = \x -> if x then false else true
7 not = \x -> if x then false else true
8
8
examples/passing/Console.purs+1−1
@@ -9,5 +9,5 @@ replicateM_ 0 _ = return {}
9replicateM_ n act = do
9replicateM_ n act = do
10 act
10 act
11 replicateM_ (n - 1) act
11 replicateM_ (n - 1) act
12−
12+
13main = replicateM_ 10 (trace "Hello World!")
13main = replicateM_ 10 (trace "Hello World!")
examples/passing/DeepArrayBinder.purs+1−1
@@ -6,7 +6,7 @@ match2 :: [Number] -> Number
6match2 (x : y : xs) = x * y + match2 xs
6match2 (x : y : xs) = x * y + match2 xs
7match2 _ = 0
7match2 _ = 0
8
8
9−foreign import explode
9+foreign import explode
10 """
10 """
11 function explode() {
11 function explode() {
12 throw new Error('Incorrect result');
12 throw new Error('Incorrect result');
examples/passing/DeepCase.purs+2−2
@@ -4,9 +4,9 @@ import Debug.Trace
4import Control.Monad.Eff
4import Control.Monad.Eff
5import Control.Monad.ST
5import Control.Monad.ST
6
6
7−f x y =
7+f x y =
8 let
8 let
9− g = case y of
9+ g = case y of
10 0 -> x
10 0 -> x
11 x -> 1 + x * x
11 x -> 1 + x * x
12 in g + x + y
12 in g + x + y
examples/passing/Dollar.purs+1−1
@@ -12,5 +12,5 @@ id x = x
12test1 x = id $ id $ id $ id $ x
12test1 x = id $ id $ id $ id $ x
13
13
14test2 x = id id $ id x
14test2 x = id id $ id x
15−
15+
16main = Debug.Trace.trace "Done"
16main = Debug.Trace.trace "Done"
examples/passing/EmptyRow.purs+1−1
@@ -1,6 +1,6 @@
1module Main where
1module Main where
2
2
3−data Foo r = Foo { | r }
3+data Foo r = Foo { | r }
4
4
5test :: Foo ()
5test :: Foo ()
6test = Foo {}
6test = Foo {}
examples/passing/FFI.purs+1−1
@@ -1,6 +1,6 @@
1module Main where
1module Main where
2
2
3−foreign import foo
3+foreign import foo
4 """
4 """
5 function foo(s) {
5 function foo(s) {
6 return s;
6 return s;
examples/passing/FinalTagless.purs+1−1
@@ -5,7 +5,7 @@ import Prelude
5class E e where
5class E e where
6 num :: Number -> e Number
6 num :: Number -> e Number
7 add :: e Number -> e Number -> e Number
7 add :: e Number -> e Number -> e Number
8−
8+
9type Expr a = forall e. (E e) => e a
9type Expr a = forall e. (E e) => e a
10
10
11data Id a = Id a
11data Id a = Id a
examples/passing/FunctionScope.purs+1−1
@@ -5,7 +5,7 @@ module Main where
5 mkValue :: Number -> Number
5 mkValue :: Number -> Number
6 mkValue id = id
6 mkValue id = id
7
7
8− foreign import error
8+ foreign import error
9 """
9 """
10 function error(msg) {
10 function error(msg) {
11 throw msg;
11 throw msg;
examples/passing/Guards.purs+2−2
@@ -21,9 +21,9 @@ module Main where
21 | otherwise -> m
21 | otherwise -> m
22
22
23 testIndentation :: Number -> Number -> Number
23 testIndentation :: Number -> Number -> Number
24− testIndentation x y | x > 0
24+ testIndentation x y | x > 0
25 = x + y
25 = x + y
26− | otherwise
26+ | otherwise
27 = y - x
27 = y - x
28
28
29 main = Debug.Trace.trace $ min "Done" "ZZZZ"
29 main = Debug.Trace.trace $ min "Done" "ZZZZ"
examples/passing/JSReserved.purs+2−2
@@ -4,9 +4,9 @@ module Main where
4
4
5 yield = 0
5 yield = 0
6 member = 1
6 member = 1
7−
7+
8 public = \return -> return
8 public = \return -> return
9−
9+
10 this catch = catch
10 this catch = catch
11
11
12 main = Debug.Trace.trace "Done"
12 main = Debug.Trace.trace "Done"
examples/passing/KindedType.purs+1−1
@@ -26,6 +26,6 @@ class Clazz (a :: *) where
26 def :: a
26 def :: a
27
27
28instance clazzString :: Clazz String where
28instance clazzString :: Clazz String where
29− def = "test"
29+ def = "test"
30
30
31main = Debug.Trace.trace "Done"
31main = Debug.Trace.trace "Done"
examples/passing/Let.purs+7−7
@@ -4,12 +4,12 @@ import Prelude
4import Control.Monad.Eff
4import Control.Monad.Eff
5import Control.Monad.ST
5import Control.Monad.ST
6
6
7−test1 x = let
7+test1 x = let
8 y :: Number
8 y :: Number
9− y = x + 1
9+ y = x + 1
10 in y
10 in y
11
11
12−test2 x y =
12+test2 x y =
13 let x' = x + 1 in
13 let x' = x + 1 in
14 let y' = y + 1 in
14 let y' = y + 1 in
15 x' + y'
15 x' + y'
@@ -17,10 +17,10 @@ test2 x y =
17test3 = let f x y z = x + y + z in
17test3 = let f x y z = x + y + z in
18 f 1 2 3
18 f 1 2 3
19
19
20−test4 = let f x [y, z] = x y z in
20+test4 = let f x [y, z] = x y z in
21 f (+) [1, 2]
21 f (+) [1, 2]
22
22
23−test5 = let
23+test5 = let
24 f x | x > 0 = g (x / 2) + 1
24 f x | x > 0 = g (x / 2) + 1
25 f x = 0
25 f x = 0
26 g x = f (x - 1) + 1
26 g x = f (x - 1) + 1
@@ -42,12 +42,12 @@ test7 = let
42 in if f true then f 1 else f 2
42 in if f true then f 1 else f 2
43
43
44test8 :: Number -> Number
44test8 :: Number -> Number
45−test8 x = let
45+test8 x = let
46 go y | (x - 0.1 < y * y) && (y * y < x + 0.1) = y
46 go y | (x - 0.1 < y * y) && (y * y < x + 0.1) = y
47 go y = go $ (y + x / y) / 2
47 go y = go $ (y + x / y) / 2
48 in go x
48 in go x
49
49
50−test10 _ =
50+test10 _ =
51 let
51 let
52 f x = g x * 3
52 f x = g x * 3
53 g x = f x / 2
53 g x = f x / 2
examples/passing/Monad.purs+2−2
@@ -17,12 +17,12 @@ module Main where
17 maybe = { return : Just
17 maybe = { return : Just
18 , bind : \ma f -> case ma of
18 , bind : \ma f -> case ma of
19 Nothing -> Nothing
19 Nothing -> Nothing
20− Just a -> f a
20+ Just a -> f a
21 }
21 }
22
22
23 test :: forall m. Monad m -> m Number
23 test :: forall m. Monad m -> m Number
24 test = \m -> m.bind (m.return 1) (\n1 ->
24 test = \m -> m.bind (m.return 1) (\n1 ->
25− m.bind (m.return "Test") (\n2 ->
25+ m.bind (m.return "Test") (\n2 ->
26 m.return n1))
26 m.return n1))
27
27
28 test1 = test id
28 test1 = test id
examples/passing/MutRec.purs+1−1
@@ -1,4 +1,4 @@
1−module Main where
1+module Main where
2
2
3 import Prelude
3 import Prelude
4
4
examples/passing/MutRec2.purs+1−1
@@ -1,7 +1,7 @@
1module Main where
1module Main where
2
2
3data A = A B
3data A = A B
4−
4+
5data B = B A
5data B = B A
6
6
7foreign import data S :: *
7foreign import data S :: *
examples/passing/MutRec3.purs+1−1
@@ -1,7 +1,7 @@
1module Main where
1module Main where
2
2
3data A = A B
3data A = A B
4−
4+
5data B = B A
5data B = B A
6
6
7foreign import data S :: *
7foreign import data S :: *
examples/passing/NamedPatterns.purs+1−1
@@ -1,6 +1,6 @@
1module Main where
1module Main where
2
2
3− foo = \x -> case x of
3+ foo = \x -> case x of
4 y@{ foo = "Foo" } -> y
4 y@{ foo = "Foo" } -> y
5 y -> y
5 y -> y
6
6
examples/passing/Newtype.purs+3−3
@@ -12,11 +12,11 @@ newtype Box a = Box a
12
12
13instance showBox :: (Show a) => Show (Box a) where
13instance showBox :: (Show a) => Show (Box a) where
14 show (Box x) = "Box " ++ show x
14 show (Box x) = "Box " ++ show x
15−
15+
16apply f x = f x
16apply f x = f x
17−
17+
18main = do
18main = do
19 print $ Thing "hello"
19 print $ Thing "hello"
20 print $ Box 42
20 print $ Box 42
21 print $ apply Box 9000
21 print $ apply Box 9000
22− trace "Done"
22+ trace "Done"
examples/passing/ObjectSynonym.purs+1−1
@@ -10,4 +10,4 @@ type Outer = { inner :: Inner }
10outer :: Outer
10outer :: Outer
11outer = { inner: inner }
11outer = { inner: inner }
12
12
13−main = Debug.Trace.trace "Done"
13+main = Debug.Trace.trace "Done"
examples/passing/ObjectUpdate2.purs+1−1
@@ -7,7 +7,7 @@ foreign import x "var x = {};" :: forall r. X r
7blah :: forall r. X r -> X r
7blah :: forall r. X r -> X r
8blah x = x
8blah x = x
9
9
10−test = blah x
10+test = blah x
11 { baz = "blah"
11 { baz = "blah"
12 }
12 }
13
13
examples/passing/Objects.purs+1−1
@@ -31,5 +31,5 @@ module Main where
31 { "***": n } -> n
31 { "***": n } -> n
32
32
33 test7 {a: snoog , b : blah } = blah
33 test7 {a: snoog , b : blah } = blah
34−
34+
35 main = Debug.Trace.trace "Done"
35 main = Debug.Trace.trace "Done"
examples/passing/Operators.purs+5−5
@@ -2,7 +2,7 @@ module Main where
2
2
3 import Control.Monad.Eff
3 import Control.Monad.Eff
4 import Debug.Trace
4 import Debug.Trace
5−
5+
6 (?!) :: forall a. a -> a -> a
6 (?!) :: forall a. a -> a -> a
7 (?!) x _ = x
7 (?!) x _ = x
8
8
@@ -29,7 +29,7 @@ module Main where
29
29
30 test6 = ((\x -> x) `k` 2) 3
30 test6 = ((\x -> x) `k` 2) 3
31
31
32− (<+>) :: String -> String -> String
32+ (<+>) :: String -> String -> String
33 (<+>) = \s1 s2 -> s1 ++ s2
33 (<+>) = \s1 s2 -> s1 ++ s2
34
34
35 test7 = "Hello" <+> "World!"
35 test7 = "Hello" <+> "World!"
@@ -39,7 +39,7 @@ module Main where
39
39
40 foo :: String -> String
40 foo :: String -> String
41 foo = \s -> s
41 foo = \s -> s
42−
42+
43 test8 = foo @@ "Hello World"
43 test8 = foo @@ "Hello World"
44
44
45 test9 = Main.foo @@ "Hello World"
45 test9 = Main.foo @@ "Hello World"
@@ -52,7 +52,7 @@ module Main where
52 test11 = [1, 2, 3] ... [4, 5, 6]
52 test11 = [1, 2, 3] ... [4, 5, 6]
53
53
54 test12 (<%>) a b = a <%> b
54 test12 (<%>) a b = a <%> b
55−
55+
56 test13 = \(<%>) a b -> a <%> b
56 test13 = \(<%>) a b -> a <%> b
57
57
58 test14 :: Number -> Number -> Boolean
58 test14 :: Number -> Number -> Boolean
@@ -61,7 +61,7 @@ module Main where
61 test15 :: Number -> Number -> Boolean
61 test15 :: Number -> Number -> Boolean
62 test15 a b = const false $ a `test14` b
62 test15 a b = const false $ a `test14` b
63
63
64− test16 :: Number -> Number -> Number
64+ test16 :: Number -> Number -> Number
65 test16 x y = x .|. y .&. y
65 test16 x y = x .|. y .&. y
66
66
67 test17 :: Number
67 test17 :: Number
examples/passing/OptimizerBug.purs+1−1
@@ -5,5 +5,5 @@ import Prelude
5x a = 1 + y a
5x a = 1 + y a
6
6
7y a = x a
7y a = x a
8−
8+
9main = Debug.Trace.trace "Done"
9main = Debug.Trace.trace "Done"
examples/passing/Patterns.purs+3−3
@@ -2,7 +2,7 @@ module Main where
2
2
3 import Prelude
3 import Prelude
4
4
5− test = \x -> case x of
5+ test = \x -> case x of
6 { str = "Foo", bool = true } -> true
6 { str = "Foo", bool = true } -> true
7 { str = "Bar", bool = b } -> b
7 { str = "Bar", bool = b } -> b
8 _ -> false
8 _ -> false
@@ -17,12 +17,12 @@ module Main where
17 _ -> 0
17 _ -> 0
18
18
19
19
20− h = \o -> case o of
20+ h = \o -> case o of
21 a@[_,_,_] -> a
21 a@[_,_,_] -> a
22 _ -> []
22 _ -> []
23
23
24 isDesc :: [Number] -> Boolean
24 isDesc :: [Number] -> Boolean
25 isDesc [x, y] | x > y = true
25 isDesc [x, y] | x > y = true
26 isDesc _ = false
26 isDesc _ = false
27−
27+
28 main = Debug.Trace.trace "Done"
28 main = Debug.Trace.trace "Done"
examples/passing/Person.purs+3−3
@@ -4,15 +4,15 @@ module Main where
4
4
5 data Person = Person { name :: String, age :: Number }
5 data Person = Person { name :: String, age :: Number }
6
6
7− foreign import itoa
7+ foreign import itoa
8 """
8 """
9 function itoa(n) {
9 function itoa(n) {
10 return n.toString();
10 return n.toString();
11 }
11 }
12 """ :: Number -> String
12 """ :: Number -> String
13−
13+
14 showPerson :: Person -> String
14 showPerson :: Person -> String
15 showPerson = \p -> case p of
15 showPerson = \p -> case p of
16 Person o -> o.name ++ ", aged " ++ itoa(o.age)
16 Person o -> o.name ++ ", aged " ++ itoa(o.age)
17−
17+
18 main = Debug.Trace.trace "Done"
18 main = Debug.Trace.trace "Done"
examples/passing/Rank2Data.purs+1−1
@@ -25,5 +25,5 @@ module Main where
25 two = succ zero
25 two = succ zero
26 four = add two two
26 four = add two two
27 fourNumber = runNat four
27 fourNumber = runNat four
28−
28+
29 main = Debug.Trace.trace "Done"
29 main = Debug.Trace.trace "Done"
examples/passing/Rank2TypeSynonym.purs+2−2
@@ -3,10 +3,10 @@ module Main where
3import Control.Monad.Eff
3import Control.Monad.Eff
4
4
5type Foo a = forall f. (Monad f) => f a
5type Foo a = forall f. (Monad f) => f a
6−
6+
7foo :: forall a. a -> Foo a
7foo :: forall a. a -> Foo a
8foo x = pure x
8foo x = pure x
9−
9+
10bar :: Foo Number
10bar :: Foo Number
11bar = foo 3
11bar = foo 3
12
12
examples/passing/Rank2Types.purs+1−1
@@ -7,5 +7,5 @@ module Main where
7
7
8 forever :: forall m a b. (forall a b. m a -> (a -> m b) -> m b) -> m a -> m b
8 forever :: forall m a b. (forall a b. m a -> (a -> m b) -> m b) -> m a -> m b
9 forever = \bind action -> bind action $ \_ -> forever bind action
9 forever = \bind action -> bind action $ \_ -> forever bind action
10−
10+
11 main = Debug.Trace.trace "Done"
11 main = Debug.Trace.trace "Done"
examples/passing/Recursion.purs+1−1
@@ -6,5 +6,5 @@ module Main where
6 0 -> 1
6 0 -> 1
7 1 -> 1
7 1 -> 1
8 n -> fib (n - 1) + fib (n - 2)
8 n -> fib (n - 1) + fib (n - 2)
9−
9+
10 main = Debug.Trace.trace "Done"
10 main = Debug.Trace.trace "Done"
examples/passing/Sequence.purs+2−2
@@ -4,9 +4,9 @@ import Control.Monad.Eff
4
4
5class Sequence t where
5class Sequence t where
6 sequence :: forall m a. (Monad m) => t (m a) -> m (t a)
6 sequence :: forall m a. (Monad m) => t (m a) -> m (t a)
7−
7+
8instance sequenceArray :: Sequence [] where
8instance sequenceArray :: Sequence [] where
9 sequence [] = pure []
9 sequence [] = pure []
10− sequence (x:xs) = (:) <$> x <*> sequence xs
10+ sequence (x:xs) = (:) <$> x <*> sequence xs
11
11
12main = sequence $ [Debug.Trace.trace "Done"]
12main = sequence $ [Debug.Trace.trace "Done"]
examples/passing/ShadowedTCOLet.purs+3−3
@@ -1,7 +1,7 @@
1module Main where
1module Main where
2
2
3−f x y z =
3+f x y z =
4− let f 1 2 3 = 1
4+ let f 1 2 3 = 1
5 in f x z y
5 in f x z y
6−
6+
7main = Debug.Trace.trace $ show $ f 1 3 2
7main = Debug.Trace.trace $ show $ f 1 3 2
examples/passing/SignedNumericLiterals.purs+2−2
@@ -6,10 +6,10 @@ module Main where
6 y = -0.5
6 y = -0.5
7 z = 0.5
7 z = 0.5
8 w = 1
8 w = 1
9−
9+
10 f :: Number -> Number
10 f :: Number -> Number
11 f x = -x
11 f x = -x
12
12
13 test1 = 2 - 1
13 test1 = 2 - 1
14−
14+
15 main = Debug.Trace.trace "Done"
15 main = Debug.Trace.trace "Done"
examples/passing/Superclasses3.purs+1−1
@@ -33,7 +33,7 @@ instance applicativeMTrace :: Applicative MTrace where
33instance bindMTrace :: Bind MTrace where
33instance bindMTrace :: Bind MTrace where
34 (>>=) m f = MTrace (runMTrace m >>= (runMTrace <<< f))
34 (>>=) m f = MTrace (runMTrace m >>= (runMTrace <<< f))
35
35
36−instance monadMTrace :: Monad MTrace
36+instance monadMTrace :: Monad MTrace
37
37
38instance writerMTrace :: MonadWriter String MTrace where
38instance writerMTrace :: MonadWriter String MTrace where
39 tell s = MTrace (trace s)
39 tell s = MTrace (trace s)
examples/passing/TailCall.purs+2−2
@@ -9,7 +9,7 @@ test n (x:xs) = test (n + x) xs
9loop :: forall a. Number -> a
9loop :: forall a. Number -> a
10loop x = loop (x + 1)
10loop x = loop (x + 1)
11
11
12−notATailCall = \x ->
12+notATailCall = \x ->
13 (\notATailCall -> notATailCall x) (\x -> x)
13 (\notATailCall -> notATailCall x) (\x -> x)
14−
14+
15main = Debug.Trace.print (test 0 [1, 2, 3])
15main = Debug.Trace.print (test 0 [1, 2, 3])
examples/passing/TopLevelCase.purs+1−1
@@ -14,5 +14,5 @@ module Main where
14 data A = A
14 data A = A
15
15
16 parseTest A 0 = 0
16 parseTest A 0 = 0
17−
17+
18 main = Debug.Trace.trace "Done"
18 main = Debug.Trace.trace "Done"
examples/passing/TypeClassImport.purs+3−3
@@ -7,9 +7,9 @@ foreign import data C :: *
7foreign import t "var t = null;" :: T
7foreign import t "var t = null;" :: T
8
8
9foreign import inst """
9foreign import inst """
10− var inst = {
10+ var inst = {
11− show: function(t) {
11+ show: function(t) {
12− return 'Done';
12+ return 'Done';
13 }
13 }
14 }""" :: C
14 }""" :: C
15
15
examples/passing/TypeClassMemberOrderChange.purs+1−1
@@ -3,7 +3,7 @@ module Main where
3class Test a where
3class Test a where
4 fn :: a -> a -> a
4 fn :: a -> a -> a
5 val :: a
5 val :: a
6−
6+
7instance testBoolean :: Test Boolean where
7instance testBoolean :: Test Boolean where
8 val = true
8 val = true
9 fn x y = y
9 fn x y = y
examples/passing/TypeDecl.purs+1−1
@@ -8,5 +8,5 @@ module Main where
8 iterate :: forall a. Number -> (a -> a) -> a -> a
8 iterate :: forall a. Number -> (a -> a) -> a -> a
9 iterate 0 f a = a
9 iterate 0 f a = a
10 iterate n f a = iterate (n - 1) f (f a)
10 iterate n f a = iterate (n - 1) f (f a)
11−
11+
12 main = Debug.Trace.trace "Done"
12 main = Debug.Trace.trace "Done"
examples/passing/TypeSynonyms.purs+2−2
@@ -1,6 +1,6 @@
1module Main where
1module Main where
2
2
3− type Lens a b =
3+ type Lens a b =
4 { get :: a -> b
4 { get :: a -> b
5 , set :: a -> b -> a
5 , set :: a -> b -> a
6 }
6 }
@@ -14,7 +14,7 @@ module Main where
14 type Pair a b = { fst :: a, snd :: b }
14 type Pair a b = { fst :: a, snd :: b }
15
15
16 fst :: forall a b. Lens (Pair a b) a
16 fst :: forall a b. Lens (Pair a b) a
17− fst =
17+ fst =
18 { get: \p -> p.fst
18 { get: \p -> p.fst
19 , set: \p a -> { fst: a, snd: p.snd }
19 , set: \p a -> { fst: a, snd: p.snd }
20 }
20 }
examples/passing/TypeWildcardsRecordExtension.purs+1−1
@@ -1,5 +1,5 @@
1module Main where
1module Main where
2−
2+
3foo :: forall a. {b :: Number | a} -> {b :: Number | _}
3foo :: forall a. {b :: Number | a} -> {b :: Number | _}
4foo f = f
4foo f = f
5
5
examples/passing/Where.purs+6−6
@@ -7,24 +7,24 @@ import Control.Monad.ST
7test1 x = y
7test1 x = y
8 where
8 where
9 y :: Number
9 y :: Number
10− y = x + 1
10+ y = x + 1
11
11
12test2 x y = x' + y'
12test2 x y = x' + y'
13 where
13 where
14 x' = x + 1
14 x' = x + 1
15 y' = y + 1
15 y' = y + 1
16−
16+
17
17
18test3 = f 1 2 3
18test3 = f 1 2 3
19 where f x y z = x + y + z
19 where f x y z = x + y + z
20−
20+
21
21
22test4 = f (+) [1, 2]
22test4 = f (+) [1, 2]
23 where f x [y, z] = x y z
23 where f x [y, z] = x y z
24−
24+
25
25
26test5 = g 10
26test5 = g 10
27− where
27+ where
28 f x | x > 0 = g (x / 2) + 1
28 f x | x > 0 = g (x / 2) + 1
29 f x = 0
29 f x = 0
30 g x = f (x - 1) + 1
30 g x = f (x - 1) + 1
@@ -35,7 +35,7 @@ test6 = if f true then f 1 else f 2
35
35
36test7 :: Number -> Number
36test7 :: Number -> Number
37test7 x = go x
37test7 x = go x
38− where
38+ where
39 go y | (x - 0.1 < y * y) && (y * y < x + 0.1) = y
39 go y | (x - 0.1 < y * y) && (y * y < x + 0.1) = y
40 go y = go $ (y + x / y) / 2
40 go y = go $ (y + x / y) / 2
41
41
examples/passing/s.purs+1−1
@@ -1,5 +1,5 @@
1module Main where
1module Main where
2
2
3 s = \x y z -> x z (y z)
3 s = \x y z -> x z (y z)
4−
4+
5 main = Debug.Trace.trace "Done"
5 main = Debug.Trace.trace "Done"
psc-docs/Main.hs+4−4
@@ -136,7 +136,7 @@ renderDeclaration n _ (P.ExternDataDeclaration name kind) =
136renderDeclaration n _ (P.TypeSynonymDeclaration name args ty) = do
136renderDeclaration n _ (P.TypeSynonymDeclaration name args ty) = do
137 let
137 let
138 typeApp = foldl P.TypeApp (P.TypeConstructor (P.Qualified Nothing name)) (map toTypeVar args)
138 typeApp = foldl P.TypeApp (P.TypeConstructor (P.Qualified Nothing name)) (map toTypeVar args)
139− typeName = prettyPrintType' typeApp
139+ typeName = prettyPrintType' typeApp
140 atIndent n $ "type " ++ typeName ++ " = " ++ prettyPrintType' ty
140 atIndent n $ "type " ++ typeName ++ " = " ++ prettyPrintType' ty
141renderDeclaration n exps (P.TypeClassDeclaration name args implies ds) = do
141renderDeclaration n exps (P.TypeClassDeclaration name args implies ds) = do
142 let impliesText = case implies of
142 let impliesText = case implies of
@@ -161,7 +161,7 @@ renderComments :: Int -> [P.Comment] -> Docs
161renderComments n cs = mapM_ (atIndent n) ls
161renderComments n cs = mapM_ (atIndent n) ls
162 where
162 where
163 ls = concatMap toLines cs
163 ls = concatMap toLines cs
164−
164+
165 toLines (P.LineComment s) = [s]
165 toLines (P.LineComment s) = [s]
166 toLines (P.BlockComment s) = lines s
166 toLines (P.BlockComment s) = lines s
167
167
@@ -217,7 +217,7 @@ inputFile = strArgument $
217 <> help "The input .purs file(s)"
217 <> help "The input .purs file(s)"
218
218
219includeHeirarcy :: Parser Bool
219includeHeirarcy :: Parser Bool
220−includeHeirarcy = switch $
220+includeHeirarcy = switch $
221 long "hierarchy-images"
221 long "hierarchy-images"
222 <> help "Include markdown for type class hierarchy images in the output."
222 <> help "Include markdown for type class hierarchy images in the output."
223
223
@@ -232,6 +232,6 @@ main = execParser opts >>= docgen
232 infoModList = fullDesc <> headerInfo <> footerInfo
232 infoModList = fullDesc <> headerInfo <> footerInfo
233 headerInfo = header "psc-docs - Generate Markdown documentation from PureScript extern files"
233 headerInfo = header "psc-docs - Generate Markdown documentation from PureScript extern files"
234 footerInfo = footer $ "psc-docs " ++ showVersion Paths.version
234 footerInfo = footer $ "psc-docs " ++ showVersion Paths.version
235−
235+
236 version :: Parser (a -> a)
236 version :: Parser (a -> a)
237 version = abortOption (InfoMsg (showVersion Paths.version)) $ long "version" <> help "Show the version number" <> hidden
237 version = abortOption (InfoMsg (showVersion Paths.version)) $ long "version" <> help "Show the version number" <> hidden
psc-make/Main.hs+9−9
@@ -111,12 +111,12 @@ outputDirectory = strOption $
111 <> help "The output directory"
111 <> help "The output directory"
112
112
113noTco :: Parser Bool
113noTco :: Parser Bool
114−noTco = switch $
114+noTco = switch $
115 long "no-tco"
115 long "no-tco"
116 <> help "Disable tail call optimizations"
116 <> help "Disable tail call optimizations"
117
117
118noPrelude :: Parser Bool
118noPrelude :: Parser Bool
119−noPrelude = switch $
119+noPrelude = switch $
120 long "no-prelude"
120 long "no-prelude"
121 <> help "Omit the Prelude"
121 <> help "Omit the Prelude"
122
122
@@ -137,15 +137,15 @@ verboseErrors = switch $
137 <> help "Display verbose error messages"
137 <> help "Display verbose error messages"
138
138
139noPrefix :: Parser Bool
139noPrefix :: Parser Bool
140−noPrefix = switch $
140+noPrefix = switch $
141 short 'p'
141 short 'p'
142 <> long "no-prefix"
142 <> long "no-prefix"
143 <> help "Do not include comment header"
143 <> help "Do not include comment header"
144
144
145
145
146options :: Parser (P.Options P.Make)
146options :: Parser (P.Options P.Make)
147−options = P.Options <$> noPrelude
147+options = P.Options <$> noPrelude
148− <*> noTco
148+ <*> noTco
149 <*> noMagicDo
149 <*> noMagicDo
150 <*> pure Nothing
150 <*> pure Nothing
151 <*> noOpts
151 <*> noOpts
@@ -153,9 +153,9 @@ options = P.Options <$> noPrelude
153 <*> pure P.MakeOptions
153 <*> pure P.MakeOptions
154
154
155pscMakeOptions :: Parser PSCMakeOptions
155pscMakeOptions :: Parser PSCMakeOptions
156−pscMakeOptions = PSCMakeOptions <$> many inputFile
156+pscMakeOptions = PSCMakeOptions <$> many inputFile
157− <*> outputDirectory
157+ <*> outputDirectory
158− <*> options
158+ <*> options
159 <*> (not <$> noPrefix)
159 <*> (not <$> noPrefix)
160
160
161main :: IO ()
161main :: IO ()
@@ -165,6 +165,6 @@ main = execParser opts >>= compile
165 infoModList = fullDesc <> headerInfo <> footerInfo
165 infoModList = fullDesc <> headerInfo <> footerInfo
166 headerInfo = header "psc-make - Compiles PureScript to Javascript"
166 headerInfo = header "psc-make - Compiles PureScript to Javascript"
167 footerInfo = footer $ "psc-make " ++ showVersion Paths.version
167 footerInfo = footer $ "psc-make " ++ showVersion Paths.version
168−
168+
169 version :: Parser (a -> a)
169 version :: Parser (a -> a)
170 version = abortOption (InfoMsg (showVersion Paths.version)) $ long "version" <> help "Show the version number" <> hidden
170 version = abortOption (InfoMsg (showVersion Paths.version)) $ long "version" <> help "Show the version number" <> hidden
psc/Main.hs+11−11
@@ -115,25 +115,25 @@ runMain = optional $ noArgs <|> withArgs
115 where
115 where
116 defaultVal = "Main"
116 defaultVal = "Main"
117 noArgs = flag' defaultVal (long "main")
117 noArgs = flag' defaultVal (long "main")
118− withArgs = strOption $
118+ withArgs = strOption $
119 long "main"
119 long "main"
120 <> help (concat [
120 <> help (concat [
121 "Generate code to run the main method in the specified module. ",
121 "Generate code to run the main method in the specified module. ",
122 "(no argument: \"", defaultVal, "\")"
122 "(no argument: \"", defaultVal, "\")"
123 ])
123 ])
124−
124+
125noMagicDo :: Parser Bool
125noMagicDo :: Parser Bool
126noMagicDo = switch $
126noMagicDo = switch $
127 long "no-magic-do"
127 long "no-magic-do"
128 <> help "Disable the optimization that overloads the do keyword to generate efficient code specifically for the Eff monad."
128 <> help "Disable the optimization that overloads the do keyword to generate efficient code specifically for the Eff monad."
129−
129+
130noTco :: Parser Bool
130noTco :: Parser Bool
131−noTco = switch $
131+noTco = switch $
132 long "no-tco"
132 long "no-tco"
133 <> help "Disable tail call optimizations"
133 <> help "Disable tail call optimizations"
134
134
135noPrelude :: Parser Bool
135noPrelude :: Parser Bool
136−noPrelude = switch $
136+noPrelude = switch $
137 long "no-prelude"
137 long "no-prelude"
138 <> help "Omit the Prelude"
138 <> help "Omit the Prelude"
139
139
@@ -161,22 +161,22 @@ externsFile = optional . strOption $
161 <> help "The output .e.purs file"
161 <> help "The output .e.purs file"
162
162
163noPrefix :: Parser Bool
163noPrefix :: Parser Bool
164−noPrefix = switch $
164+noPrefix = switch $
165 short 'p'
165 short 'p'
166 <> long "no-prefix"
166 <> long "no-prefix"
167 <> help "Do not include comment header"
167 <> help "Do not include comment header"
168
168
169options :: Parser (P.Options P.Compile)
169options :: Parser (P.Options P.Compile)
170−options = P.Options <$> noPrelude
170+options = P.Options <$> noPrelude
171− <*> noTco
171+ <*> noTco
172 <*> noMagicDo
172 <*> noMagicDo
173 <*> runMain
173 <*> runMain
174 <*> noOpts
174 <*> noOpts
175 <*> verboseErrors
175 <*> verboseErrors
176 <*> additionalOptions
176 <*> additionalOptions
177 where
177 where
178− additionalOptions =
178+ additionalOptions =
179− P.CompileOptions <$> browserNamespace
179+ P.CompileOptions <$> browserNamespace
180 <*> many dceModule
180 <*> many dceModule
181 <*> many codeGenModule
181 <*> many codeGenModule
182
182
@@ -195,7 +195,7 @@ main = execParser opts >>= compile
195 infoModList = fullDesc <> headerInfo <> footerInfo
195 infoModList = fullDesc <> headerInfo <> footerInfo
196 headerInfo = header "psc - Compiles PureScript to Javascript"
196 headerInfo = header "psc - Compiles PureScript to Javascript"
197 footerInfo = footer $ "psc " ++ showVersion Paths.version
197 footerInfo = footer $ "psc " ++ showVersion Paths.version
198−
198+
199 version :: Parser (a -> a)
199 version :: Parser (a -> a)
200 version = abortOption (InfoMsg (showVersion Paths.version)) $ long "version" <> help "Show the version number" <> hidden
200 version = abortOption (InfoMsg (showVersion Paths.version)) $ long "version" <> help "Show the version number" <> hidden
201
201
psci/Parser.hs+4−4
@@ -34,8 +34,8 @@ import qualified Language.PureScript.Parser.Common as C (mark, same)
34-- Parses PSCI metacommands or expressions input from the user.
34-- Parses PSCI metacommands or expressions input from the user.
35--
35--
36parseCommand :: String -> Either String Command
36parseCommand :: String -> Either String Command
37−parseCommand cmdString =
37+parseCommand cmdString =
38− case splitCommand cmdString of
38+ case splitCommand cmdString of
39 Just ('?', _) -> return Help
39 Just ('?', _) -> return Help
40 Just ('q', _) -> return Quit
40 Just ('q', _) -> return Quit
41 Just ('r', _) -> return Reset
41 Just ('r', _) -> return Reset
@@ -52,7 +52,7 @@ parseCommand cmdString =
52 parseRest p s = either (Left . show) Right $ do
52 parseRest p s = either (Left . show) Right $ do
53 ts <- P.lex "" s
53 ts <- P.lex "" s
54 P.runTokenParser "" (p <* eof) ts
54 P.runTokenParser "" (p <* eof) ts
55−
55+
56 trimEnd :: String -> String
56 trimEnd :: String -> String
57 trimEnd = reverse . dropWhile isSpace . reverse
57 trimEnd = reverse . dropWhile isSpace . reverse
58
58
@@ -68,7 +68,7 @@ parseCommand cmdString =
68 --
68 --
69 psciExpression :: P.TokenParser Command
69 psciExpression :: P.TokenParser Command
70 psciExpression = Expression <$> P.parseValue
70 psciExpression = Expression <$> P.parseValue
71−
71+
72 -- |
72 -- |
73 -- PSCI version of @let@.
73 -- PSCI version of @let@.
74 -- This is essentially let from do-notation.
74 -- This is essentially let from do-notation.
purescript.cabal+1−1
@@ -150,7 +150,7 @@ executable psci
150 ghc-options: -Wall -fno-warn-warnings-deprecations -O2
150 ghc-options: -Wall -fno-warn-warnings-deprecations -O2
151
151
152executable psc-docs
152executable psc-docs
153− build-depends: base >=4 && <5, purescript -any,
153+ build-depends: base >=4 && <5, purescript -any,
154 optparse-applicative >= 0.10.0, process -any, mtl -any
154 optparse-applicative >= 0.10.0, process -any, mtl -any
155 main-is: Main.hs
155 main-is: Main.hs
156 buildable: True
156 buildable: True
src/Language/PureScript/AST/SourcePos.hs+2−2
@@ -48,6 +48,6 @@ data SourceSpan = SourceSpan
48 --
48 --
49 , spanEnd :: SourcePos
49 , spanEnd :: SourcePos
50 } deriving (D.Data, D.Typeable)
50 } deriving (D.Data, D.Typeable)
51−
51+
52instance Show SourceSpan where
52instance Show SourceSpan where
53− show sp = spanName sp ++ " " ++ show (spanStart sp) ++ " - " ++ show (spanEnd sp)
53+ show sp = spanName sp ++ " " ++ show (spanStart sp) ++ " - " ++ show (spanEnd sp)
src/Language/PureScript/CodeGen/Externs.hs+1−1
@@ -49,7 +49,7 @@ moduleToPs (Module moduleName ds (Just exts)) env = intercalate "\n" . execWrite
49 tell [ unwords [ show assoc, show prec, ident ] ]
49 tell [ unwords [ show assoc, show prec, ident ] ]
50 declToPs (PositionedDeclaration _ com d) = mapM commentToPs com >> declToPs d
50 declToPs (PositionedDeclaration _ com d) = mapM commentToPs com >> declToPs d
51 declToPs _ = return ()
51 declToPs _ = return ()
52−
52+
53 commentToPs :: Comment -> Writer [String] ()
53 commentToPs :: Comment -> Writer [String] ()
54 commentToPs (LineComment s) = tell ["-- " ++ s]
54 commentToPs (LineComment s) = tell ["-- " ++ s]
55 commentToPs (BlockComment s) = tell ["{- " ++ s ++ " -}"]
55 commentToPs (BlockComment s) = tell ["{- " ++ s ++ " -}"]
src/Language/PureScript/CodeGen/JS.hs+2−2
@@ -81,7 +81,7 @@ bindToJs mp (NonRec ident val) = return <$> nonRecToJS mp ident val
81bindToJs mp (Rec vals) = forM vals (uncurry (nonRecToJS mp))
81bindToJs mp (Rec vals) = forM vals (uncurry (nonRecToJS mp))
82
82
83-- |
83-- |
84−-- Generate code in the simplified Javascript intermediate representation for a single non-recursive
84+-- Generate code in the simplified Javascript intermediate representation for a single non-recursive
85-- declaration.
85-- declaration.
86--
86--
87-- The main purpose of this function is to handle code generation for comments.
87-- 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) =
92nonRecToJS mp ident val = do
92nonRecToJS mp ident val = do
93 js <- valueToJs mp val
93 js <- valueToJs mp val
94 return $ JSVariableIntroduction (identToJs ident) (Just js)
94 return $ JSVariableIntroduction (identToJs ident) (Just js)
95−
95+
96
96
97-- |
97-- |
98-- Generate code in the simplified Javascript intermediate representation for a variable based on a
98-- Generate code in the simplified Javascript intermediate representation for a variable based on a
src/Language/PureScript/Comments.hs+2−2
@@ -18,8 +18,8 @@
18module Language.PureScript.Comments where
18module Language.PureScript.Comments where
19
19
20import qualified Data.Data as D
20import qualified Data.Data as D
21−
21+
22data Comment
22data Comment
23 = LineComment String
23 = LineComment String
24 | BlockComment String
24 | BlockComment String
25− deriving (Show, Eq, Ord, D.Data, D.Typeable)
25+ deriving (Show, Eq, Ord, D.Data, D.Typeable)
src/Language/PureScript/CoreFn/Ann.hs+1−1
@@ -34,4 +34,4 @@ nullAnn = (Nothing, [], Nothing, Nothing)
34-- Remove the comments from an annotation
34-- Remove the comments from an annotation
35--
35--
36removeComments :: Ann -> Ann
36removeComments :: Ann -> Ann
37−removeComments (ss, _, ty, meta) = (ss, [], ty, meta)
37+removeComments (ss, _, ty, meta) = (ss, [], ty, meta)
src/Language/PureScript/Parser.hs+1−1
@@ -32,4 +32,4 @@ import Language.PureScript.Parser.Types as P
32import Language.PureScript.Parser.State as P
32import Language.PureScript.Parser.State as P
33import Language.PureScript.Parser.Kinds as P
33import Language.PureScript.Parser.Kinds as P
34import Language.PureScript.Parser.Lexer as P
34import Language.PureScript.Parser.Lexer as P
35−import Language.PureScript.Parser.Declarations as P
35+import Language.PureScript.Parser.Declarations as P
src/Language/PureScript/Parser/Lexer.hs+30−30
@@ -15,7 +15,7 @@
15
15
16{-# LANGUAGE TupleSections #-}
16{-# LANGUAGE TupleSections #-}
17
17
18−module Language.PureScript.Parser.Lexer
18+module Language.PureScript.Parser.Lexer
19 ( PositionedToken(..)
19 ( PositionedToken(..)
20 , Token()
20 , Token()
21 , TokenParser()
21 , TokenParser()
@@ -34,8 +34,8 @@ module Language.PureScript.Parser.Lexer
34 , squares
34 , squares
35 , indent
35 , indent
36 , indentAt
36 , indentAt
37− , larrow
37+ , larrow
38− , rarrow
38+ , rarrow
39 , lfatArrow
39 , lfatArrow
40 , rfatArrow
40 , rfatArrow
41 , colon
41 , colon
@@ -83,7 +83,7 @@ import Language.PureScript.Comments
83
83
84import qualified Text.Parsec as P
84import qualified Text.Parsec as P
85import qualified Text.Parsec.Token as PT
85import qualified Text.Parsec.Token as PT
86−
86+
87data Token
87data Token
88 = LParen
88 = LParen
89 | RParen
89 | RParen
@@ -112,7 +112,7 @@ data Token
112 | StringLiteral String
112 | StringLiteral String
113 | Number (Either Integer Double)
113 | Number (Either Integer Double)
114 deriving (Show, Eq, Ord)
114 deriving (Show, Eq, Ord)
115−
115+
116prettyPrintToken :: Token -> String
116prettyPrintToken :: Token -> String
117prettyPrintToken LParen = "("
117prettyPrintToken LParen = "("
118prettyPrintToken RParen = ")"
118prettyPrintToken RParen = ")"
@@ -146,19 +146,19 @@ data PositionedToken = PositionedToken
146 , ptToken :: Token
146 , ptToken :: Token
147 , ptComments :: [Comment]
147 , ptComments :: [Comment]
148 } deriving (Eq)
148 } deriving (Eq)
149−
149+
150instance Show PositionedToken where
150instance Show PositionedToken where
151 show = show . ptToken
151 show = show . ptToken
152
152
153lex :: FilePath -> String -> Either P.ParseError [PositionedToken]
153lex :: FilePath -> String -> Either P.ParseError [PositionedToken]
154lex filePath input = P.parse parseTokens filePath input
154lex filePath input = P.parse parseTokens filePath input
155−
155+
156parseTokens :: P.Parsec String u [PositionedToken]
156parseTokens :: P.Parsec String u [PositionedToken]
157parseTokens = whitespace *> P.many parsePositionedToken <* P.skipMany parseComment <* P.eof
157parseTokens = whitespace *> P.many parsePositionedToken <* P.skipMany parseComment <* P.eof
158
158
159whitespace :: P.Parsec String u ()
159whitespace :: P.Parsec String u ()
160whitespace = P.skipMany (P.satisfy isSpace)
160whitespace = P.skipMany (P.satisfy isSpace)
161−
161+
162parseComment :: P.Parsec String u Comment
162parseComment :: P.Parsec String u Comment
163parseComment = (BlockComment <$> blockComment <|> LineComment <$> lineComment) <* whitespace
163parseComment = (BlockComment <$> blockComment <|> LineComment <$> lineComment) <* whitespace
164 where
164 where
@@ -177,11 +177,11 @@ parsePositionedToken = P.try $ do
177
177
178parseToken :: P.Parsec String u Token
178parseToken :: P.Parsec String u Token
179parseToken = P.choice
179parseToken = P.choice
180− [ P.try $ P.string "<-" *> P.notFollowedBy symbolChar *> pure LArrow
180+ [ P.try $ P.string "<-" *> P.notFollowedBy symbolChar *> pure LArrow
181 , P.try $ P.string "<=" *> P.notFollowedBy symbolChar *> pure LFatArrow
181 , P.try $ P.string "<=" *> P.notFollowedBy symbolChar *> pure LFatArrow
182− , P.try $ P.string "->" *> P.notFollowedBy symbolChar *> pure RArrow
182+ , P.try $ P.string "->" *> P.notFollowedBy symbolChar *> pure RArrow
183− , P.try $ P.string "=>" *> P.notFollowedBy symbolChar *> pure RFatArrow
183+ , P.try $ P.string "=>" *> P.notFollowedBy symbolChar *> pure RFatArrow
184− , P.try $ P.string "::" *> P.notFollowedBy symbolChar *> pure DoubleColon
184+ , P.try $ P.string "::" *> P.notFollowedBy symbolChar *> pure DoubleColon
185 , P.try $ P.char '(' *> pure LParen
185 , P.try $ P.char '(' *> pure LParen
186 , P.try $ P.char ')' *> pure RParen
186 , P.try $ P.char ')' *> pure RParen
187 , P.try $ P.char '{' *> pure LBrace
187 , P.try $ P.char '{' *> pure LBrace
@@ -196,10 +196,10 @@ parseToken = P.choice
196 , P.try $ P.char '.' *> P.notFollowedBy symbolChar *> pure Dot
196 , P.try $ P.char '.' *> P.notFollowedBy symbolChar *> pure Dot
197 , P.try $ P.char ';' *> P.notFollowedBy symbolChar *> pure Semi
197 , P.try $ P.char ';' *> P.notFollowedBy symbolChar *> pure Semi
198 , P.try $ P.char '@' *> P.notFollowedBy symbolChar *> pure At
198 , P.try $ P.char '@' *> P.notFollowedBy symbolChar *> pure At
199− , LName <$> parseLName
199+ , LName <$> parseLName
200 , do uName <- parseUName
200 , do uName <- parseUName
201 (guard (validModuleName uName) >> Qualifier uName <$ P.char '.') <|> pure (UName uName)
201 (guard (validModuleName uName) >> Qualifier uName <$ P.char '.') <|> pure (UName uName)
202− , Symbol <$> parseSymbol
202+ , Symbol <$> parseSymbol
203 , StringLiteral <$> parseStringLiteral
203 , StringLiteral <$> parseStringLiteral
204 , Number <$> parseNumber
204 , Number <$> parseNumber
205 ] <* whitespace
205 ] <* whitespace
@@ -207,16 +207,16 @@ parseToken = P.choice
207 where
207 where
208 parseLName :: P.Parsec String u String
208 parseLName :: P.Parsec String u String
209 parseLName = (:) <$> identStart <*> P.many identLetter
209 parseLName = (:) <$> identStart <*> P.many identLetter
210−
210+
211 parseUName :: P.Parsec String u String
211 parseUName :: P.Parsec String u String
212 parseUName = (:) <$> P.upper <*> P.many uidentLetter
212 parseUName = (:) <$> P.upper <*> P.many uidentLetter
213−
213+
214 parseSymbol :: P.Parsec String u String
214 parseSymbol :: P.Parsec String u String
215 parseSymbol = P.many1 symbolChar
215 parseSymbol = P.many1 symbolChar
216−
216+
217 identStart :: P.Parsec String u Char
217 identStart :: P.Parsec String u Char
218 identStart = P.lower <|> P.oneOf "_"
218 identStart = P.lower <|> P.oneOf "_"
219−
219+
220 identLetter :: P.Parsec String u Char
220 identLetter :: P.Parsec String u Char
221 identLetter = P.alphaNum <|> P.oneOf "_'"
221 identLetter = P.alphaNum <|> P.oneOf "_'"
222
222
@@ -225,13 +225,13 @@ parseToken = P.choice
225
225
226 symbolChar :: P.Parsec String u Char
226 symbolChar :: P.Parsec String u Char
227 symbolChar = P.oneOf opChars
227 symbolChar = P.oneOf opChars
228−
228+
229 parseStringLiteral :: P.Parsec String u String
229 parseStringLiteral :: P.Parsec String u String
230 parseStringLiteral = blockString <|> PT.stringLiteral tokenParser
230 parseStringLiteral = blockString <|> PT.stringLiteral tokenParser
231− where
231+ where
232 delimeter = P.try (P.string "\"\"\"")
232 delimeter = P.try (P.string "\"\"\"")
233 blockString = delimeter >> P.manyTill P.anyChar delimeter
233 blockString = delimeter >> P.manyTill P.anyChar delimeter
234−
234+
235 parseNumber :: P.Parsec String u (Either Integer Double)
235 parseNumber :: P.Parsec String u (Either Integer Double)
236 parseNumber = (Right <$> P.try (PT.float tokenParser) <|>
236 parseNumber = (Right <$> P.try (PT.float tokenParser) <|>
237 Left <$> P.try (PT.natural tokenParser)) P.<?> "number"
237 Left <$> P.try (PT.natural tokenParser)) P.<?> "number"
@@ -261,10 +261,10 @@ tokenParser :: PT.GenTokenParser String u Identity
261tokenParser = PT.makeTokenParser langDef
261tokenParser = PT.makeTokenParser langDef
262
262
263type TokenParser a = P.Parsec [PositionedToken] ParseState a
263type TokenParser a = P.Parsec [PositionedToken] ParseState a
264−
264+
265anyToken :: TokenParser PositionedToken
265anyToken :: TokenParser PositionedToken
266anyToken = P.token (prettyPrintToken . ptToken) ptSourcePos Just
266anyToken = P.token (prettyPrintToken . ptToken) ptSourcePos Just
267−
267+
268token :: (Token -> Maybe a) -> TokenParser a
268token :: (Token -> Maybe a) -> TokenParser a
269token f = P.token (prettyPrintToken . ptToken) ptSourcePos (f . ptToken)
269token f = P.token (prettyPrintToken . ptToken) ptSourcePos (f . ptToken)
270
270
@@ -347,7 +347,7 @@ semi :: TokenParser ()
347semi = match Semi
347semi = match Semi
348
348
349at :: TokenParser ()
349at :: TokenParser ()
350−at = match At
350+at = match At
351
351
352-- |
352-- |
353-- Parse zero or more values separated by semicolons
353-- Parse zero or more values separated by semicolons
@@ -408,7 +408,7 @@ uname' s = token go P.<?> show s
408 where
408 where
409 go (UName s') | s == s' = Just ()
409 go (UName s') | s == s' = Just ()
410 go _ = Nothing
410 go _ = Nothing
411−
411+
412symbol :: TokenParser String
412symbol :: TokenParser String
413symbol = token go P.<?> "symbol"
413symbol = token go P.<?> "symbol"
414 where
414 where
@@ -424,7 +424,7 @@ symbol' s = token go P.<?> show s
424 go Colon | s == ":" = Just ()
424 go Colon | s == ":" = Just ()
425 go LFatArrow | s == "<=" = Just ()
425 go LFatArrow | s == "<=" = Just ()
426 go _ = Nothing
426 go _ = Nothing
427−
427+
428stringLiteral :: TokenParser String
428stringLiteral :: TokenParser String
429stringLiteral = token go P.<?> "string literal"
429stringLiteral = token go P.<?> "string literal"
430 where
430 where
@@ -448,10 +448,10 @@ identifier = token go P.<?> "identifier"
448 where
448 where
449 go (LName s) | s `notElem` reservedPsNames = Just s
449 go (LName s) | s `notElem` reservedPsNames = Just s
450 go _ = Nothing
450 go _ = Nothing
451−
451+
452validModuleName :: String -> Bool
452validModuleName :: String -> Bool
453validModuleName s = not ('_' `elem` s)
453validModuleName s = not ('_' `elem` s)
454−
454+
455-- |
455-- |
456-- A list of purescript reserved identifiers
456-- A list of purescript reserved identifiers
457--
457--
@@ -479,7 +479,7 @@ reservedPsNames = [ "data"
479 , "in"
479 , "in"
480 , "where"
480 , "where"
481 ]
481 ]
482−
482+
483reservedTypeNames :: [String]
483reservedTypeNames :: [String]
484reservedTypeNames = [ "forall", "where" ]
484reservedTypeNames = [ "forall", "where" ]
485
485
@@ -488,4 +488,4 @@ reservedTypeNames = [ "forall", "where" ]
488--
488--
489opChars :: [Char]
489opChars :: [Char]
490opChars = ":!#$%&*+./<=>?@\\^|-~"
490opChars = ":!#$%&*+./<=>?@\\^|-~"
491−
491+
src/Language/PureScript/Pretty/JS.hs+4−4
@@ -135,16 +135,16 @@ literals = mkPattern' match
135 commentLines :: Comment -> [String]
135 commentLines :: Comment -> [String]
136 commentLines (LineComment s) = [s]
136 commentLines (LineComment s) = [s]
137 commentLines (BlockComment s) = lines s
137 commentLines (BlockComment s) = lines s
138−
138+
139− asLine :: String -> StateT PrinterState Maybe String
139+ asLine :: String -> StateT PrinterState Maybe String
140 asLine s = do
140 asLine s = do
141 i <- currentIndent
141 i <- currentIndent
142 return $ i ++ " * " ++ removeComments s ++ "\n"
142 return $ i ++ " * " ++ removeComments s ++ "\n"
143−
143+
144 removeComments :: String -> String
144 removeComments :: String -> String
145 removeComments ('*' : '/' : s) = removeComments s
145 removeComments ('*' : '/' : s) = removeComments s
146 removeComments (c : s) = c : removeComments s
146 removeComments (c : s) = c : removeComments s
147−
147+
148 removeComments [] = []
148 removeComments [] = []
149 match (JSRaw js) = return js
149 match (JSRaw js) = return js
150 match _ = mzero
150 match _ = mzero
src/Language/PureScript/Pretty/Types.hs+1−1
@@ -34,7 +34,7 @@ import Language.PureScript.Environment
34typeLiterals :: Pattern () Type String
34typeLiterals :: Pattern () Type String
35typeLiterals = mkPattern match
35typeLiterals = mkPattern match
36 where
36 where
37− match TypeWildcard = Just "_"
37+ match TypeWildcard = Just "_"
38 match (TypeVar var) = Just var
38 match (TypeVar var) = Just var
39 match (PrettyPrintObject row) = Just $ "{ " ++ prettyPrintRow row ++ " }"
39 match (PrettyPrintObject row) = Just $ "{ " ++ prettyPrintRow row ++ " }"
40 match (PrettyPrintArray ty) = Just $ "[" ++ prettyPrintType ty ++ "]"
40 match (PrettyPrintArray ty) = Just $ "[" ++ prettyPrintType ty ++ "]"
src/Language/PureScript/Sugar/BindingGroups.hs+3−3
@@ -52,12 +52,12 @@ createBindingGroups :: ModuleName -> [Declaration] -> Either ErrorStack [Declara
52createBindingGroups moduleName = mapM f <=< handleDecls
52createBindingGroups moduleName = mapM f <=< handleDecls
53
53
54 where
54 where
55− (f, _, _) = everywhereOnValuesTopDownM return handleExprs return
55+ (f, _, _) = everywhereOnValuesTopDownM return handleExprs return
56−
56+
57 handleExprs :: Expr -> Either ErrorStack Expr
57 handleExprs :: Expr -> Either ErrorStack Expr
58 handleExprs (Let ds val) = flip Let val <$> handleDecls ds
58 handleExprs (Let ds val) = flip Let val <$> handleDecls ds
59 handleExprs other = return other
59 handleExprs other = return other
60−
60+
61 -- |
61 -- |
62 -- Replace all sets of mutually-recursive declarations with binding groups
62 -- Replace all sets of mutually-recursive declarations with binding groups
63 --
63 --
src/Language/PureScript/TypeChecker/Unify.hs+1−1
@@ -158,7 +158,7 @@ replaceVarWithUnknown :: String -> Type -> UnifyT Type Check Type
158replaceVarWithUnknown ident ty = do
158replaceVarWithUnknown ident ty = do
159 tu <- fresh
159 tu <- fresh
160 return $ replaceTypeVars ident tu ty
160 return $ replaceTypeVars ident tu ty
161−
161+
162-- |
162-- |
163-- Replace type wildcards with unknowns
163-- Replace type wildcards with unknowns
164--
164--
tests/Main.hs+2−2
@@ -35,7 +35,7 @@ readInput inputFiles = forM inputFiles $ \inputFile -> do
35 return (inputFile, text)
35 return (inputFile, text)
36
36
37loadPrelude :: Either String (String, String, P.Environment)
37loadPrelude :: Either String (String, String, P.Environment)
38−loadPrelude =
38+loadPrelude =
39 case P.parseModulesFromFiles id [("", P.prelude)] of
39 case P.parseModulesFromFiles id [("", P.prelude)] of
40 Left parseError -> Left (show parseError)
40 Left parseError -> Left (show parseError)
41 Right ms -> P.compile (P.defaultCompileOptions { P.optionsAdditional = P.CompileOptions "Tests" [] [] }) (map snd ms) []
41 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
85
85
86main :: IO ()
86main :: IO ()
87main = do
87main = do
88− putStrLn "Compiling Prelude"
88+ putStrLn "Compiling Prelude"
89 case loadPrelude of
89 case loadPrelude of
90 Left err -> putStrLn err >> exitFailure
90 Left err -> putStrLn err >> exitFailure
91 Right (preludeJs, exts, _) -> do
91 Right (preludeJs, exts, _) -> do