git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Merge pull request #1925 from bagl/fix-#1916
5dad0d6Phil Freeman
CONTRIBUTORS.md+1
@@ -9,6 +9,7 @@ This file lists the contributors to the PureScript compiler project, and the ter
9- [@anthok88](https://github.com/anthoq88) - My existing contributions and all future contributions until further notice are Copyright anthoq88, and are licensed to the owners and users of the PureScript compiler project under the terms of the MIT license
9- [@anthok88](https://github.com/anthoq88) - My existing contributions and all future contributions until further notice are Copyright anthoq88, and are licensed to the owners and users of the PureScript compiler project under the terms of the MIT license
10- [@ardumont](https://github.com/ardumont) (Antoine R. Dumont) My existing contributions and all future contributions until further notice are Copyright Antoine R. Dumont, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
10- [@ardumont](https://github.com/ardumont) (Antoine R. Dumont) My existing contributions and all future contributions until further notice are Copyright Antoine R. Dumont, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
11- [@aspidites](https://github.com/aspidites) (Edwin Marshall) My existing contributions and all future contributions until further notice are Copyright Edwin Marshall, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
11- [@aspidites](https://github.com/aspidites) (Edwin Marshall) My existing contributions and all future contributions until further notice are Copyright Edwin Marshall, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
12+- [@bagl](https://github.com/bagl) (Petr Vapenka) My existing contributions and all future contributions until further notice are Copyright Petr Vapenka, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
12- [@balajirrao](https://github.com/balajirrao) (Balaji Rao) - My existing contributions and all future contributions until further notice are Copyright Balaji Rao, and are licensed to the owners and users of the PureScript compiler project under the terms of the MIT license.
13- [@balajirrao](https://github.com/balajirrao) (Balaji Rao) - My existing contributions and all future contributions until further notice are Copyright Balaji Rao, and are licensed to the owners and users of the PureScript compiler project under the terms of the MIT license.
13- [@bergmark](https://github.com/bergmark) (Adam Bergmark) - My existing contributions and all future contributions until further notice are Copyright Adam Bergmark, and are licensed to the owners and users of the PureScript compiler project under the terms of the MIT license.
14- [@bergmark](https://github.com/bergmark) (Adam Bergmark) - My existing contributions and all future contributions until further notice are Copyright Adam Bergmark, and are licensed to the owners and users of the PureScript compiler project under the terms of the MIT license.
14- [@Bogdanp](https://github.com/Bogdanp) (Bogdan Paul Popa) My existing contributions and all future contributions until further notice are Copyright Bogdan Paul Popa, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
15- [@Bogdanp](https://github.com/Bogdanp) (Bogdan Paul Popa) My existing contributions and all future contributions until further notice are Copyright Bogdan Paul Popa, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
examples/failing/OperatorSections.pursnew file+8
@@ -0,0 +1,8 @@
1+-- @shouldFailWith CannotApplyFunction
2+module Main where
3+
4+import Prelude
5+
6+main = do
7+ (true `not` _)
8+
src/Language/PureScript/AST/Declarations.hs+1−2
@@ -331,8 +331,7 @@ data Expr
331 --
331 --
332 | Parens Expr
332 | Parens Expr
333 -- |
333 -- |
334− -- Operator section. This will be removed during desugaring and replaced with a partially applied
334+ -- Operator section. This will be removed during desugaring and replaced with lambda.
335− -- operator or lambda to flip the arguments.
336 --
335 --
337 | OperatorSection Expr (Either Expr Expr)
336 | OperatorSection Expr (Either Expr Expr)
338 -- |
337 -- |
src/Language/PureScript/Sugar/Operators.hs+6−3
@@ -189,8 +189,11 @@ desugarOperatorSections (Module ss coms mn ds exts) =
189 (goDecl, _, _) = everywhereOnValuesM return goExpr return
189 (goDecl, _, _) = everywhereOnValuesM return goExpr return
190
190
191 goExpr :: Expr -> m Expr
191 goExpr :: Expr -> m Expr
192− goExpr (OperatorSection op (Left val)) = return $ App op val
192+ goExpr (OperatorSection op eVal) = do
193− goExpr (OperatorSection op (Right val)) = do
194 arg <- freshIdent'
193 arg <- freshIdent'
195− return $ Abs (Left arg) $ App (App op (Var (Qualified Nothing arg))) val
194+ let var = Var (Qualified Nothing arg)
195+ f2 a b = Abs (Left arg) $ App (App op a) b
196+ return $ case eVal of
197+ Left val -> f2 val var
198+ Right val -> f2 var val
196 goExpr other = return other
199 goExpr other = return other